Joint Scientific IT and Technical Services

Personal Homepage

Using OpenLDAP defaults in Exim and Perdition (Cernko, Patrick)

The OpenLDAP libraries can take defaults for LDAP servers, search base from different presets, most obviously from the ldap.conf configuration file (manpage). Unfortunately, Exim and Perdition cannot make use of it in the way the code initializes the library. To avoid having to configure the LDAP search base and even more important, the servers to use, in both Exim's and Perdition's config files, I delveloped a patch for both.

The idea of the patch is to avoid breaking existing configurations and to only extend the feature without drawbacks. This is achieved in two steps. First, if no servers are specified and the protocol is not LDAPS in the Exim resp. Perdition configuration, the library is initialized with a NULL argument. This causes OpenLDAP to use the default servers and protocol configured.

The solution for the servers does not work for the default search base, as it is possible to use an empty search base when querying LDAP servers (some servers provide some configuration parameters in the root). Instead I decided to use the special keyword default as string for the search base. As default is not a valid search base specification, I'm sure that this won't break existing configurations. If code detects the string as search base, it gets the default search base from the LDAPURLDesc, generated from the library's initialization.