Closed Bug 229271 Opened 21 years ago Closed 20 years ago

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

Categories

(Core :: Preferences: Backend, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jehan.procaccia, Assigned: timeless)

References

()

Details

(Keywords: fixed1.7.5)

Attachments

(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
http://www.int-evry.fr/mci/user/procacci/netscape/en/mozilla-autoconfig-en.html
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"@int-evry.fr>
So mail is rejected :-(
indeed in users prefs.js there's:
user_pref("mail.identity.id1.useremail", " Jehan.Procaccia@int-evry.fr");

Reproducible: Always

Steps to Reproduce:
1.use autoconfig with variables fetched from ldap, cf
http://www.int-evry.fr/mci/user/procacci/netscape/en/mozilla-autoconfig-en.html#htoc10
2.typical javascript code in my autoconfig file: var ldapmail = getLDAPValue (
values ,"mail" );
3.

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

Expected Results:  
not inserted the white space:
user_pref("mail.identity.id1.useremail", "Jehan.Procaccia@int-evry.fr");

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 
        start_pos +=1;
//end
        var end_pos = str.indexOf("\n", start_pos);
        if (end_pos == -1)
            end_pos = str.length;

        var attrib = str.substring(start_pos, end_pos);
        displayError("Jehan
getLDAPValue:\nattrib:"+attrib+"\nstart_pos:"+start_pos+"\nend_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 prefcalls.js.new
181a182
     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

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

sr=dmose
Attachment #152586 - Flags: superreview?(dmose) → superreview+
Status: UNCONFIRMED → NEW
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
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Any chance this will be fixed in 1.7.x?
Mats.Larsson@ericsson.com: 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+
mozilla/extensions/pref/autoconfig/src/nsLDAPSyncQuery.cpp 	1.7.2.1
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.

Attachment

General

Creator:
Created:
Updated:
Size: