dovecot: Transfer also userdb information from blocking passdb w...

dovecot at dovecot.org dovecot at dovecot.org
Mon Sep 17 11:15:54 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/fd7ffed49763
changeset: 6436:fd7ffed49763
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Sep 17 11:15:50 2007 +0300
description:
Transfer also userdb information from blocking passdb workers, so prefetch
doesn't break with auth cache.

diffstat:

2 files changed, 24 insertions(+), 17 deletions(-)
src/auth/auth-worker-client.c |   27 ++++++++++++++-------------
src/auth/passdb-blocking.c    |   14 ++++++++++----

diffs (69 lines):

diff -r 1672a4cb665e -r fd7ffed49763 src/auth/auth-worker-client.c
--- a/src/auth/auth-worker-client.c	Mon Sep 17 10:41:00 2007 +0300
+++ b/src/auth/auth-worker-client.c	Mon Sep 17 11:15:50 2007 +0300
@@ -93,12 +93,13 @@ static void verify_plain_callback(enum p
 	str = t_str_new(64);
 	str_printfa(str, "%u\t", request->id);
 
-	if (result != PASSDB_RESULT_OK) {
-		str_printfa(str, "FAIL\t%d\t", result);
-		if (request->passdb_password != NULL)
-			str_append(str, request->passdb_password);
-	} else {
-		str_append(str, "OK\t");
+	if (result == PASSDB_RESULT_INTERNAL_FAILURE)
+		str_printfa(str, "FAIL\t%d", result);
+	else {
+		if (result != PASSDB_RESULT_OK)
+			str_printfa(str, "FAIL\t%d\t", result);
+		else
+			str_append(str, "OK\t");
 		str_append(str, request->user);
 		str_append_c(str, '\t');
 		if (request->passdb_password != NULL)
@@ -110,13 +111,13 @@ static void verify_plain_callback(enum p
 				auth_stream_reply_export(request->userdb_reply);
 			add_userdb_replies(str, data);
 		}
-	}
-	if (request->extra_fields != NULL) {
-		const char *field =
-			auth_stream_reply_export(request->extra_fields);
-
-		str_append_c(str, '\t');
-		str_append(str, field);
+		if (request->extra_fields != NULL) {
+			const char *field =
+				auth_stream_reply_export(request->extra_fields);
+
+			str_append_c(str, '\t');
+			str_append(str, field);
+		}
 	}
 	str_append_c(str, '\n');
 	o_stream_send(client->output, str_data(str), str_len(str));
diff -r 1672a4cb665e -r fd7ffed49763 src/auth/passdb-blocking.c
--- a/src/auth/passdb-blocking.c	Mon Sep 17 10:41:00 2007 +0300
+++ b/src/auth/passdb-blocking.c	Mon Sep 17 11:15:50 2007 +0300
@@ -39,11 +39,17 @@ auth_worker_reply_parse(struct auth_requ
 		return PASSDB_RESULT_OK;
 	}
 
-	if (strcmp(*args, "FAIL") == 0 && args[1] != NULL && args[2] != NULL) {
-		/* FAIL \t result \t password [\t extra] */
+	if (strcmp(*args, "FAIL") == 0 && args[1] != NULL) {
+		/* FAIL \t result [\t user \t password [\t extra]] */
 		ret = atoi(args[1]);
-		if (ret != PASSDB_RESULT_OK) {
-			auth_worker_reply_parse_args(request, args + 2);
+		if (ret == PASSDB_RESULT_OK) {
+			/* shouldn't happen */
+		} else if (args[2] == NULL) {
+			/* internal failure most likely */
+			return ret;
+		} else if (args[3] != NULL) {
+			auth_request_set_field(request, "user", args[2], NULL);
+			auth_worker_reply_parse_args(request, args + 3);
 			return ret;
 		}
 	}


More information about the dovecot-cvs mailing list