dovecot-1.2: Don't assume original_username is always set.

dovecot at dovecot.org dovecot at dovecot.org
Sun Oct 26 16:30:54 EET 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/28867a0ee182
changeset: 8345:28867a0ee182
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Oct 26 15:52:47 2008 +0200
description:
Don't assume original_username is always set.

diffstat:

1 file changed, 4 insertions(+), 3 deletions(-)
src/auth/passdb.c |    7 ++++---

diffs (24 lines):

diff -r 938700823522 -r 28867a0ee182 src/auth/passdb.c
--- a/src/auth/passdb.c	Sun Oct 26 15:52:07 2008 +0200
+++ b/src/auth/passdb.c	Sun Oct 26 15:52:47 2008 +0200
@@ -52,7 +52,7 @@ bool passdb_get_credentials(struct auth_
 			    const unsigned char **credentials_r, size_t *size_r)
 {
 	const char *wanted_scheme = auth_request->credentials_scheme;
-	const char *plaintext;
+	const char *plaintext, *username;
 	int ret;
 
 	ret = password_decode(input, input_scheme, credentials_r, size_r);
@@ -92,8 +92,9 @@ bool passdb_get_credentials(struct auth_
 
 		/* we can generate anything out of plaintext passwords */
 		plaintext = t_strndup(*credentials_r, *size_r);
-		if (!password_generate(plaintext,
-				       auth_request->original_username,
+		username = auth_request->original_username != NULL ?
+			auth_request->original_username : auth_request->user;
+		if (!password_generate(plaintext, username,
 				       wanted_scheme, credentials_r, size_r)) {
 			auth_request_log_error(auth_request, "password",
 				"Requested unknown scheme %s", wanted_scheme);


More information about the dovecot-cvs mailing list