changeset 3606:8a8352cda514 HEAD

If passdb lookup fails with internal error, try other passdbs anyway before returning internal failure.
author Timo Sirainen <tss@iki.fi>
date Sat, 24 Sep 2005 13:50:38 +0300
parents c533051d19cd
children a2dd3d895e00
files src/auth/auth-request.c src/auth/auth-request.h
diffstat 2 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/auth-request.c	Sat Sep 24 13:49:55 2005 +0300
+++ b/src/auth/auth-request.c	Sat Sep 24 13:50:38 2005 +0300
@@ -237,9 +237,10 @@
 	}
 
 	if (result != PASSDB_RESULT_OK &&
-	    result != PASSDB_RESULT_INTERNAL_FAILURE &&
 	    request->passdb->next != NULL) {
 		/* try next passdb. */
+		if (result == PASSDB_RESULT_INTERNAL_FAILURE)
+			request->passdb_internal_failure = TRUE;
 		if (request->extra_fields != NULL)
 			auth_stream_reply_reset(request->extra_fields);
 
@@ -250,6 +251,13 @@
 		return;
 	}
 
+	if (request->passdb_internal_failure && result != PASSDB_RESULT_OK) {
+		/* one of the passdb lookups returned internal failure.
+		   it may have had the correct password, so return internal
+		   failure instead of plain failure. */
+		result = PASSDB_RESULT_INTERNAL_FAILURE;
+	}
+
 	auth_request_ref(request);
 	request->private_callback.verify_plain(result, request);
         safe_memset(request->mech_password, 0, strlen(request->mech_password));
--- a/src/auth/auth-request.h	Sat Sep 24 13:49:55 2005 +0300
+++ b/src/auth/auth-request.h	Sat Sep 24 13:50:38 2005 +0300
@@ -52,6 +52,7 @@
 
 	unsigned int successful:1;
 	unsigned int internal_failure:1;
+	unsigned int passdb_internal_failure:1;
 	unsigned int delayed_failure:1;
 	unsigned int accept_input:1;
 	unsigned int no_failure_delay:1;