dovecot-1.1: auth: Using "username" or "domain" passdb fields ca...

dovecot at dovecot.org dovecot at dovecot.org
Sun Feb 1 00:14:13 EET 2009


details:   http://hg.dovecot.org/dovecot-1.1/rev/498022697a33
changeset: 8138:498022697a33
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Jan 31 20:14:06 2009 +0200
description:
auth: Using "username" or "domain" passdb fields caused problems with cache and blocking passdbs.

diffstat:

1 file changed, 5 insertions(+), 1 deletion(-)
src/auth/auth-request.c |    6 +++++-

diffs (30 lines):

diff -r f97cd7e3acda -r 498022697a33 src/auth/auth-request.c
--- a/src/auth/auth-request.c	Thu Jan 29 19:25:02 2009 -0500
+++ b/src/auth/auth-request.c	Sat Jan 31 20:14:06 2009 +0200
@@ -1006,7 +1006,7 @@ void auth_request_set_field(struct auth_
 			    const char *name, const char *value,
 			    const char *default_scheme)
 {
-	const char *p;
+	const char *p, *orig_value;
 
 	i_assert(*name != '\0');
 	i_assert(value != NULL);
@@ -1024,6 +1024,7 @@ void auth_request_set_field(struct auth_
 	if (strcmp(name, "user") == 0 ||
 	    strcmp(name, "username") == 0 || strcmp(name, "domain") == 0) {
 		/* update username */
+		orig_value = value;
 		if (strcmp(name, "username") == 0 &&
 		    strchr(value, '@') == NULL &&
 		    (p = strchr(request->user, '@')) != NULL) {
@@ -1054,6 +1055,9 @@ void auth_request_set_field(struct auth_
 				request->user, value);
 			request->user = p_strdup(request->pool, value);
 		}
+		/* restore the original value so it gets saved correctly to
+		   cache. */
+		value = orig_value;
 	} else if (strcmp(name, "nodelay") == 0) {
 		/* don't delay replying to client of the failure */
 		request->no_failure_delay = TRUE;


More information about the dovecot-cvs mailing list