MailNews:LDAP Address Books

From MozillaWiki
Jump to: navigation, search
Resources
MailNews Homepage
Address Book Homepage
Roadmap
Help Wanted
LDAP Address Books
Code Structure
Bug Locations
Related Standards

LDAP Logging

The LDAP logging can be used to view the messages that the Address Book is sending and receiving to/from your LDAP server. We hope that this will aid debugging problems on an LDAP link.

To enable logging set the environment variable "NSPR_LOG_MODULES" to ldap:5 (see links below for how to do this) and start up Address Book, then attempt an LDAP search or autocomplete and the connection/message process will be logged to the console.

For ease of logging, you may wish to also set the NSPR_LOG_FILE to a file location so that you don't need to capture the file output. See the links below on how to set this up.

See these links for more detail:

LDAP Address Book Schema

The address book code specifies default settings for communicating with LDAP servers.

The default settings are specified in a defined schema, currently in an alpha version. Setting up a LDAP server with this schema, and setting up the address book (Thunderbird or SeaMonkey) to talk to that LDAP server will enable all fields to work correctly.

Overriding the default schema for LDAP address books

As of SeaMonkey 1.0 and Thunderbird 1.5 it is possible to override some aspects of the default LDAP schema for address books.

This can either be done for all LDAP address books, or for individual ones.

Globally overriding the default LDAP schema

In preferences (about:config/prefs.js) there are a set of preferences prefixed by "ldap_2.servers.default.attrmap.". For example:

pref("ldap_2.servers.default.attrmap.FirstName", "givenName");
pref("ldap_2.servers.default.attrmap.LastName", "sn,surname");
pref("ldap_2.servers.default.attrmap.DisplayName", "cn,commonname");
pref("ldap_2.servers.default.attrmap.NickName", "mozillaNickname,xmozillanickname");
pref("ldap_2.servers.default.attrmap.PrimaryEmail", "mail");
pref("ldap_2.servers.default.attrmap.Company", "o,company");

By changing these values (comma-separated lists), you are able to override the default mapping for address book attributes.

Taking the Company case, it is by default set to look up the "o" attribute first, if it doesn't find it to be present, it will look up the "company" attribute instead. Note that when searching for items, the address book will only search for the first attribute, i.e. "o" in this case.

So changing "ldap_2.servers.default.attrmap.Company" to "organization,o,company" will cause the address book when searching for Companies, to look at the "organization" attribute, and to prioritise the organization attribute when pulling out values to display.

Note: You can only use each attribute once in the prefs, i.e. you can't set both FirstName and DisplayName to "cn".

Overriding individual LDAP Address Book Schemas

In a similar manner to globally overriding the LDAP Address Book schema, it can also be overridden for individual address books.

  1. Create a LDAP address book in SeaMonkey/Thunderbird.
  2. Exit SeaMonkey/Thunderbird
  3. Look in prefs.js for ldap_2.servers.xxx.description - The value should match the name you entered, note the xxx value.
  4. For the attribute(s) you wish to override, set up new preferences of the form: ldap_2.servers.xxx.attrmap.attribute (where attribute matches one of the global attributes) and set the value to whatever you wish for that address book.
  5. Save prefs.js and restart SeaMonkey/Thunderbird - you should find that the schema override works only for that particular address book.