1. Change default value for 'hosts' to NULL instead of 'localhost'. That
way, libldap will choose the default list of server as specified in
OpenLDAP's ldap.conf configuration file.
2. Add a new configuration stance, 'uris', which you can set to a list of
URIs that will be passed directly to libldap, which understands them.
--HG--
branch : HEAD
static struct setting_def setting_defs[] = {
DEF(SET_STR, hosts),
+ DEF(SET_STR, uris),
DEF(SET_STR, dn),
DEF(SET_STR, dnpass),
DEF(SET_STR, deref),
};
struct ldap_settings default_ldap_settings = {
- MEMBER(hosts) "localhost",
+ MEMBER(hosts) NULL,
+ MEMBER(uris) NULL,
MEMBER(dn) NULL,
MEMBER(dnpass) NULL,
MEMBER(deref) "never",
return TRUE;
if (conn->ld == NULL) {
- conn->ld = ldap_init(conn->set.hosts, LDAP_PORT);
+ if (conn->set.uris != NULL) {
+ if (ldap_initialize(&conn->ld, conn->set.uris) != LDAP_SUCCESS)
+ conn->ld = NULL;
+ } else
+ conn->ld = ldap_init(conn->set.hosts, LDAP_PORT);
+
if (conn->ld == NULL)
i_fatal("LDAP: ldap_init() failed with hosts: %s",
conn->set.hosts);
struct ldap_settings {
const char *hosts;
+ const char *uris;
const char *dn;
const char *dnpass;
const char *deref;