Last Comment Bug 229271 - unwanted "white space" in function getLDAPValue from autoconfig/prefcalls.js
: unwanted "white space" in function getLDAPValue from autoconfig/prefcalls.js
: fixed1.7.5
Product: Core
Classification: Components
Component: Preferences: Backend (show other bugs)
: Trunk
: All All
-- normal (vote)
: ---
Assigned To: timeless
: Benjamin Smedberg [:bsmedberg]
Depends on:
  Show dependency treegraph
Reported: 2003-12-23 08:54 PST by Jehan Procaccia
Modified: 2005-07-20 09:55 PDT (History)
9 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

drop unwanted whitespace (989 bytes, patch)
2004-07-07 23:47 PDT, timeless
alecf: review+
dmose: superreview+
mozilla: approval1.7.5+
asa: approval1.8a2+
Details | Diff | Splinter Review

Description User image Jehan Procaccia 2003-12-23 08:54:07 PST
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.4) Gecko/20031027
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.4) Gecko/20031027

I use autoconfig, which I documented on
and opened a "bug" ID 222973 about lack of doc, I realized that my ldap based
lockPref gets a white space in front of every
variables fetches from ldap.
here's the symptoms:
Return-Path: <" jehan.procaccia">
So mail is rejected :-(
indeed in users prefs.js there's:
user_pref("mail.identity.id1.useremail", "");

Reproducible: Always

Steps to Reproduce:
1.use autoconfig with variables fetched from ldap, cf
2.typical javascript code in my autoconfig file: var ldapmail = getLDAPValue (
values ,"mail" );

Actual Results:  
here's the reulted user preference:
user_pref("mail.identity.id1.useremail", "");
note the unwanted "white space" in from of the email address

Expected Results:  
not inserted the white space:
user_pref("mail.identity.id1.useremail", "");

I found a workaround, cf bug 206294: , incrementing by 1 start_pos in function
getLDAPValue from autoconfig/preffcalls.js, see below bettwen //start //end:

function getLDAPValue(str, key) {

    try {
        if (str == null || key == null)
            return null;

        var search_key = "\n" + key + "=";

        displayError("Jehan getLDAPValue:\nsearch_key:"+search_key+"\nstr"+str);

        var start_pos = str.indexOf(search_key);
        if (start_pos == -1)
            return null;

        start_pos += search_key.length;
        start_pos +=1;
        var end_pos = str.indexOf("\n", start_pos);
        if (end_pos == -1)
            end_pos = str.length;

        var attrib = str.substring(start_pos, end_pos);

        return str.substring(start_pos, end_pos);

    catch(e) {
        displayError("getLDAPValue", e);
Comment 1 User image simon annear 2004-07-07 19:26:33 PDT
I have confirmed that this bug exists in Mozilla/5.0 (Windows; U; Windows NT
5.0; en-US; rv:1.7) Gecko/20040514

The resolution based on Jehan's workaround is just to add a single line to the
prefcalls.js file which increments the start_pos value by 1

diff prefcalls.js.orig
     start_pos += 1;

Comment 2 User image timeless 2004-07-07 23:45:04 PDT
attachment 57051 [details] [diff] [review] <bug 89137 comment 35> introduced the space.

I can't see any reason for it.
Comment 3 User image timeless 2004-07-07 23:47:06 PDT
Created attachment 152586 [details] [diff] [review]
drop unwanted whitespace
Comment 4 User image Jehan Procaccia 2004-07-08 01:57:11 PDT
Very good, I'am glad you finally corrected this bug .
However, in which release can I expect this patch beeing applied ?
Thanks .
Comment 5 User image Alec Flett 2004-07-08 09:06:33 PDT
Comment on attachment 152586 [details] [diff] [review]
drop unwanted whitespace

Comment 6 User image Dan Mosedale (:dmose) 2004-07-08 10:41:41 PDT
Comment on attachment 152586 [details] [diff] [review]
drop unwanted whitespace

Comment 7 User image Asa Dotzler [:asa] 2004-07-09 12:37:00 PDT
Comment on attachment 152586 [details] [diff] [review]
drop unwanted whitespace

a=asa (on behalf of drivers) for checkin to 1.8a2
Comment 8 User image timeless 2004-07-18 07:51:02 PDT
mozilla/extensions/pref/autoconfig/src/nsLDAPSyncQuery.cpp 	1.11
Comment 9 User image Mats Larsson 2004-11-08 04:48:28 PST
Any chance this will be fixed in 1.7.x?
Comment 10 User image timeless 2004-11-09 10:52:36 PST given that it's sat here w/ the approval1.7.x? flag
for four months, i doubt it.
Comment 11 User image Mike Kaply [:mkaply] 2004-11-09 10:54:28 PST
Comment on attachment 152586 [details] [diff] [review]
drop unwanted whitespace

Sorry about that.
Comment 12 User image timeless 2004-11-09 11:17:23 PST
Comment 13 User image Jehan Procaccia 2005-04-05 07:42:54 PDT
Indeed , since my fedora Core 2 system recently updated from mozilla 1.7.3 to
mozilla-1.7.6-1.2.5, now there's no need to hack prefcalls.js with "start_pos
+=1;", in fact if I continue with this hack I lose (as expected) the first
letter of the email address (fetch from ldap)  .

Thanks for the correction ! this bug is really  solve to me now :-)  .

By the way (out of subject !) ... is autoconfig still working with 
firefox/thunderbird (I desperatly hope so !) .

Note You need to log in before you can comment on or make changes to this bug.