dovecot: Auth cache didn't work for usernames that got translate...
dovecot at dovecot.org
dovecot at dovecot.org
Fri Nov 2 17:09:50 EET 2007
details: http://hg.dovecot.org/dovecot/rev/d22888a77a1e
changeset: 6658:d22888a77a1e
user: Timo Sirainen <tss at iki.fi>
date: Fri Nov 02 17:09:46 2007 +0200
description:
Auth cache didn't work for usernames that got translated internally.
diffstat:
3 files changed, 10 insertions(+), 3 deletions(-)
src/auth/auth-cache.c | 6 +++---
src/auth/auth-request.c | 4 ++++
src/auth/auth-request.h | 3 +++
diffs (46 lines):
diff -r 5da6da5cea95 -r d22888a77a1e src/auth/auth-cache.c
--- a/src/auth/auth-cache.c Fri Nov 02 16:37:05 2007 +0200
+++ b/src/auth/auth-cache.c Fri Nov 02 17:09:46 2007 +0200
@@ -209,12 +209,12 @@ void auth_cache_insert(struct auth_cache
return;
}
- /* store into cache using the original username, except if we're doing
+ /* store into cache using the translated username, except if we're doing
a master user login */
current_username = request->user;
- if (request->original_username != NULL &&
+ if (request->translated_username != NULL &&
request->requested_login_user == NULL)
- request->user = t_strdup_noconst(request->original_username);
+ request->user = t_strdup_noconst(request->translated_username);
/* %! is prepended automatically. it contains the db ID number. */
str = t_str_new(256);
diff -r 5da6da5cea95 -r d22888a77a1e src/auth/auth-request.c
--- a/src/auth/auth-request.c Fri Nov 02 16:37:05 2007 +0200
+++ b/src/auth/auth-request.c Fri Nov 02 17:09:46 2007 +0200
@@ -803,6 +803,10 @@ bool auth_request_set_username(struct au
auth_request_log_debug(request, "auth",
"Invalid username: %s", str_sanitize(username, 128));
return FALSE;
+ }
+ if (request->translated_username == NULL) {
+ /* similar to original_username, but after translations */
+ request->translated_username = request->user;
}
if (login_username != NULL) {
diff -r 5da6da5cea95 -r d22888a77a1e src/auth/auth-request.h
--- a/src/auth/auth-request.h Fri Nov 02 16:37:05 2007 +0200
+++ b/src/auth/auth-request.h Fri Nov 02 17:09:46 2007 +0200
@@ -37,6 +37,9 @@ struct auth_request {
verification. however with master logins the master username has
been dropped from it. */
const char *original_username;
+ /* the username after doing all internal translations, but before
+ being changed by a db lookup */
+ const char *translated_username;
char *mech_password; /* set if verify_plain() is called */
char *passdb_password; /* set after password lookup if successful */
/* extra_fields are returned in authentication reply. Fields prefixed
More information about the dovecot-cvs
mailing list