]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Patch by Quentin Garnier:
authorTimo Sirainen <tss@iki.fi>
Sun, 25 Apr 2004 22:40:29 +0000 (01:40 +0300)
committerTimo Sirainen <tss@iki.fi>
Sun, 25 Apr 2004 22:40:29 +0000 (01:40 +0300)
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

src/auth/db-ldap.c
src/auth/db-ldap.h

index 14d13b514eaabe028a7bc1f1bb6e87bbec35ed7f..f4fbdbd3483823759647a85d175149fe41149ca6 100644 (file)
@@ -26,6 +26,7 @@
 
 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),
@@ -42,7 +43,8 @@ static struct setting_def setting_defs[] = {
 };
 
 struct ldap_settings default_ldap_settings = {
-       MEMBER(hosts) "localhost",
+       MEMBER(hosts) NULL,
+       MEMBER(uris) NULL,
        MEMBER(dn) NULL,
        MEMBER(dnpass) NULL,
        MEMBER(deref) "never",
@@ -178,7 +180,12 @@ static int ldap_conn_open(struct ldap_connection *conn)
                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);
index 21ae5a82da6d5e3931b75bf9307234c6720570bc..17d87bf7fc42ffe30bf5909b1e4d8078cdb1381c 100644 (file)
@@ -12,6 +12,7 @@ typedef void db_search_callback_t(struct ldap_connection *conn,
 
 struct ldap_settings {
        const char *hosts;
+       const char *uris;
        const char *dn;
        const char *dnpass;
        const char *deref;