LDAP and exmh

(I don't know much about LDAP, but I'm starting this page to encourage someone that does to give me a clue.)

There are two ways to use LDAP from exmh:

  1. Via any command line LDAP search program. That capability is entwined with the exmh Address Database code and is only accessible from the Simple Editor.
  2. Via the ldapper program. Ldapper is a small Tcl/Tk program that can search LDAP directories and can "launch" an exmh "compose".

ldapper

http://www-users.aston.ac.uk/~oweng/ldapper-1.2/

That page includes instructions for integrating it with exmh.

This version only seems to understand X.500-style directory roots (o=Some Place,c=GB) as opposed to the DNS-style one we use (dc=hw,dc=ac,dc=uk).

The other disadvantage to ldapper is there is no way to compose a message to multiple recipients or to add a recipient to an in-progress message using it.

One advantage to using ldapper is the ability to see additional information from the LDAP directory entry, such as phone numbers. This has absolutely nothing to do with exmh or sending email, but it could be useful anyway.

Ldapper locates and communicates with exmh using your X server. It is not necessary for ldapper to run on the same system as exmh as long as they both display on the same X server. If you habitually have multiple copies of exmh displayed on one X server there is no way to control which one ldapper will choose to invoke the compose on.

Command line LDAP search program

An extension to the Address Database code added the ability to use a command line LDAP search program to "expand" addresses in the same way as can be done with MH/nmh aliases and Address Database entries. This is only available from the Simple Editor (sedit) message composer in exmh. To use it you must correctly set some preference entries in the Address Database preference panel. Once that is done a search is accomplished by typing a partial name or mail address in the sedit compose window and then hitting the expand key (default is Ctrl-Tab, it is customizable via the Simple Edit Bindings panel).

Harvey Eneman reports successfully using openldap-2.1.14 with exmh 2.6.1. The ldapsearch options used implicitly by exmh did change recently. Hal DeVore has successfully used openldap-2.0.21 with exmh 2.6.1 and also with exmh 2.5 but the required preferences settings are different.

Address Database Preferences for LDAP

Set up the Address Database Preferences (verified with openldap 2.0.21 and exmh 2.6.1, ymmv)

  1. Include "LDAP_Lookup" in the "Expand methods to use" preference, set your server and other prefs. The lookup code tries each of the expansion methods in sequence until it gets a "hit". If you put the LDAP_Lookup method first in the list it'll be tried first. I have mine set to Alias_Lookup Addr_FullNameMatch Addr_Lookup LDAP_Lookup
  2. Set your server. This can be in one of two forms: -h server-fqdn or -H server-url. For example: -H ldap://myldap.mydomain.com
  3. Set your search root, this is also a good place to set the authentication. The information you will need has to be obtained from your LDAP administrator. Here's an example: -x -b "o=BMC Software, c=US" (the -x indicates "simple authentication, -b and the quoted string is a search root). Depending on your LDAP server's content and/or configuration, a search root may not be necessary.
  4. Set your LDAP Encoding, if in doubt leave the default utf-8
  5. Set your search program name. For openldap this is ldapsearch

Then, in sedit, type a partial name or address and hit the expand key (default is ctrl-tab).

Testing from an xterm

It is useful to ensure that your LDAP server is responding and that your preferences are resulting in a well formed query. You can construct an equivalent query using the ldapsearch program directly from an xterm. Here's a sample (this would all be on one line but is split for readability):

  ldapsearch -H ldap://es01-hou.bmc.com -x -b "o=BMC Software,c=US"
    "(|(cn=*sando*)(mail=*sando*)(sn=*sando*)(givenname=*sando*))" cn mail

It is constructed from the following parts:

  1. ldapsearch is the name of your LDAP search command. If the program is not available on $PATH as exmh sees it, specify the full path.
  2. -H ldap://es01-hou.bmc.com is your LDAP server. In this example it is specified using the -H option and thus is in URI format.
  3. -x -b "o=BMC Software,c=US" is the search root. In this case it also includes the -x option to specify simple authentication.
  4. The long quoted expression is the query filter. In this case the string "sando" is being sought in the "cn", "mail", "sn", and "givenname" fields. This is how exmh constructs its query (at least as of 2.5).
  5. cn mail names the fields that are to be output from the search.


Updated on 13 Mar 2003, 22:58 GMT
Search - Recent Changes - Reference - Index - Go to Beedub's Wiki - Help