dovecot-1.2: auth: Fixed prefetch userdb interaction with passdb...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jun 7 21:01:27 EEST 2010


details:   http://hg.dovecot.org/dovecot-1.2/rev/a3e4af3df83d
changeset: 9579:a3e4af3df83d
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Jun 07 19:01:23 2010 +0100
description:
auth: Fixed prefetch userdb interaction with passdb changing username.

diffstat:

 src/auth/auth-request.c |  20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diffs (44 lines):

diff -r 40fc39475d02 -r a3e4af3df83d src/auth/auth-request.c
--- a/src/auth/auth-request.c	Tue Jun 01 17:08:13 2010 +0100
+++ b/src/auth/auth-request.c	Mon Jun 07 19:01:23 2010 +0100
@@ -23,6 +23,8 @@
 #include <stdlib.h>
 #include <sys/stat.h>
 
+static void auth_request_userdb_reply_update_user(struct auth_request *request);
+
 struct auth_request *
 auth_request_new(struct auth *auth, const struct mech_module *mech,
 		 mech_callback_t *callback, void *context)
@@ -1025,6 +1027,10 @@
 				request->user, value);
 			request->user = p_strdup(request->pool, value);
 		}
+
+		if (request->userdb_reply != NULL)
+			auth_request_userdb_reply_update_user(request);
+
 		/* restore the original value so it gets saved correctly to
 		   cache. */
 		value = orig_value;
@@ -1101,6 +1107,20 @@
 	auth_stream_reply_add(request->userdb_reply, NULL, request->user);
 }
 
+static void auth_request_userdb_reply_update_user(struct auth_request *request)
+{
+	const char *str, *p;
+
+	str = t_strdup(auth_stream_reply_export(request->userdb_reply));
+
+	auth_stream_reply_reset(request->userdb_reply);
+	auth_stream_reply_add(request->userdb_reply, NULL, request->user);
+
+	p = strchr(str, '\t');
+	if (p != NULL)
+		auth_stream_reply_import(request->userdb_reply, p + 1);
+}
+
 static void
 auth_request_change_userdb_user(struct auth_request *request, const char *user)
 {


More information about the dovecot-cvs mailing list