Closed Bug 585917 Opened 14 years ago Closed 14 years ago

LDAP searching broken in comm-central

Categories

(Thunderbird :: Address Book, defect)

All
Linux
defect
Not set
major

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 3.3a1

People

(Reporter: jhorak, Assigned: standard8)

Details

(Keywords: regression)

Attachments

(1 file, 4 obsolete files)

I'm unable to search LDAP for contacts:

Reproduce steps:
- Toolbar->Address Book
- Choose LDAP server from list of address books
- type name to search input

Results:
Nothing is found. 

Expected:
In TB 3.1.2 contact is found.

Output in terminal with debug enabled:
JS Component Loader: ERROR file:///home/jan/src/2comm-central/mozilla/dist/bin/components/nsAbLDAPAttributeMap.js:355
                     ReferenceError: XPCOMUtils is not defined
WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80040154: file nsAbLDAPDirectory.cpp, line 694
WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80040154: file nsAbLDAPDirectory.cpp, line 347
WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80040154: file nsAbLDAPDirectory.cpp, line 191


Error console output (when clicked on the ldap server from list of address books):
Error: An error occurred updating the cmd_delete command: [Exception... "'[JavaScript Error: "cards[i] is null" {file: "chrome://messenger/content/addressbook/abResultsPane.js" line: 158}]' when calling method: [nsIController::isCommandEnabled]"  nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "JS frame :: chrome://global/content/globalOverlay.js :: goUpdateCommand :: line 80"  data: yes]
Source File: chrome://global/content/globalOverlay.js
Line: 86
Keywords: regression
Looks like this file missed having the XPCOMUtils inclusion added to it when bug 575740 fixed it up.

Does adding:

Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");

just after the license block make it work?
I added 
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
to 
file:///home/jan/src/2comm-central/mozilla/dist/bin/components
and it shows different error now:

JS Component Loader: ERROR resource://gre/modules/XPCOMUtils.jsm:136
                     TypeError: component.prototype is undefined
WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80040154: file nsAbLDAPDirectory.cpp, line 694
WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80040154: file nsAbLDAPDirectory.cpp, line 347
WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80040154: file nsAbLDAPDirectory.cpp, line 191

XPCOMUtils.jsm:136:
http://mxr.mozilla.org/comm-central/source/mozilla/js/src/xpconnect/loader/XPCOMUtils.jsm#136
The prototype definition seems to be missing and generateNSGetFactory is unable to load factory. For relevant changes in nsAbLDAPAttributeMap.js see:

http://hg.mozilla.org/comm-central/diff/5c63d717ff1e/mailnews/addrbook/src/nsAbLDAPAttributeMap.js

I can try to fix it.
Comply with the new requirement in XPCOMUtils.js for the elements of the array
argument to have classID members.

Using an LDAP address book fails the check added June 27 for bug 568691,

  http://hg.mozilla.org/mozilla-central/rev/4a2f9f03b589

  In generateNSGetFactory, classID missing or incorrect for component ...
With applied attachment 465548 [details] [diff] [review] ldap search is working again.
Attachment #465548 - Flags: review?(bugzilla)
This morning I loaded a nightly build and Shredder showed more errors,

Error: ERROR addons.manager: Exception loading provider PluginProvider from category "resource://modules/PluginProvider.jsm": [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXPCComponents_Utils.import]"  nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)"  location: "JS frame :: resource://gre/modules/AddonManager.jsm :: AMI_startup :: line 177"  data: no]


Error: uncaught exception: [Exception... "Component returned failure code: 0x80570016 (NS_ERROR_XPC_GS_RETURNED_FAILURE) [nsIJSCID.getService]"  nsresult: "0x80570016 (NS_ERROR_XPC_GS_RETURNED_FAILURE)"  location: "JS frame :: chrome://communicator/content/utilityOverlay.js :: buildHelpMenu :: line 231"  data: no]


Error: uncaught exception: [Exception... "Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIXPCComponents_Utils.import]"  nsresult: "0x80070057 (NS_ERROR_ILLEGAL_VALUE)"  location: "JS frame :: file:///C:/Program%20Files/Shredder/components/nsUpdateService.js :: <TOP_LEVEL> :: line 5"  data: no]


Error: XPCOMUtils is not defined
Source File:
file:///C:/Program%20Files/Shredder/components/nsAbLDAPAttributeMap.js
Line: 355


With the attached patching script, these errors except the one from PluginProvider.jsm disappeared.  I believe the script could be re-used to apply same changes against comm-central and browser repositories.
The attached patch should fix this error.

