dovecot-2.1: auth: userdb static used auth caching wrong when ve...

dovecot at dovecot.org dovecot at dovecot.org
Tue Sep 18 19:58:05 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.1/rev/c38060f0ad58
changeset: 14711:c38060f0ad58
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Sep 18 19:57:48 2012 +0300
description:
auth: userdb static used auth caching wrong when verifying user existence with passdb lookup.
Cache entries were being looked/added for userdbs instead of passdbs. This
caused problems at least with:

a) Multiple userdbs (where static userdb was the last). Passdb results were
added as cache entries to the first userdbs, possibly causing some confusion.

b) Multiple passdbs, because the first passdb result was added to cache and
used for the rest of the passdbs.

diffstat:

 src/auth/userdb-static.c |  6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diffs (23 lines):

diff -r 74d639b2a5bf -r c38060f0ad58 src/auth/userdb-static.c
--- a/src/auth/userdb-static.c	Tue Sep 18 19:16:04 2012 +0300
+++ b/src/auth/userdb-static.c	Tue Sep 18 19:57:48 2012 +0300
@@ -42,6 +42,8 @@
 {
 	struct static_context *ctx = auth_request->context;
 
+	auth_request->userdb_lookup = TRUE;
+
 	auth_request->private_callback.userdb = ctx->old_callback;
 	auth_request->context = ctx->old_context;
 	auth_request_set_state(auth_request, AUTH_REQUEST_STATE_USERDB);
@@ -92,6 +94,10 @@
 
 		auth_request->context = ctx;
 		if (auth_request->passdb != NULL) {
+			/* kludge: temporarily work as if we weren't doing
+			   a userdb lookup. this is to get auth cache to use
+			   passdb caching instead of userdb caching. */
+			auth_request->userdb_lookup = FALSE;
 			auth_request_lookup_credentials(auth_request, "",
 				static_credentials_callback);
 		} else {


More information about the dovecot-cvs mailing list