Closed Bug 1574712 Opened 5 years ago Closed 5 years ago

LDAP lookup during address autocomplete not working (TB 68) - 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIAbDirectoryQuery.doQuery] nsAbLDAPAutoCompleteSearch.js:261

Categories

(MailNews Core :: LDAP Integration, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 70.0

People

(Reporter: jorgk-bmo, Assigned: aleca)

References

(Regression)

Details

(Keywords: regression)

Preparation:
Configure an LDAP server:
Options, Composition, Addressing:
Click "Directory Server", Edit Directories, and Add "Adams":
Name: Adams, Hostname: ldap.adams.edu, Base DN: ou=people,dc=adams,dc=edu
One can now go to the address book, click on Adams on the left, and search for Alvarez. "Alvarez, Leslie" comes up. Close the address book.

STR:
Open a Write window. Enter Alvarez as address. It's not found. On the error console we get:
NS_ERROR_ILLEGAL_VALUE: Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIAbDirectoryQuery.doQuery] nsAbLDAPAutoCompleteSearch.js:261

I asked Alice to look at it and Alice reported it working on TB 68 and TB 70. But we had a prior report in bug 1574248 comment #4.

Fails for me on TB 68 and 69. I'll try a new profile.

Thank you so much, Alice!!

Alex, looks like you broke this, too :-(

We can't ship TB 68 with this regression since enterprise users are using LDAP. Not being able to enter recipients from a corporate address book is a killer.

Flags: needinfo?(alessandro)
Regressed by: 1542711
Summary: LDAP lookup during address autocomplete not working (TB 68) → LDAP lookup during address autocomplete not working (TB 68) - 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIAbDirectoryQuery.doQuery] nsAbLDAPAutoCompleteSearch.js:261

It works again in Tb70.0a1, if about:config manually set
ldap_2.autoComplete.directoryServer = "ldap_2.servers.Adams"
instead of
ldap_2.autoComplete.directoryServer = "moz-abldapdirectory://ldap_2.servers.Adams"

So I suppose the part that is not working is that if you edit/add a new directory, the saved pref is wrong?
Looking at the changes and existing code, perhaps related to "dirPrefId"? But couldn't see how, and perhaps value="dirPrefId" is dead code?

After add LDAP server and select "Adams" in the dropdown of "Directory Server:".
DOM and prefs.js comparison before and after Bug 1534913.


Before Bug 1534913:
<menulist xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="directoriesList" flex="1" aria-labelledby="autocompleteLDAP" preference="ldap_2.autoComplete.directoryServer" value="ldap_2.servers.Adams" label="Adams">
  <hbox class="menulist-label-box" flex="1" role="none">
    <image class="menulist-icon" role="none"/>
    <label class="menulist-label" crop="right" flex="1" role="none" value="Adams"/>
    <label class="menulist-highlightable-label" crop="right" flex="1" role="none">Adams</label>
  </hbox>
  <dropmarker class="menulist-dropmarker" type="menu" role="none"><image class="dropmarker-icon"/></dropmarker>
  <menupopup id="directoriesListPopup" class="addrbooksPopup" none="None" remoteonly="true" value="dirPrefId" hasbeenopened="true">
    <menuitem label="None" value="" class="menuitem-iconic abMenuItem" IsNone="true"/>
    <menuitem label="Adams" value="ldap_2.servers.Adams" class="menuitem-iconic abMenuItem" AddrBook="true" IsRemote="true" selected="true"/>
  </menupopup>
</menulist>

user_pref("ldap_2.autoComplete.directoryServer", "ldap_2.servers.Adams");
user_pref("ldap_2.autoComplete.useDirectory", true);
user_pref("ldap_2.servers.Adams.auth.dn", "");
user_pref("ldap_2.servers.Adams.auth.saslmech", "");
user_pref("ldap_2.servers.Adams.description", "Adams");
user_pref("ldap_2.servers.Adams.filename", "ldap.mab");
user_pref("ldap_2.servers.Adams.maxHits", 100);
user_pref("ldap_2.servers.Adams.uri", "ldap://ldap.adams.edu/ou=people,dc=adams,dc=edu??sub?(objectclass=*)");



After  Bug 1534913:
<menulist xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" is="menulist-addrbooks" id="directoriesList" aria-labelledby="autocompleteLDAP" preference="ldap_2.autoComplete.directoryServer" none="None" remoteonly="true" flex="1" value="moz-abldapdirectory://ldap_2.servers.Adams" label="Adams">
  <hbox class="menulist-label-box" flex="1" role="none">
    <image class="menulist-icon" role="none"/>
    <label class="menulist-label" crop="right" flex="1" role="none" value="Adams"/>
    <label class="menulist-highlightable-label" crop="right" flex="1" role="none">Adams</label>
  </hbox>
  <dropmarker class="menulist-dropmarker" type="menu" role="none">
    <image class="dropmarker-icon"/>
  </dropmarker>
  <menupopup hasbeenopened="true">
    <menuitem label="None" value="" class="menuitem-iconic abMenuItem" IsNone="true"/>
    <menuitem label="Adams" value="moz-abldapdirectory://ldap_2.servers.Adams" class="menuitem-iconic abMenuItem" AddrBook="true" IsRemote="true" selected="true"/>
  </menupopup>
</menulist>


user_pref("ldap_2.autoComplete.directoryServer", "moz-abldapdirectory://ldap_2.servers.Adams");
user_pref("ldap_2.autoComplete.useDirectory", true);
user_pref("ldap_2.servers.Adams.auth.dn", "");
user_pref("ldap_2.servers.Adams.auth.saslmech", "");
user_pref("ldap_2.servers.Adams.description", "Adams");
user_pref("ldap_2.servers.Adams.filename", "ldap.mab");
user_pref("ldap_2.servers.Adams.maxHits", 100);
user_pref("ldap_2.servers.Adams.uri", "ldap://ldap.adams.edu/ou=people,dc=adams,dc=edu??sub?(objectclass=*)");

Thanks for looking into this further. Yes, removing moz-abldapdirectory:// from pref ldap_2.autoComplete.directoryServer makes the auto-complete work again. Then of course you lose the value in the UI, like in bug 1574590. So "de-selected" actually means working since then the pref has the right value.

It must have gone wrong somewhere in https://hg.mozilla.org/comm-central/rev/0b4ea11f26f8983529311b4f728753eb31868395 so that the menulist values now have the scheme moz-abldapdirectory:// in them when they shouldn't. We also see this in the DOM comparison: Before: value="ldap_2.servers.Adams", after: value="moz-abldapdirectory://ldap_2.servers.Adams".

I think there bug is here:
https://hg.mozilla.org/comm-central/rev/0b4ea11f26f8983529311b4f728753eb31868395#l11.157
new: let listItem = this.appendItem(ab.dirName, ab.URI);

https://hg.mozilla.org/comm-central/rev/0b4ea11f26f8983529311b4f728753eb31868395#l15.109
old: let listItem = menulist.appendItem(ab.dirName, ab[value]);

BTW, the default startup directory also doesn't show properly in the UI.

For the record: Taking moz-abldapdirectory:// out of the pref value fixes the auto-complete and the search in the address book still works.

I considered backing out bug 1542711, but then bug 1549257 (2 changesets), bug 1560751 and bug 1563931 would have to be backed out, too. Anyway, the latter ones come out cleanly, but bug 1542711 itself doesn't since it touches too many files, including some changed in bug 1498332. So going forward is better than going backward here.

100% my fault.
I uploaded a patch for bug 1574590 that should fix also this one.
I also started a try run here: https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=93bf219a8ac27c4bfcbb550d3be100181a9bed8b

Flags: needinfo?(alessandro)
Assignee: nobody → alessandro
Severity: normal → critical
Status: NEW → ASSIGNED
Priority: -- → P1

Will be fixed by bug 1574590. Let's close this one not to carry two bugs around.

Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 70.0
Version: unspecified → 68
Blocks: 1574248
You need to log in before you can comment on or make changes to this bug.