Error: An error occurred updating the cmd_delete command: [Exception... "'[JavaScript Error: "cards[i] is null" {file: "chrome://messenger/content/addressbook/abResultsPane.js" line: 158}]' when calling method: [nsIController::isCommandEnabled]"  nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "JS frame :: chrome://global/content/globalOverlay.js :: goUpdateCommand :: line 80"  data: yes]
Source File: chrome://global/content/globalOverlay.js
Line: 86

(I found that the error may keep re-appearing even after restarting Shredder.  I wonder if the life cycle of messenger.jar is longer than that of the Shredder application.  I could not find a factor affecting the complete refresh of Shredder's view of messenger.jar).

I am using davmail for IMAP, SMTP and LDAP access to Exchange.  I had to set ou=people in the Shredder's Base DN option to the LDAP directory and DOMAIN\user in the Bind DN option.  I had to leave the search filter option at (objectclass=*) because (a) processing of (|(sn=*)(cn=*)(uid=*)) generates an extra AND wildcard clause that appears to confuse either davmail or exchange and (b) attempts to use %v* wildcards corrupt the wildcard setting itself, making me think that Shredder passes the raw setting to its ldap URI 

  ldap_2.servers.local.uri=ldap://localhost:1389/ou=people??sub

Only incremental search in composer worked with the following tweak,

 ldap_2.servers.local.autoComplete.filterTemplate=(|(cn=%v*)(sn=%v*)(uid=%v*))

I had to patch davmail to fix my incremental LDAP search by surnames,

  http://sourceforge.net/tracker/?func=detail&aid=3043658&group_id=184600&atid=909906
Ignore comment 6 and attachment 465712 [details] [diff] [review] as I made an uneducated guess at the correctness of resource URIs.

There may be a better place to fix URIs, bug 556670.
Attached file replace resource urls (obsolete) —
This stops the "file not found" errors, but may still be ignoring the difference between the "gre" and "non-gre" resources.
Attachment #465712 - Attachment is obsolete: true
Last night's build + attachment 465548 [details] [diff] [review] + attachment 465796 [details] resulted in a working Address Book search, in addition to the auto-complete functionality.  

I could not pinpoint a recent change in the repository that was critical to Address Book search functionality.

The "cards[i] is null" error still shows up.
Address book search worked in Aug 17 nightly with just attachment 465548 [details] [diff] [review].

Aug 18 nightly does not even start.
Ilguiz: You need to keep to one issue per bug please. This bug is for the broken LDAP auto-complete functionality.

The cards[i] is null error and your issues with resource uris need to be filed as separate bugs. This is to aid tracking and clarity within bugs.
Attachment #465718 - Attachment is obsolete: true
Attachment #465796 - Attachment is obsolete: true
Attachment #465796 - Attachment mime type: text/x-sh → text/plain
Comment on attachment 465548 [details] [diff] [review]
comply with the new requirement in XPCOMUtils.js

Although the basic idea of this patch is right, you haven't removed the old nsAbLDAPAttributeMapModule. Additionally our coding style puts XPCOMUtils at the top of the file, and we tend to replace the QueryInterface function with an XPCOMUtils generated one.

I also ran into a few problems with a javascript strict warning:

JavaScript strict warning: file:///Users/moztest/comm/main/tb/mozilla/dist/ShredderDebug.app/Contents/MacOS/components/nsAbLDAPAttributeMap.js, line 105: reference to undefined property this.mPropertyMap[aProperty]

As I think this is your first time here, and we normally want an hg patch for reviews, I'm going to attach a new patch with these fixes in it.
Attachment #465548 - Flags: review?(bugzilla) → review-
Attached patch The fixSplinter Review
Revised patch with fix for javascript strict warning.
Assignee: nobody → bugzilla
Attachment #465548 - Attachment is obsolete: true
Attachment #467383 - Flags: review?(neil)
(In reply to comment #12)
> Ilguiz: You need to keep to one issue per bug please. This bug is for the
> broken LDAP auto-complete functionality.
> 
> The cards[i] is null error and your issues with resource uris need to be filed
> as separate bugs. This is to aid tracking and clarity within bugs.

I agree with removing the unrelated patches here.  As for your suggestion about the topic, the original message in this bug was about the search functionality of the address book, not the auto-complete functionality.  

Thanks for the review and showing a proper patch.
Attachment #467383 - Flags: review?(neil) → review+
(In reply to comment #15)
> (In reply to comment #12)
> > Ilguiz: You need to keep to one issue per bug please. This bug is for the
> > broken LDAP auto-complete functionality.
> 
> I agree with removing the unrelated patches here.  As for your suggestion about
> the topic, the original message in this bug was about the search functionality
> of the address book, not the auto-complete functionality.  

Yeah, sorry, I meant search functionality.
Checked in: http://hg.mozilla.org/comm-central/rev/574ee823683f
Status: NEW → RESOLVED
Closed: 14 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 3.2a1
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: