[dovecot-cvs] dovecot/src/auth db-ldap.c, 1.20, 1.21 db-ldap.h, 1.10, 1.11

cras at procontrol.fi cras at procontrol.fi
Mon Apr 26 01:40:31 EEST 2004


Update of /home/cvs/dovecot/src/auth
In directory talvi:/tmp/cvs-serv31797

Modified Files:
	db-ldap.c db-ldap.h 
Log Message:
Patch by Quentin Garnier:

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.



Index: db-ldap.c
===================================================================
RCS file: /home/cvs/dovecot/src/auth/db-ldap.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- db-ldap.c	3 Dec 2003 00:40:21 -0000	1.20
+++ db-ldap.c	25 Apr 2004 22:40:29 -0000	1.21
@@ -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 @@
 };
 
 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 @@
 		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: db-ldap.h
===================================================================
RCS file: /home/cvs/dovecot/src/auth/db-ldap.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- db-ldap.h	6 Mar 2003 21:45:16 -0000	1.10
+++ db-ldap.h	25 Apr 2004 22:40:29 -0000	1.11
@@ -12,6 +12,7 @@
 
 struct ldap_settings {
 	const char *hosts;
+	const char *uris;
 	const char *dn;
 	const char *dnpass;
 	const char *deref;



More information about the dovecot-cvs mailing list