Mercurial > dovecot > original-hg > dovecot-1.2
changeset 3694:12d00d9ceb6e HEAD
cache_key was set wrong for sql/ldap passdbs, so auth_cache was completely
broken with them
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 28 Oct 2005 15:02:36 +0300 |
parents | b4fac5616c03 |
children | 4f8598b0ca62 |
files | src/auth/auth-cache.c src/auth/auth-cache.h src/auth/passdb-ldap.c src/auth/passdb-sql.c |
diffstat | 4 files changed, 9 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/auth/auth-cache.c Fri Oct 28 14:49:34 2005 +0300 +++ b/src/auth/auth-cache.c Fri Oct 28 15:02:36 2005 +0300 @@ -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
--- a/src/auth/auth-cache.h Fri Oct 28 14:49:34 2005 +0300 +++ b/src/auth/auth-cache.h Fri Oct 28 15:02:36 2005 +0300 @@ -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
--- a/src/auth/passdb-ldap.c Fri Oct 28 14:49:34 2005 +0300 +++ b/src/auth/passdb-ldap.c Fri Oct 28 15:02:36 2005 +0300 @@ -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; }
--- a/src/auth/passdb-sql.c Fri Oct 28 14:49:34 2005 +0300 +++ b/src/auth/passdb-sql.c Fri Oct 28 15:02:36 2005 +0300 @@ -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; }