Closed Bug 317566 Opened 19 years ago Closed 18 years ago

Using global LDAP server prefs for autocomplete lookup does not always work correctly

Categories

(MailNews Core :: Address Book, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: andreas.hoefler, Assigned: standard8)

References

Details

(Keywords: fixed-seamonkey1.1a, fixed1.8.1)

Attachments

(1 file, 4 obsolete files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8) Gecko/20051111 Firefox/1.5
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8) Gecko/20051111 Firefox/1.5

I created a LDAP Directory entry in Address Book and set it to be used in
Options->Composition->Addressing->Directory Server

Then I created a new account and made sure that
Account Settings->Composition & Addressing->Use my global LDAP server preferences for this account
was checked.

When trying to let TB autocomplete an address when writing a new mail, it was not found.

Then I choosed 
Account Settings->Composition & Addressing->Use a different LDAP server
and selected the one created in Address Book.

Trying again to let TB autocomplete an incomplete address in the compose window works now.

Reproducible: Always

Steps to Reproduce:
1. Create a LDAP directory in Address Book
2. Set global settings to include LDAP server in autocomplete search
3. Try to let Thunderbird autocomplete an address in the compose-window

Actual Results:  
Autocompletion does not work.

Expected Results:  
Address should be auto-completed.

Thunderbird version 1.5 Beta 2 (20051006), Mail Account lying on Exchange Server and is accessed through IMAP.
Reporter, can you confirm your LDAP settings?  Remember ActiveDirectory works on a different port.

But I am also having difficulties connecting to my active directory.
Hardware: PC → All
I did not change the LDAP settings during the procedure, so I doubt to be the error hidden there somewhere.

I created the Address Book entry with:
Port Number: 3268
Base DN: CN=Users,DC=my,DC=company,DC=example
Search Filter: (objectclass=user)
Confirming.  I see this behaviour in Windows XP
version 1.6a1 (20051122)
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Windows 2000 → All
Version: unspecified → Trunk
Summary: Using globlal LDAP server prefs for account does not work with ActiveDirectory → Using global LDAP server prefs for account does not work with Active Directory
IIRC, ActiveDirectory doesn't include inetOrgPerson by default, and many of the fields that TB looks for by default are based on that.  You might try installing the inetOrgPerson piece on the server, and, failing that, it would be interesting to see a packet trace from Ethereal.
Dan, I don't that my problems are originated in a communication problem with Active Directory but rather Thunderbird not using the global settings when told to do so.

As you can see in the initial report, autocompletion DOES work for me, but only if I turn it on explicitely on the account preferences. If I leave the settings to use the global settings, where the LDAP server is configured correctly, autocompletion seems to not query LDAP at all. The half-completed address turns red too fast for my taste, but this could be wrong as I'm not allowed to install a packet tracer on this computer.
I 've the same problem as descibed by Andreas.
Thunderbird version 1.5 RC1 (20051025)
In debugging this, it would be useful to know if the value of the pref ldap_2.autoComplete.directoryServer is blank (default) or filled in.

