[dovecot-cvs] dovecot/src/auth passdb-ldap.c, 1.19, 1.20 userdb-ldap.c, 1.23, 1.24

cras at dovecot.org cras at dovecot.org
Tue Jan 11 02:13:53 EET 2005


Update of /var/lib/cvs/dovecot/src/auth
In directory talvi:/tmp/cvs-serv15977/src/auth

Modified Files:
	passdb-ldap.c userdb-ldap.c 
Log Message:
Support variables in LDAP base setting.



Index: passdb-ldap.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/passdb-ldap.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- passdb-ldap.c	8 Jan 2005 16:56:04 -0000	1.19
+++ passdb-ldap.c	11 Jan 2005 00:13:50 -0000	1.20
@@ -152,19 +152,23 @@
 			     struct ldap_request *ldap_request)
 {
 	struct ldap_connection *conn = passdb_ldap_conn->conn;
+        const struct var_expand_table *vars;
 	const char **attr_names = (const char **)passdb_ldap_conn->attr_names;
-	const char *filter;
+	const char *filter, *base;
 	string_t *str;
 
+	vars = auth_request_get_var_expand_table(auth_request, ldap_escape);
+
+	str = t_str_new(512);
+	var_expand(str, conn->set.base, vars);
+	base = t_strdup(str_c(str));
+
 	if (conn->set.pass_filter == NULL) {
 		filter = t_strdup_printf("(&(objectClass=posixAccount)(%s=%s))",
 					 attr_names[ATTR_VIRTUAL_USER],
 					 ldap_escape(auth_request->user));
 	} else {
-		str = t_str_new(512);
-		var_expand(str, conn->set.pass_filter,
-			   auth_request_get_var_expand_table(auth_request,
-							     ldap_escape));
+		var_expand(str, conn->set.pass_filter, vars);
 		filter = str_c(str);
 	}
 
@@ -177,7 +181,7 @@
 			       conn->set.base, conn->set.scope, filter,
 			       t_strarray_join(attr_names, ","));
 
-	db_ldap_search(conn, conn->set.base, conn->set.ldap_scope,
+	db_ldap_search(conn, base, conn->set.ldap_scope,
 		       filter, passdb_ldap_conn->attr_names,
 		       ldap_request);
 }

Index: userdb-ldap.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/userdb-ldap.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- userdb-ldap.c	8 Jan 2005 16:56:04 -0000	1.23
+++ userdb-ldap.c	11 Jan 2005 00:13:50 -0000	1.24
@@ -164,20 +164,24 @@
 			       userdb_callback_t *callback, void *context)
 {
 	struct ldap_connection *conn = userdb_ldap_conn->conn;
+        const struct var_expand_table *vars;
 	const char **attr_names = (const char **)userdb_ldap_conn->attr_names;
 	struct userdb_ldap_request *request;
-	const char *filter;
+	const char *filter, *base;
 	string_t *str;
 
+	vars = auth_request_get_var_expand_table(auth_request, ldap_escape);
+
+	str = t_str_new(512);
+	var_expand(str, conn->set.base, vars);
+	base = t_strdup(str_c(str));
+
 	if (conn->set.user_filter == NULL) {
 		filter = t_strdup_printf("(&(objectClass=posixAccount)(%s=%s))",
 					 attr_names[ATTR_VIRTUAL_USER],
 					 ldap_escape(auth_request->user));
 	} else {
-		str = t_str_new(512);
-		var_expand(str, conn->set.user_filter,
-			   auth_request_get_var_expand_table(auth_request,
-							     ldap_escape));
+		var_expand(str, conn->set.user_filter, vars);
 		filter = str_c(str);
 	}
 
@@ -192,7 +196,7 @@
 			       conn->set.base, conn->set.scope, filter,
 			       t_strarray_join(attr_names, ","));
 
-	db_ldap_search(conn, conn->set.base, conn->set.ldap_scope,
+	db_ldap_search(conn, base, conn->set.ldap_scope,
 		       filter, userdb_ldap_conn->attr_names,
 		       &request->request);
 }



More information about the dovecot-cvs mailing list