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

RESOLVED FIXED

Status

()

Core
Preferences: Backend
RESOLVED FIXED
14 years ago
12 years ago

People

(Reporter: Jehan Procaccia, Assigned: timeless)

Tracking

({fixed1.7.5})

Trunk
fixed1.7.5
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(URL)

Attachments

(1 attachment)

(Reporter)

Description

14 years ago
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);
    }
}

Comment 1

13 years ago
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;



(Assignee)

Comment 2

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

I can't see any reason for it.
(Assignee)

Comment 3

13 years ago
Created attachment 152586 [details] [diff] [review]
drop unwanted whitespace
(Assignee)

Updated

13 years ago
Attachment #152586 - Flags: superreview?(dmose)
Attachment #152586 - Flags: review?(alecf)
(Reporter)

Comment 4

13 years ago
Very good, I'am glad you finally corrected this bug .
However, in which release can I expect this patch beeing applied ?
Thanks .

Comment 5

13 years ago
Comment on attachment 152586 [details] [diff] [review]
drop unwanted whitespace

r=alecf
Attachment #152586 - Flags: review?(alecf) → review+

Comment 6

13 years ago
Comment on attachment 152586 [details] [diff] [review]
drop unwanted whitespace

sr=dmose
Attachment #152586 - Flags: superreview?(dmose) → superreview+

Updated

13 years ago
Status: UNCONFIRMED → NEW
Ever confirmed: true
Hardware: PC → All
(Assignee)

Updated

13 years ago
Attachment #152586 - Flags: approval1.8a2?
Attachment #152586 - Flags: approval1.7.1?

Comment 7

13 years ago
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)

Updated

13 years ago
Assignee: prefs → timeless
(Assignee)

Comment 8

13 years ago
mozilla/extensions/pref/autoconfig/src/nsLDAPSyncQuery.cpp 	1.11
Status: NEW → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → FIXED

Comment 9

13 years ago
Any chance this will be fixed in 1.7.x?
(Assignee)

Comment 10

13 years ago
Mats.Larsson@ericsson.com: given that it's sat here w/ the approval1.7.x? flag
for four months, i doubt it.

Comment 11

13 years ago
Comment on attachment 152586 [details] [diff] [review]
drop unwanted whitespace

Sorry about that.
Attachment #152586 - Flags: approval1.7.x? → approval1.7.x+
(Assignee)

Comment 12

13 years ago
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
(Reporter)

Comment 13

13 years ago
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.