[Dovecot] [PATCH] passdb cache fixes

Andrey Panin pazke at donpac.ru
Mon Dec 6 12:53:51 EET 2004


Hello,

attached patches fixes some bugs in passdb cache.

First patch fixes bug which causes passdb cache always return empty
scheme for cached passwords.

Second patch fixes dovecot-auth crash with passdb cache enabled.
I'm not sure that it is proper fix, though.

Best regards.

-- 
Andrey Panin		| Linux and UNIX system administrator
pazke at donpac.ru		| PGP key: wwwkeys.pgp.net
-------------- next part --------------
diff -urdpNX /usr/share/dontdiff dovecot-1.0-test55.vanilla/src/auth/passdb-cache.c dovecot-1.0-test55/src/auth/passdb-cache.c
--- dovecot-1.0-test55.vanilla/src/auth/passdb-cache.c	2004-12-04 18:05:55.000000000 +0300
+++ dovecot-1.0-test55/src/auth/passdb-cache.c	2004-12-05 18:52:57.000000000 +0300
@@ -88,7 +88,6 @@ int passdb_cache_lookup_credentials(stru
 				    const char **scheme_r)
 {
 	const char *value, *const *list;
-	const char *cached_pw;
 
 	if (passdb_cache == NULL)
 		return FALSE;
@@ -108,7 +107,7 @@ int passdb_cache_lookup_credentials(stru
         list_save(request, NULL, list+1);
 
 	*result_r = list[0];
-	*scheme_r = password_get_scheme(&cached_pw);
+	*scheme_r = password_get_scheme(result_r);
 	return TRUE;
 }
 
-------------- next part --------------
diff -urdpNX /usr/share/dontdiff dovecot-1.0-test55.vanilla/src/auth/mech.c dovecot-1.0-test55/src/auth/mech.c
--- dovecot-1.0-test55.vanilla/src/auth/mech.c	2004-12-04 18:07:56.000000000 +0300
+++ dovecot-1.0-test55/src/auth/mech.c	2004-12-04 18:14:01.000000000 +0300
@@ -258,7 +258,8 @@ void auth_request_extra_finish(struct au
 
 	if (passdb_cache != NULL && cache_key != NULL) {
 		str = t_str_new(64);
-		str_append_str(str, extra->str);
+		if (extra->str != NULL)
+			str_append_str(str, extra->str);
 		if (extra->request->no_failure_delay) {
 			if (str_len(str) > 0)
 				str_append_c(str, '\t');
@@ -266,7 +267,8 @@ void auth_request_extra_finish(struct au
 		}
 		auth_cache_insert(passdb_cache, extra->request, cache_key,
 				  t_strconcat(extra->password == NULL ? "" :
-					      extra->password, "\t",
+					      extra->password,
+					      str_len(str) > 0 ? "\t" : "",
 					      str_c(str), NULL));
 	}
 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://dovecot.org/pipermail/dovecot/attachments/20041206/4f383a91/attachment-0001.bin>


More information about the dovecot mailing list