Tuesday, January 24, 2006

Using Attributes Appropriately

A week ago, I started hearing complaints that people with Thunderbird 1.5 were having problems searching our LDAP directory. I ignored it at first, as I was busy, and figured it was a configuration problem, and I'm not responsible for mail client configurations.

In the last few days, it's turned in to a torrent of complaints, and it definitely isn't a configuration problem. So, what could it be?

It seems that the Thunderbird folks decided that the perfectly legitimate search filter

used by previous version was far too, uhm, correct. They changed it to:
(|(mail=*first last*)(displayname=*first last*)(givenname=*first last*)(sn=*first last*))
because searching on DisplayName seems like a good use of an attribute meant for the display version of a name.

This may seem innocuous enough, but it isn't. CN is Common Name, which we (and other people, I'm sure) specially handle to provide nickname searching. So, searching for cn=john miner will find me, whereas displayname=john miner doesn't (even though my first name is misspeeled..

In this case, I was able to fix it using the same custom plugin I wrote to do the nickname lookups to translate searches on displayname in to searches on cn. If not for this, it would be up to us to change user.js on every Thunderbird client, because Michael Layde found that

user_pref("ldap_2.servers.default.attrmap.DisplayName", "cn,commonname");
changes what Thunderbird uses for DisplayName. Boy, that would be fun.

Please, people, use attributes the way they are intended!

Technorati Tags: ,

No comments: