dovecot-2.0: auth: passdb credentials lookup fix when using mult...

dovecot at dovecot.org dovecot at dovecot.org
Thu Dec 2 21:10:26 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/627aeadb0955
changeset: 12489:627aeadb0955
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Dec 02 19:10:23 2010 +0000
description:
auth: passdb credentials lookup fix when using multiple passdbs.
If at least one passdb returns "user unknown" and the last passdb returns
"credential lookup not supported", the proper return value is still
"user unknown".

diffstat:

 src/auth/auth-request.c |  12 +++++++++++-
 src/auth/auth-request.h |   1 +
 2 files changed, 12 insertions(+), 1 deletions(-)

diffs (40 lines):

diff -r 4113324354f5 -r 627aeadb0955 src/auth/auth-request.c
--- a/src/auth/auth-request.c	Thu Dec 02 17:38:08 2010 +0000
+++ b/src/auth/auth-request.c	Thu Dec 02 19:10:23 2010 +0000
@@ -440,7 +440,11 @@
                 request->passdb = request->passdb->next;
 		request->passdb_password = NULL;
 
-                if (*result == PASSDB_RESULT_INTERNAL_FAILURE) {
+		if (*result == PASSDB_RESULT_USER_UNKNOWN) {
+			/* remember that we did at least one successful
+			   passdb lookup */
+			request->passdb_user_unknown = TRUE;
+		} else if (*result == PASSDB_RESULT_INTERNAL_FAILURE) {
 			/* remember that we have had an internal failure. at
 			   the end return internal failure if we couldn't
 			   successfully login. */
@@ -596,6 +600,12 @@
 				"Credentials: %s",
 				binary_to_hex(credentials, size));
 		}
+		if (result == PASSDB_RESULT_SCHEME_NOT_AVAILABLE &&
+		    request->passdb_user_unknown) {
+			/* one of the passdbs accepted the scheme,
+			   but the user was unknown there */
+			result = PASSDB_RESULT_USER_UNKNOWN;
+		}
 		request->private_callback.
 			lookup_credentials(result, credentials, size, request);
 	}
diff -r 4113324354f5 -r 627aeadb0955 src/auth/auth-request.h
--- a/src/auth/auth-request.h	Thu Dec 02 17:38:08 2010 +0000
+++ b/src/auth/auth-request.h	Thu Dec 02 19:10:23 2010 +0000
@@ -92,6 +92,7 @@
 	unsigned int successful:1;
 	unsigned int passdb_failure:1;
 	unsigned int internal_failure:1;
+	unsigned int passdb_user_unknown:1;
 	unsigned int passdb_internal_failure:1;
 	unsigned int userdb_internal_failure:1;
 	unsigned int delayed_failure:1;


More information about the dovecot-cvs mailing list