[dovecot-cvs] dovecot/src/auth passdb-sql.c, 1.23, 1.24 passdb-ldap.c, 1.35, 1.36 auth-cache.h, 1.3, 1.4 auth-cache.c, 1.14, 1.15

cras at dovecot.org cras at dovecot.org
Fri Oct 28 15:02:41 EEST 2005


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

Modified Files:
	passdb-sql.c passdb-ldap.c auth-cache.h auth-cache.c 
Log Message:
cache_key was set wrong for sql/ldap passdbs, so auth_cache was completely
broken with them



Index: passdb-sql.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/passdb-sql.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- passdb-sql.c	20 Oct 2005 09:07:48 -0000	1.23
+++ passdb-sql.c	28 Oct 2005 12:02:36 -0000	1.24
@@ -177,7 +177,8 @@
 	module->conn = conn = db_sql_init(args);
 
 	module->module.cache_key =
-		auth_cache_parse_key(conn->set.password_query);
+		auth_cache_parse_key(auth_passdb->auth->pool,
+				     conn->set.password_query);
 	module->module.default_pass_scheme = conn->set.default_pass_scheme;
 	return &module->module;
 }

Index: passdb-ldap.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/passdb-ldap.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- passdb-ldap.c	20 Oct 2005 09:07:48 -0000	1.35
+++ passdb-ldap.c	28 Oct 2005 12:02:36 -0000	1.36
@@ -243,7 +243,9 @@
 
 	db_ldap_set_attrs(conn, conn->set.pass_attrs, &conn->pass_attr_names,
 			  conn->pass_attr_map, default_attr_map);
-	module->module.cache_key = auth_cache_parse_key(conn->set.pass_filter);
+	module->module.cache_key =
+		auth_cache_parse_key(auth_passdb->auth->pool,
+				     conn->set.pass_filter);
 	module->module.default_pass_scheme = conn->set.default_pass_scheme;
 	return &module->module;
 }

Index: auth-cache.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/auth-cache.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- auth-cache.h	16 Oct 2005 14:06:59 -0000	1.3
+++ auth-cache.h	28 Oct 2005 12:02:36 -0000	1.4
@@ -6,7 +6,7 @@
 
 /* Parses all %x variables from query and compresses them into tab-separated
    list, so it can be used as a cache key. */
-const char *auth_cache_parse_key(const char *query);
+char *auth_cache_parse_key(pool_t pool, const char *query);
 
 /* Create a new cache. max_size specifies the maximum amount of memory in
    bytes to use for cache (it's not fully exact). ttl_secs specifies time to

Index: auth-cache.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/auth-cache.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- auth-cache.c	16 Oct 2005 14:06:59 -0000	1.14
+++ auth-cache.c	28 Oct 2005 12:02:36 -0000	1.15
@@ -28,7 +28,7 @@
 	unsigned int hit_count, miss_count;
 };
 
-const char *auth_cache_parse_key(const char *query)
+char *auth_cache_parse_key(pool_t pool, const char *query)
 {
 	string_t *str;
 	char key_seen[256];
@@ -36,7 +36,7 @@
 
 	memset(key_seen, 0, sizeof(key_seen));
 
-	str = t_str_new(32);
+	str = str_new(pool, 32);
 	for (; *query != '\0'; query++) {
 		if (*query == '%' && query[1] != '\0') {
 			query++;
@@ -52,7 +52,7 @@
 			}
 		}
 	}
-	return str_c(str);
+	return str_free_without_data(str);
 }
 
 static void



More information about the dovecot-cvs mailing list