Closed Bug 534822 Opened 10 years ago Closed 10 years ago

Address books get added with no name if created via altering default preferences (e.g. extension/mcd)

Categories

(Thunderbird :: Address Book, defect, major)

defect
Not set
major

Tracking

(thunderbird3.1 beta2-fixed, thunderbird3.0 .5-fixed)

RESOLVED FIXED
Thunderbird 3.1b2
Tracking Status
thunderbird3.1 --- beta2-fixed
thunderbird3.0 --- .5-fixed

People

(Reporter: slavizh, Assigned: standard8)

References

Details

(Keywords: testcase)

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 (.NET CLR 3.5.30729)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091204 Thunderbird/3.0

I make one .js file in defaults\pref folder with the settings for LDAP. When I write new message I can get contacts from the LDAP server but when I go to Tools->Options->Composition->Addressing Directory server is checked but I don't see the name of my LDAP server. There is only blank space. I can select None or the blank space which is probably my settings but without name.
My settings are:
pref("ldap_2.autoComplete.directoryServer", "ldap_2.servers.ldap_ru_acad_bg");
pref("ldap_2.autoComplete.useDirectory", true);
pref("ldap_2.servers.ldap_ru_acad_bg.auth.dn", "");
pref("ldap_2.servers.ldap_ru_acad_bg.auth.saslmech", "");
pref("ldap_2.servers.ldap_ru_acad_bg.description", "Ruse University LDAP");
pref("ldap_2.servers.ldap_ru_acad_bg.filename", "ldap_ru_acad_bg.mab");
pref("ldap_2.servers.ldap_ru_acad_bg.maxHits", 100);
pref("ldap_2.servers.ldap_ru_acad_bg.replication.lastChangeNumber", 0);
pref("ldap_2.servers.ldap_ru_acad_bg.uri", "ldap://ldap.ru.acad.bg/ou=people,dc=ru,dc=acad,dc=bg??sub?(objectclass=inetorgperson)");

I've tried adding/removing some Ldap setting but the result is the same. I also tried putting these setting in user.js/pref.js files but the result is the same.
When I set Ldap trough the graphic interface there is no problem.

Reproducible: Always

Steps to Reproduce:
1.Set settings for LDAP trough pref.js for a profile
2. Start Thunderbird 3.0
3.Open Tools->Options->Composition->Addressing->Directory server is blank
4.Open Tools->Address Book  there is no LDAP configured to select to search
Actual Results:  
Directory server is blank
Address Book - there is no LDAP configured to select to search
When I write new e-mail I access LDAP contacts but there is no LDAP in address book

Expected Results:  
I should have LDAP configured with a name in Directory server but is blank
I should have LDAP configure in Address book but there isn't
Version: unspecified → 3.0
Component: General → Address Book
QA Contact: general → address-book
Bug 532170 is might be cause of this. There are problem with saving prefs with non-ASCII symbols which cause some settings don't work for example. Could be issue with reading prefs too.
Summary: When LDAP is set trough pref.js file it is not shown in the graphical interface → When LDAP is set through pref.js file it is not shown in the graphical interface
I tried saving the file with Notepad++ in different format (Windows/Unix). The problem doesn't disappear.
I'm not sure this is completely related to Bug 532170 but I did try one of the Thunderbird 3 Beta's Nikolay linked to on that Bug and this issue didn't occur.  So this is definitely something that was added after that.  It just won't use any of the default prefs for ldap.  If I set it manually in the app it works fine, if I then take those settings out of the prefs.js and put them into the defaultpref's file I have it still won't use them/import them.  But it works ok in that older beta.  I'll wait and see if there is a bug fix for this as I don't want to walk a 1000+ user's through setting up there LDAP settings.  :)
Following is all LDAP related entries created by Tb3.0(official release).
  LLLLLL : created via UI
  MMMMMM : I added to prefs.js manually. => appeared in UI normally.
  NNNNNN : created via UI, with name=NNN/NNN
