Closed Bug 229271 Opened 18 years ago Closed 17 years ago

unwanted "white space" in function getLDAPValue from autoconfig/prefcalls.js


(Core :: Preferences: Backend, defect)

Not set





(Reporter: jehan.procaccia, Assigned: timeless)




(Keywords: fixed1.7.5)


(1 file)

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);
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;

attachment 57051 [details] [diff] [review] <bug 89137 comment 35> introduced the space.

I can't see any reason for it.
Attachment #152586 - Flags: superreview?(dmose)
Attachment #152586 - Flags: review?(alecf)
Very good, I'am glad you finally corrected this bug .
However, in which release can I expect this patch beeing applied ?
Thanks .
Comment on attachment 152586 [details] [diff] [review]
drop unwanted whitespace

Attachment #152586 - Flags: review?(alecf) → review+
Comment on attachment 152586 [details] [diff] [review]
drop unwanted whitespace

Attachment #152586 - Flags: superreview?(dmose) → superreview+
Ever confirmed: true
Hardware: PC → All
Attachment #152586 - Flags: approval1.8a2?
Attachment #152586 - Flags: approval1.7.1?
Comment on attachment 152586 [details] [diff] [review]
drop unwanted whitespace

a=asa (on behalf of drivers) for checkin to 1.8a2
Attachment #152586 - Flags: approval1.8a2? → approval1.8a2+
Assignee: prefs → timeless
mozilla/extensions/pref/autoconfig/src/nsLDAPSyncQuery.cpp 	1.11
Closed: 17 years ago
Resolution: --- → FIXED
Any chance this will be fixed in 1.7.x? given that it's sat here w/ the approval1.7.x? flag
for four months, i doubt it.
Comment on attachment 152586 [details] [diff] [review]
drop unwanted whitespace

Sorry about that.
Attachment #152586 - Flags: approval1.7.x? → approval1.7.x+
Keywords: fixed1.7.x
Summary: unwanted "white space" in function getLDAPValue fron autoconfig/prefcalls.js → unwanted "white space" in function getLDAPValue from autoconfig/prefcalls.js
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 !) .
You need to log in before you can comment on or make changes to this bug.