]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Don't assume original_username is always set.
authorTimo Sirainen <tss@iki.fi>
Sun, 26 Oct 2008 13:52:47 +0000 (15:52 +0200)
committerTimo Sirainen <tss@iki.fi>
Sun, 26 Oct 2008 13:52:47 +0000 (15:52 +0200)
--HG--
branch : HEAD

src/auth/passdb.c

index 12f841cd97bc67f6e087120ba7ac78977dd0c19e..b4772014103156b4d0e69ba19863fd889f56da15 100644 (file)
@@ -52,7 +52,7 @@ bool passdb_get_credentials(struct auth_request *auth_request,
                            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_request *auth_request,
 
                /* 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);