changeset 12691:ed675e34dfa7

auth: Don't give an error if doing a passdb lookup and the result has NULL password.
author Timo Sirainen <tss@iki.fi>
date Sun, 09 Jan 2011 22:01:36 +0200
parents f043ef71b936
children 80c055dbea89
files src/auth/passdb.c
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/passdb.c	Sun Jan 09 21:37:24 2011 +0200
+++ b/src/auth/passdb.c	Sun Jan 09 22:01:36 2011 +0200
@@ -146,14 +146,18 @@
 		return;
 	}
 
-	if (password == NULL) {
+	if (password != NULL) {
+		if (!passdb_get_credentials(auth_request, password, scheme,
+					    &credentials, &size))
+			result = PASSDB_RESULT_SCHEME_NOT_AVAILABLE;
+	} else if (*auth_request->credentials_scheme == '\0') {
+		/* We're doing a passdb lookup (not authenticating).
+		   Pass through a NULL password without an error. */
+	} else {
 		auth_request_log_info(auth_request, "password",
 			"Requested %s scheme, but we have a NULL password",
 			auth_request->credentials_scheme);
 		result = PASSDB_RESULT_SCHEME_NOT_AVAILABLE;
-	} else if (!passdb_get_credentials(auth_request, password, scheme,
-					   &credentials, &size)) {
-		result = PASSDB_RESULT_SCHEME_NOT_AVAILABLE;
 	}
 
 	callback(result, credentials, size, auth_request);