> user_pref("ldap_2.servers.LLLLLL.auth.dn", "");
> user_pref("ldap_2.servers.LLLLLL.auth.saslmech", "");
> user_pref("ldap_2.servers.LLLLLL.description", "LLL LLL");
> user_pref("ldap_2.servers.LLLLLL.filename", "ldap.mab");
> user_pref("ldap_2.servers.LLLLLL.maxHits", 100);
> user_pref("ldap_2.servers.LLLLLL.uri", "ldap://abc.def.ghi/??sub?(objectclass=*)");
> user_pref("ldap_2.servers.MMMMMM.auth.dn", "");
> user_pref("ldap_2.servers.MMMMMM.auth.saslmech", "");
> user_pref("ldap_2.servers.MMMMMM.description", "MMM MMM");
> user_pref("ldap_2.servers.MMMMMM.filename", "ldap-2.mab");
> user_pref("ldap_2.servers.MMMMMM.maxHits", 100);
> user_pref("ldap_2.servers.MMMMMM.uri", "ldap://jkl.mno.pqr/??sub?(objectclass=*)");
> user_pref("ldap_2.servers.NNNNNN.auth.dn", "");
> user_pref("ldap_2.servers.NNNNNN.auth.saslmech", "");
> user_pref("ldap_2.servers.NNNNNN.description", "NNN/NNN");
> user_pref("ldap_2.servers.NNNNNN.filename", "ldap-1.mab");
> user_pref("ldap_2.servers.NNNNNN.maxHits", 100);
> user_pref("ldap_2.servers.NNNNNN.uri", "ldap://nnn.nnn.nnn/??sub?(objectclass=*)");

Tb3 removed "/" from prefs.js entry name, instead of replace it by "_".

> pref("ldap_2.servers.ldap_ru_acad_bg.filename", "ldap_ru_acad_bg.mab");

Did your Tb3.0(official release) generate it when you created via UI with name=ldap_ru_acad_bg(string put in ....description)?
Does next work?
> pref("ldap_2.servers.ldapruacadbg.description", "ldap_ru_acad_bg");
> pref("ldap_2.servers.ldapruacadbg.filename", "ldap_ru_acad_bg.mab");
If I set Ldap trough UI everything is ok. If I set trough a settings file the ldap is working when I write letter but in the address book doesn't appear. In the setting menu (UI) I see blank space. And yes I am with TB3 final. I tried adding removing some options for Ldap but the result is the same.
Ok. When the settings are in pref.js there is no problem, seems everything is ok. But when I put the setting in defaults\pref (Thunderbird install directory) folder in a file called for example ldap.js the problem occur. I think the problems also occur when the settings are in user.js file in profile folder.
I'm guessing thunderbird is using the same calls/methods but my issue is when the settings are in a configuration file that I specify with pref("general.config.filename","tbirdadm.cfg"); in the all.js file found in greprefs
Lou: I think your issue is something very different to this.

Stanislav: When you set up your prefs in a way that doesn't show the LDAP directory, have you verified that going to Tools -> Options -> Advanced -> General -> Config Editor lists all the preferences you have added with the correct values?
Yes other setting seems are added  correctly. I think the problem is in  ldap_2.servers.NNNNNN.description  may be doesn't parse the name of the server correctly. When I write letters i get e-mails from Ldap server but it doesn't appear in address book. I don't know how exactly works Thunderbird, but may be is something in the way thunderbird reads setting. And the problem is in files that can only be read (defaults/pref  and  user.js) when the file is pref.js (UI writes and reads this file).
Mark: It may be a separate bug but its behaving the similiarly.  The only difference for my issue is the settings are loading from a settings file specified in all.js rather then a prefs.js file in defaults.  I would think it would load them the same way but I could be wrong.  I checked the config editor and it shows it has the settings from my tbirdadm.cfg file.  I did notice a few more interestings things though:
1) If just the ldap_2.servers.NAME.description is in either the prefs.js or user.js in the user profile then everything behaves normally.  It will show up in the tbird options and recognize all the settings I have in my tbirdadm.cfg file.
2) And here is a cute one.  If I write a new email and type a name in the address field. . it will pull the info from my LDAP even though its not listed in the tbird options menu (just blank and none like Stanislav).  If I click on Addressbook it doesn't show the LDAP server on the left nor will it find email addresses from it.
Manual creation of ldap_2.servers... in prefs. won't invoke file creation. 
> user_pref("ldap_2.servers.MMMMMM.filename", "ldap-2.mab"); (same name as Tb uses)
> ldap-2.mab doesn't exist, because I didn't create it.
When ldap.mab/ldap-1.mab exists, if other LDAP server was defined via UI, Tb created file of ldap-2.mab, and generated ldap_2.servers.PPPP.filename = ldap-2.mab even though MMMMMM.filename = ldap-2.mab exists. 
In this case, both MMMMMM and PPPP use same ldap-2.mab.