Also, how many ldap servers have you set up? (I'm guessing just one).
(In reply to comment #7)
I've only one ldap server configured.

in prefs.js:
ldap_2.autoComplete.directoryServer is not set at all
but on screen there is one, that is configured

for autoComplete in prefs.js is just:
user_pref("ldap_2.autoComplete.useDirectory", true);

I have only one set up too.

But at the moment I'm unable to reproduce my initial problem (altough I did the same procedure before).

When I re-set the account setting to use the global settings I cannot make the bug re-appear and NOT perform auto-completion... strange.
My configuration of Thunderbird is migrated from mozilla rv:1.8a5 Gecko/20041122.
After migration ldap_2.autoComplete.directoryServer is not set at all.

When You go to Options/Composition/Adressing and do:
1. Click on dropdown 'Directory Server'
2. choose Server from list (only one position in my case)
3. Clik OK
then ldap_2.autoComplete.directoryServer is to proper value and autocompletion using global LDAP works.
Ok, I'm seeing this as well on SeaMonkey. if ldap_2.autoComplete.directoryServer isn't set auto complete doesn't work (unfortunately it can be a right pain to get it to set in new profiles as well). Moving to core/address book as its a better location for this bug.

Patch coming up in a while hopefully...
Assignee: mscott → bugzilla
Component: Preferences → MailNews: Address Book
Product: Thunderbird → Core
QA Contact: preferences → addressbook
Attached patch The fix (obsolete) — Splinter Review
This patch fixes the problem by forcing setting of the pref when it isn't set previously and there is more than one item in the ldap list. Its not necessarily ideal as preferably there should be proper setting from the menu popup - but as I'm also currently working on revising the whole ldap autocomplete menus & backend code elsewhere, it should do as an intermediate fix.
Attachment #204869 - Flags: superreview?(bienvenu)
Attachment #204869 - Flags: review?(neil.parkwaycc.co.uk)
Comment on attachment 204869 [details] [diff] [review]
The fix

ok by me...
Attachment #204869 - Flags: superreview?(bienvenu) → superreview+
Comment on attachment 204869 [details] [diff] [review]
The fix

>-        if (!directoriesList.selectedItem)
>-          directoriesList.value = "";
This bit is necessary if all else fails, e.g. in the case of deleting the last directory.

>+        if (directoriesList.selectedIndex == -1 &&
Prefer !directoriesList.selectedItem (selectedIndex has to trawl through the childNodes looking for the item).

>+            gAvailDirectories.length >= 1 &&
Nit: != 0

>+            !gPrefInt.prefIsLocked("ldap_2.autoComplete.directoryServer"))
Nit: pref_string_title has this value (oddly, if the declaration was moved up a bit then it could get reused a third time).
Attachment #204869 - Flags: review?(neil.parkwaycc.co.uk) → review-
How can I determine which nightly build to download to test this fix?  I have to admit I'm new to the mozilla processes, so I apologize if this is a FAQ.
(In reply to comment #15)
> How can I determine which nightly build to download to test this fix?  I have
> to admit I'm new to the mozilla processes, so I apologize if this is a FAQ.
> 

There is no point at the moment, the patch hasn't been granted review & hasn't been checked in (a note will be added when it is - or it'll be marked fixed). When it has been fixed/checked in wait a day or so & pick up the latest nightly.
I'm seeing this problem also and there are scattered dupes going back, some of which get closed WFM. Bug 312115 is one example. LDAP works if I choose a server in a particular account's addressing prefs, but not if I set that account to use the global option.

Where is the global option set? I've been assuming the addressing sub-tab of the composition tab on the Global options dialog. "When addressing messages, look for matching entries in:" and I have both Local Address Books and Directory Server checked, and the directory server is set to the same entry that works if I explicitly select it in each Account.
(In reply to comment #17)
> Where is the global option set? I've been assuming the addressing sub-tab of
> the composition tab on the Global options dialog. "When addressing messages,
> look for matching entries in:" and I have both Local Address Books and
> Directory Server checked, and the directory server is set to the same entry
> that works if I explicitly select it in each Account.

That is correct - sometimes, especially with just one ldap server setup, although the global options dialog displays the address book, the pref is actually "", and may never get set correctly. If you play around a bit you can sometimes get it to work (especially with > 1 ldap address book) and thats probably why the bugs have been marked as WFM.
Attached patch Revised patch (obsolete) — Splinter Review
This is a revised version. After looking at Neil's comments from the previous patch I realised that the case where you add a ldap directory via edit directories wasn't working correctly, so I looked at fixing that as well.

As it turns out the easiest way of fixing this in the short term (still bearing in mind I want to rewrite a lot of the backend for ldap prefs) is to add the "None" option that is currently in the Mail/Newsgroup account settings autocomplete override preferences to the global preference dialog as well. This simplifies the code a bit as well.
Attachment #204869 - Attachment is obsolete: true
Attachment #205993 - Flags: superreview?(bienvenu)
Attachment #205993 - Flags: review?(neil.parkwaycc.co.uk)
Changing summary to better reflect the problem

was: Using global LDAP server prefs for account does not work with Active Directory

now: Using global LDAP server prefs for autocomplete lookup does not always work correctly
Summary: Using global LDAP server prefs for account does not work with Active Directory → Using global LDAP server prefs for autocomplete lookup does not always work correctly
Attachment #205993 - Flags: superreview?(bienvenu) → superreview+
*** Bug 299968 has been marked as a duplicate of this bug. ***
Comment on attachment 205993 [details] [diff] [review]
Revised patch

The patch is still ok, but I just realised that thunderbird uses this code as well.
Attachment #205993 - Attachment description: Revised patch (SeaMonkey verison) → Revised patch
Comment on attachment 205993 [details] [diff] [review]
Revised patch

Cancelling review request for the time being, I want to come up with a full patch for both SeaMonkey & Thunderbird
Attachment #205993 - Flags: review?(neil.parkwaycc.co.uk)
*** Bug 316766 has been marked as a duplicate of this bug. ***
Interestingly enough, my global ldap server has started working properly in the last week or so.  I'm running 1.5 build 20051201, and haven't upgraded in 3-4 weeks, so this is something of a mystery, but I'm a happy user :)
Attached patch Patch v3 (obsolete) — Splinter Review
Revised patch for both SeaMonkey & Thunderbird, same principles as before, but I've also removed the gRefresh check which will mean we always ensure a selection even in the worst cases.
Attachment #205993 - Attachment is obsolete: true
Attachment #207846 - Flags: review?(neil.parkwaycc.co.uk)
Comment on attachment 207846 [details] [diff] [review]
Patch v3

Preferences/Addressing
Create two LDAP entries
Select the second entry
Delete it
Result: disabled menulist :-(
Attachment #207846 - Flags: review?(neil.parkwaycc.co.uk) → review-
Attached patch Patch v4 (obsolete) — Splinter Review
Good catch Neil, this version checks how many directories there are before disabling the menu.
Attachment #207846 - Attachment is obsolete: true
Attachment #207890 - Flags: review?(neil.parkwaycc.co.uk)
Comment on attachment 207890 [details] [diff] [review]
Patch v4

Actually, I no longer see why it's necessary to disable the menulist (except via normal pref locking), so we could elimintate gFromGlobalPref.
Attachment #207890 - Flags: review?(neil.parkwaycc.co.uk) → review+
Update patch to address Neil's comment and remove gFromGlobalPref. Carrying forward his r.
Attachment #208307 - Flags: superreview?(bienvenu)
Attachment #208307 - Flags: review+
Attachment #208307 - Flags: superreview?(bienvenu) → superreview+
Attachment #207890 - Attachment is obsolete: true
Comment on attachment 208307 [details] [diff] [review]
Patch v5 (checked in to trunk and branch)

Patch checked in to trunk.

Requesting approval for 1.8.1 branch. This is a Thunderbird and SeaMonkey patch that corrects a problem with preferences where we indicate that the user has selected a directory for use in autocomplete, but the preference hasn't actually been set.
Attachment #208307 - Attachment description: Patch v5 → Patch v5 (checked in to trunk)
Attachment #208307 - Flags: approval1.8.1?
Fix is in on trunk -> Fixed. I'll check into the 1.8.1 branch when the patch eventually gets approved.
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Attachment #208307 - Flags: approval1.8.1? → branch-1.8.1?(mscott)
Attachment #208307 - Flags: approval-branch-1.8.1?(mscott) → approval-branch-1.8.1+
Attachment #208307 - Attachment description: Patch v5 (checked in to trunk) → Patch v5 (checked in to trunk and branch)
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.