changeset 4704:3bfd724bb37a HEAD

Fixes to handling blocking passdb (ie. MySQL) failures. It ignored any non-password related checks, such as allow_nets.
author Timo Sirainen <tss@iki.fi>
date Tue, 17 Oct 2006 14:26:43 +0300
parents 7c7faac6d801
children ff75a802b191
files src/auth/auth-worker-client.c src/auth/passdb-blocking.c
diffstat 2 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/auth-worker-client.c	Tue Oct 17 14:06:16 2006 +0300
+++ b/src/auth/auth-worker-client.c	Tue Oct 17 14:26:43 2006 +0300
@@ -78,6 +78,9 @@
 	struct auth_worker_client *client = request->context;
 	string_t *str;
 
+	if (request->passdb_failure && result == PASSDB_RESULT_OK)
+		result = PASSDB_RESULT_PASSWORD_MISMATCH;
+
 	str = t_str_new(64);
 	str_printfa(str, "%u\t", request->id);
 
@@ -158,6 +161,9 @@
 	struct auth_worker_client *client = request->context;
 	string_t *str;
 
+	if (request->passdb_failure && result == PASSDB_RESULT_OK)
+		result = PASSDB_RESULT_PASSWORD_MISMATCH;
+
 	str = t_str_new(64);
 	str_printfa(str, "%u\t", request->id);
 
--- a/src/auth/passdb-blocking.c	Tue Oct 17 14:06:16 2006 +0300
+++ b/src/auth/passdb-blocking.c	Tue Oct 17 14:26:43 2006 +0300
@@ -110,7 +110,7 @@
 	const char *password, *scheme;
 
 	result = check_failure(request, &reply);
-	if (result >= 0) {
+	if (result > 0) {
 		if (get_pass_reply(request, reply, &password, &scheme) < 0)
 			result = PASSDB_RESULT_INTERNAL_FAILURE;
 	}
@@ -137,10 +137,10 @@
 lookup_credentials_callback(struct auth_request *request, const char *reply)
 {
 	enum passdb_result result;
-	const char *password, *scheme;
+	const char *password = NULL, *scheme = NULL;
 
 	result = check_failure(request, &reply);
-	if (result >= 0) {
+	if (result > 0) {
 		if (get_pass_reply(request, reply, &password, &scheme) < 0)
 			result = PASSDB_RESULT_INTERNAL_FAILURE;
 	}