Did you create file you specified in xxxx.filename?
Is there any double-booking of file name?
Sorry for the delayed response, Christmas vacation :)  The config file I have worked fine for TB2 and not for TB3 so something definitely changed between them.  I did however just test what you said by putting the mab file I specify for ldap into the c:\program files\mozilla thunderbird\defaults\profile.  It copies that file to the user profile fine but again the LDAP isn't showing up.
(In reply to comment #6)
> But when I put the setting in defaults\pref (Thunderbird install directory)
> folder in a file called for example ldap.js the problem occur.
(In reply to comment #12)
> putting the mab file I specify for ldap into the c:\program files\mozilla thunderbird\defaults\profile.

Files you copied are copied to profile directory by Tb only when profile creation. Are you testing with newly created profile?

(In reply to comment #6)
> I think the problems also occur when the settings are in user.js file in profile folder.

Really problem occurred with user.js?

> The config file I have worked fine for TB2 and not for TB3 (snip)

Do you use add-on relates to address book or LDAP?
Does your problem of Tb3 occur with newly created profile?
>Files you copied are copied to profile directory by Tb only when profile
>creation. Are you testing with newly created profile?
New, old I tested it the result is the same? I think I explained everything and when exactly the problem occurs.
>Really problem occurred with user.js?
Yes problem occurs with user.js, but doesn't occur with occur with pref.js maybe because UI writes directly in pref.js, but I can't write in pref.js it only reads form this file.
>Do you use add-on relates to address book or LDAP?
>Does your problem of Tb3 occur with newly created profile?
I only have quick locale switcher plugin

Does anybody tried to recreate the bug? Is the situation the same to him?
(In reply to comment #13)
> Files you copied are copied to profile directory by Tb only when profile
> creation. Are you testing with newly created profile?

Yes I'm working with a fresh profile everytime.  I delete the profile inbetween changes.  In fact I'm even reverting to before I installed thunderbird sometimes (older snapshot on a virtual machine).

Ok I started from scratch again and tested a few things since my problem and the original one stated are a little different.  Also I'm running no addons:
1) Fresh Tbird 3.0 with settings in prefs.js under defaults/profile
2) Fresh Tbird 3.0 with settings in user.js under defaults/profile
3) Fresh Tbird 3.0 with settings in a configuration file specified in all.js

Test 1 worked, Test 2 worked, Test 3 (which is what we use) does not.  The reason we use method 3 is because we can set everything in it.  Using prefs.js and user.js in the defaults/profile won't let me set all the settings needed (account specific settings mainly).  We want it so user's starting tbird for the first time just launch it and everything is set except password (account info, name, ldap, etc).  I guess I can split out the ldap settings and put those in the user.js and push that out to all our machines but that gets hairy when profile directories aren't what I expect them to be.
You can force same profile name, same pofile directory location by distribution of profiles.ini, if file of profiles.ini can be located at shared drive and you can request users to copy file and to create directory for profile(BAT/script can be used) upon first use of Tb.
(Win example)
   profiles.ini location == %APPDATA%\Thunderbird\profiles.ini
   profiles.ini :
     [General]
     StartWithLastProfile=0 (or 1, if want to use profile of Default=1 always)
     [Profile0]
     Name=Required-Name
     Default=1
     IsRelative=1
     Path=Profiles/abc.xyz <== required directory name
     or
     Path=My-Profiles/My-Sub-Dir/abc.xyz
     or
     Path=../My-Thunderbird/My-Profiles/abc.xyz
    (different location from %APPDATA%)
     IsRelative=0
     Path=C:\\abc\\def\\ghi\\...
     or
     IsRelative=1
     Path=../../My-App-Data/My-Thunderbird/Profiles/abc.xyz
          Note: Tb changes it to absolute format automatically.
If such request to user is possible, prefs.js, users.js, file for LDAP can be distributed too. Common account definition is aslo distrubuted, if difference is user-id, mail-addr and password only.
  - Request user to enter user-id and/or mail-addr upon BAT execution
  - Request user to change account settings for user-id and mail-addr
If common account definitions is held in user.js, it can be a kind of prefs.js backup in case of lost prefs.js(frequency was reduced very much, but problem still remains).

Note: If many kinds of Linux distro are used, you should be careful, because profiles.ini location depends on distro and Tb version.
(In reply to comment #15)
> 1) Fresh Tbird 3.0 with settings in prefs.js under defaults/profile
> 2) Fresh Tbird 3.0 with settings in user.js under defaults/profile
> 3) Fresh Tbird 3.0 with settings in a configuration file specified in all.js
> Test 1 worked, Test 2 worked, Test 3 (which is what we use) does not.

