Comment 70 for bug 233901

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

New problem :-(
Don't know if it's a bug or a misconfiguration ... however I use this "channel"
to join you all (let me know if there's a better place to post that).

I realized that my ldap based lockPref gets a white space in front of every
variables fetches from ldap. I didn't noticed that before because it doesn't
matter for standard smtp mail, however our mailling list server (sympa)
complains about a bad address when the email address contains a white space;
here's the symptoms:
Return-Path: <" <email address hidden>>
So mail is rejected :-(
indeed in users prefs.js there's:
user_pref("mail.identity.id1.useremail", " <email address hidden>");
                                          ^
Why I get this white space ?

Recall how I lock the useremail pref:

try {
// Get Shell env varirables
  var env_user = getenv("USER");
  var env_home = getenv("HOME");
  var env_mozdebug= getenv("MOZILLA_DEBUG");
// Call ldap
function processLDAPValues (values) {
    var ldapuid = getLDAPValue ( values ,"uid" );
    var ldapcn = getLDAPValue ( values ,"cn" );
    var ldapmail = getLDAPValue ( values ,"mail" );
//Debug for me ... (there was alert() before, not availaible anymore :-( )
if (env_mozdebug) {
        displayError("debug 1 mozilla.cfg v2.22", "\nmail:" + ldapmail +
"\nuid:" +ldapuid + "\ncn" +ldapcn + "\nuser:" + env_user );
        }
lockPref("mail.server.server1.name",mail);
lockPref("mail.identity.id1.fullName",cn);
defaultPref("mail.identity.id1.useremail",mail);

//Call to ldap to get user's attribute .
getLDAPAttributes ( "ldap2.int-evry.fr", "ou=people,dc=int-evry,dc=fr",
"uid="+env_user , "uid,cn,mail" );

The problem in that either mail, cn or uid, gets a white space in front ,
env_user which doesn't need the any of the getLDAP* function call works fine (no
white space)

How can I solve that ? search why a white space is added, or keep on with it and
find a javascript function that removes it , kind of chop() in perl, i don't
know javascript, I've also been told that all this autoconfig runs in a very
closed scope, not all of the javascript object/library is available :-(
How can I debug javascripts calls, variable better than using the displayError()
call ?

help would be grealty appreciated, I've hundreds of mozilla mail user autoconfig
running here ...

Thanks.