From: Timo Sirainen Date: Thu, 2 Dec 2010 19:10:23 +0000 (+0000) Subject: auth: passdb credentials lookup fix when using multiple passdbs. X-Git-Tag: 2.0.8~22 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bc2739c2649a2168c4c47501d014c6dd93f6e74e;p=thirdparty%2Fdovecot%2Fcore.git 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". --- diff --git a/src/auth/auth-request.c b/src/auth/auth-request.c index 63ce67deb3..de592cf19c 100644 --- a/src/auth/auth-request.c +++ b/src/auth/auth-request.c @@ -440,7 +440,11 @@ auth_request_handle_passdb_callback(enum passdb_result *result, 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 @@ auth_request_lookup_credentials_finish(enum passdb_result result, "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 --git a/src/auth/auth-request.h b/src/auth/auth-request.h index eeadb799c1..42cffd12aa 100644 --- a/src/auth/auth-request.h +++ b/src/auth/auth-request.h @@ -92,6 +92,7 @@ struct auth_request { 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;