If so, bug summary is apparently invalid. I recommend you to open new bug for problem on "configuration file in all.js", in order to avoid confusion.

FYI.
Following is a doument of MozDev.
> https://developer.mozilla.org/En/Automatic_Mozilla_Configurator/Locked_config_settings 
> Locked config settings
> Putting into place locked configuration settings
>
> This feature exists for Mozilla and Firefox, but not for Thunderbird
> Locked settings can be put into a mozilla.cfg file in the C:\Program Files\mozilla.org\Mozilla directory.
> ( Page last modified 11:58, 4 Jul 2008 )
(In reply to comment #15)
> 3) Fresh Tbird 3.0 with settings in a configuration file specified in all.js

What are you adding to all.js to try and make this work?
Ok I do think this is a separate issue so I'm going to look at making it a separate bug.  And I have it setup pretty much like it is in WADA's link.  But that link does say it doesn't work for thunderbird but it has worked fine up to 3.0 and it still works for 3.0, just not the LDAP settings.  Strange.  Anyway thanks everyone for all your help!
This bug is still not resolved in TB 3.0.2 . I think this is a serious bug for those who use tb in organizations with many users.
Want to upgrade thunderbird from 2.0.0.x to 3.0.x in my company (+95 000 users).
I use XPI and .js in defaults/preferences to configure several LDAP.
It works fine with thunderbird 2 but nothing appear in 3.x (try with the last one 3.0.4).
Hope this major bug will correct soon.
(In reply to comment #21)
> Want to upgrade thunderbird from 2.0.0.x to 3.0.x in my company (+95 000
> users).
> I use XPI and .js in defaults/preferences to configure several LDAP.
> It works fine with thunderbird 2 but nothing appear in 3.x (try with the last
> one 3.0.4).
> Hope this major bug will correct soon.

Unfortunately there are no clear, consistent steps for the developers to reproduce this issue and attempt to fix it. If you can specify exactly how your installations are set up with which preferences where, then we may be able to help resolve your issue.

Until we can get clear steps to repeat though, there's not much we can do.
Reproducing is simple. I can send you archived TB3 you can start it from a read only share, may be u just have to change the settings for ldap in the file. It is simple as that.
Attached file test case
You can try this. It works fine with TB 2 not with TB 3
Keywords: testcase
Duplicate of this bug: 538425
Attached patch The fixSplinter Review
In TB 2 we used to have a bit of code to get localised preference values for the description only if the address book was a built-in address book. For other Abs, we'd just get the string preference value.

The issue with getting localised prefs, is that if there's only a default value, it has to be set to a chrome:// value, otherwise the function fails. If the pref is locked or has a user-set value, then its value can be any string.

Due to the fallback we had in TB 2 and the fact that the GetLocalizedPrefValue function doesn't return consistent error codes from call to call, the only sensible way I've found of fixing this is to implement a fallback to get the string pref if the description is found as being empty. This, in theory, should never happen in the normal case, and even if the preference is empty, getting an empty string pref again shouldn't make any difference.

Included is a unit test which will protect against regressions.
Assignee: nobody → bugzilla
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #438510 - Flags: superreview?(bienvenu)
Attachment #438510 - Flags: review?(bienvenu)
Attachment #438510 - Flags: superreview?(bienvenu)
Attachment #438510 - Flags: superreview+
Attachment #438510 - Flags: review?(bienvenu)
Attachment #438510 - Flags: review+
Checked in: http://hg.mozilla.org/comm-central/rev/598c45ea36a0

It missed today's 3.2a1pre and 3.1b2pre nightlies, but it'll be in tomorrow's. Hence it will be in 3.1b2 when that is released in a few weeks.

I'll also consider this for the next 3.0.x release as I think its a reasonably safe fix as it is dealing with fall-back cases.
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Summary: When LDAP is set through pref.js file it is not shown in the graphical interface → Address books get added with no name if created via altering default preferences (e.g. extension/mcd)
Target Milestone: --- → Thunderbird 3.1b2
Attachment #438510 - Flags: approval-thunderbird3.0.5?
Thanks for that...
Attachment #438510 - Flags: approval-thunderbird3.0.5? → approval-thunderbird3.0.5+
You need to log in before you can comment on or make changes to this bug.