From bc2739c2649a2168c4c47501d014c6dd93f6e74e Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Thu, 2 Dec 2010 19:10:23 +0000 Subject: [PATCH] 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". --- src/auth/auth-request.c | 12 +++++++++++- src/auth/auth-request.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) 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; -- 2.47.3