Comment 71 for bug 233901

Revision history for this message
In , Jehan-procaccia (jehan-procaccia) wrote :

OK, found a workaround, not clean but working, I added the following line to
/usr/lib/mozilla-1.4.1/defaults/autoconfig/prefcalls.js in the getLDAPValue
function:

start_pos +=1;

so now it removes the preblematic "white space" in front of my ldap fetched
variables.

Here's the whole function debuged by me using displayError function (don't know
a better way to debug :-( )

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

Is this a bug ? let me know ...