LDAP is a great protocol. It allows multiple clients to obtain data about virtually anything that you can think of. The LDAPAddressBook project is a project to determine a LDAP Schema that works in the following clients:
- Mozilla Thunderbird
- Windows Address Book
- OS X Address Book
- Squirrel Mail
In fact any client that supports LDAP.
By determining this schema, ClearChain can finally have a ‘go anywhere’ addressbook.
The idea is that everything is stored in a database. Databases are great for storing and manipulating information. Currently we use a MySQL database. Data is extracted from the database in xml format. This is actually ridiculously easy. MySQL (on the command line at least) supports output formats of xml. On the command line when connecting to the database you just throw in a –xml flag, for example:
mysql --xml -u frank -p
Then when you get any text back from any queries you run the results will be wrapped in xml. Even commands such as:
mysql> show databases;
will return results marked up with xml, for example:
<?xml version="1.0"?> <resultset statement="show databases;"> <row> <field name="Database">information_schema</field> </row> <row> <field name="Database">addressbook</field> </row> <row> <field name="Database">budget</field> </row> <row> <field name="Database">dinner</field> </row> <row> <field name="Database">mysql</field> </row> <row> <field name="Database">wiki_thesis</field> </row> </resultset>
This is awesome because it means that we can easily convert the xml into any format that we want in particular an LDAP schema that Thunderbird understands, an LDAP schema that Outlook understands, but also just as easily HTML, XHTML, plain text… you name it the xml can be converted to it simply with an xml transformation.
In the case of an LDAP server once the XML has been converted to the appropriate format existing LDAP data is blown away and then replaced by the new schema.
NOTE: Through php the mysql calls do not support fetch results in xml format, except via an extension. For this reason I wrote a simple method that wraps the mysql like xml around the data set returned via the usual query call.
The second stage of this project is to provide the various email clients and addressbooks with the ability to add and modify contacts in the database. This is more of a pipe dream at the moment, but should be relatively straight forward with an email client such as Thunderbird.
This section details the various fields used by different applications for the address book. I’ve tried to map the fields to the official ldap schemas that exist. A full list that are supported by thunderbird is available at: http://www.mozilla.org/projects/thunderbird/specs/ldap.html
There is however a lot of undocumented mozilla/thunderbird specific attributes. http://www.pro-linux.de/t_office/mozilla_op20.schema
Documents a complete mozilla schema but is yet to be tested
|LDAP Schema||Field||Thunderbird||Outlook Express|
|mozillaAbPersonObsolete||mozillaUseHtmlMail||Prefers to receive message formated as|
|-||Address (Ln1 HM)|
|mozillaAbPersonObsolete||mozillaHomePostalAddress2||Address (Ln2 HM)|
|220.127.116.11||postOfficeBox||Address (Ln1 Wk)|
|mozillaAbPersonObsolete||mozillaPostalAddress2||Address (Ln2 Wk)|
|mozillaAbPersonObsolete||mozillaWorkUrl||Web Page (Wk)|
In order to use create a schema for openldap that works for at least Thunderbird, download the schema linked above then make sure you have the following lines in your slapd.conf
include /usr/local/etc/openldap/schema/core.schema # Add additional schema include /usr/local/etc/openldap/schema/cosine.schema include /usr/local/etc/openldap/schema/inetorgperson.schema include /usr/local/etc/openldap/schema/mozilla_op20.schema
Aaron Stafford has written a substantial amount of code for this project, including:
- HTML front end which communicates with the the database over PHP
- XSL transformation that converts XML extracted from the database into the openldap ready text
Access to the code is currently restricted, but hopefully this will become a public upon request. If you are interested in seeing this project become public please drop us a line.
git clone firstname.lastname@example.org:/export/git/projects/ldapab
On the mac you have to specify where you want it checked out to so use:
git clone email@example.com:/export/git/projects/ldapab ldapab
If you are on a mac. It might be the case that you need to do this on any platform. I haven’t tested it anywhere else though.
http://www.plaxo.com/ – Plaxo is an interesting application. It lets you sync a whole bunch of different address books and calendar information from different application and online accounts. I have not used this but it appears to be a near perfect solution if you are prepared to hand over your usernames and passwords to another company. ldapab is designed to be managed by the person looking after their own contacts, not having someone else manage it for you.
Donations keep this site alive