Last Comment Bug 317566 - Using global LDAP server prefs for autocomplete lookup does not always work correctly
: Using global LDAP server prefs for autocomplete lookup does not always work c...
Status: RESOLVED FIXED
: fixed-seamonkey1.1a, fixed1.8.1
Product: MailNews Core
Classification: Components
Component: Address Book (show other bugs)
: Trunk
: All All
: -- normal with 2 votes (vote)
: ---
Assigned To: Mark Banner (:standard8, limited time in Dec)
:
:
Mentors:
: 299968 316766 323655 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-11-23 06:14 PST by Andreas Höfler
Modified: 2008-07-31 04:30 PDT (History)
11 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
The fix (2.82 KB, patch)
2005-12-03 04:15 PST, Mark Banner (:standard8, limited time in Dec)
neil: review-
mozilla: superreview+
Details | Diff | Splinter Review
Revised patch (3.64 KB, patch)
2005-12-15 12:05 PST, Mark Banner (:standard8, limited time in Dec)
mozilla: superreview+
Details | Diff | Splinter Review
Patch v3 (8.11 KB, patch)
2006-01-07 13:54 PST, Mark Banner (:standard8, limited time in Dec)
neil: review-
Details | Diff | Splinter Review
Patch v4 (8.25 KB, patch)
2006-01-08 04:20 PST, Mark Banner (:standard8, limited time in Dec)
neil: review+
Details | Diff | Splinter Review
Patch v5 (checked in to trunk and branch) (13.13 KB, patch)
2006-01-12 14:32 PST, Mark Banner (:standard8, limited time in Dec)
standard8: review+
mozilla: superreview+
mscott: approval‑branch‑1.8.1+
Details | Diff | Splinter Review

Description Andreas Höfler 2005-11-23 06:14:32 PST
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.
Comment 1 Ray Booysen 2005-11-23 06:36:48 PST
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.
Comment 2 Andreas Höfler 2005-11-23 06:44:39 PST
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)
Comment 3 Ray Booysen 2005-11-23 07:09:19 PST
Confirming.  I see this behaviour in Windows XP
version 1.6a1 (20051122)
Comment 4 Dan Mosedale (:dmose) 2005-11-23 13:18:44 PST
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.
Comment 5 Andreas Höfler 2005-11-24 00:30:33 PST
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.
Comment 6 Pawel Barut 2005-11-29 07:41:33 PST
I 've the same problem as descibed by Andreas.
Thunderbird version 1.5 RC1 (20051025)
Comment 7 Mark Banner (:standard8, limited time in Dec) 2005-12-01 14:45:32 PST
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).
Comment 8 Pawel Barut 2005-12-02 05:15:59 PST
(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);

Comment 9 Andreas Höfler 2005-12-02 05:31:45 PST
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.
Comment 10 Pawel Barut 2005-12-02 06:23:31 PST
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.
Comment 11 Mark Banner (:standard8, limited time in Dec) 2005-12-03 03:56:31 PST
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...
Comment 12 Mark Banner (:standard8, limited time in Dec) 2005-12-03 04:15:17 PST
Created attachment 204869 [details] [diff] [review]
The fix

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.
Comment 13 David :Bienvenu 2005-12-03 12:09:32 PST
Comment on attachment 204869 [details] [diff] [review]
The fix

ok by me...
Comment 14 neil@parkwaycc.co.uk 2005-12-04 16:15:12 PST
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).
Comment 15 George Hyman 2005-12-05 17:48:24 PST
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.
Comment 16 Mark Banner (:standard8, limited time in Dec) 2005-12-06 08:42:21 PST
(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.
Comment 17 Daniel Veditz [:dveditz] 2005-12-14 01:51:50 PST
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.
Comment 18 Mark Banner (:standard8, limited time in Dec) 2005-12-14 02:06:13 PST
(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.
Comment 19 Mark Banner (:standard8, limited time in Dec) 2005-12-15 12:05:05 PST
Created attachment 205993 [details] [diff] [review]
Revised patch

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.
Comment 20 Mark Banner (:standard8, limited time in Dec) 2005-12-19 13:58:38 PST
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
Comment 21 Mark Banner (:standard8, limited time in Dec) 2005-12-21 11:11:39 PST
*** Bug 299968 has been marked as a duplicate of this bug. ***
Comment 22 Mark Banner (:standard8, limited time in Dec) 2005-12-26 14:12:30 PST
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.
Comment 23 Mark Banner (:standard8, limited time in Dec) 2005-12-30 01:21:35 PST
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
Comment 24 bugzilla 2006-01-06 13:39:49 PST
*** Bug 316766 has been marked as a duplicate of this bug. ***
Comment 25 George Hyman 2006-01-06 14:29:12 PST
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 :)
Comment 26 Mark Banner (:standard8, limited time in Dec) 2006-01-07 13:54:19 PST
Created attachment 207846 [details] [diff] [review]
Patch v3

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.
Comment 27 neil@parkwaycc.co.uk 2006-01-07 16:36:37 PST
Comment on attachment 207846 [details] [diff] [review]
Patch v3

Preferences/Addressing
Create two LDAP entries
Select the second entry
Delete it
Result: disabled menulist :-(
Comment 28 Mark Banner (:standard8, limited time in Dec) 2006-01-08 04:20:31 PST
Created attachment 207890 [details] [diff] [review]
Patch v4

Good catch Neil, this version checks how many directories there are before disabling the menu.
Comment 29 neil@parkwaycc.co.uk 2006-01-08 08:49:19 PST
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.
Comment 30 Mark Banner (:standard8, limited time in Dec) 2006-01-12 14:32:45 PST
Created attachment 208307 [details] [diff] [review]
Patch v5 (checked in to trunk and branch)

Update patch to address Neil's comment and remove gFromGlobalPref. Carrying forward his r.
Comment 31 Mark Banner (:standard8, limited time in Dec) 2006-01-21 03:00:21 PST
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.
Comment 32 Mark Banner (:standard8, limited time in Dec) 2006-01-21 03:01:24 PST
Fix is in on trunk -> Fixed. I'll check into the 1.8.1 branch when the patch eventually gets approved.
Comment 33 Mark Banner (:standard8, limited time in Dec) 2008-03-27 13:19:19 PDT
*** Bug 299968 has been marked as a duplicate of this bug. ***
Comment 34 Mark Banner (:standard8, limited time in Dec) 2008-06-11 04:16:23 PDT
*** Bug 323655 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.