dovecot-2.2: auth: Fixed userdb changing username via auth-worker
dovecot at dovecot.org
dovecot at dovecot.org
Fri Oct 23 12:21:29 UTC 2015
details: http://hg.dovecot.org/dovecot-2.2/rev/ce132257cbb5
changeset: 19331:ce132257cbb5
user: Timo Sirainen <tss at iki.fi>
date: Fri Oct 23 15:21:15 2015 +0300
description:
auth: Fixed userdb changing username via auth-worker
diffstat:
src/auth/auth-worker-client.c | 2 ++
src/auth/userdb-blocking.c | 11 +++++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
diffs (40 lines):
diff -r 3d576d682137 -r ce132257cbb5 src/auth/auth-worker-client.c
--- a/src/auth/auth-worker-client.c Thu Oct 22 16:59:01 2015 +0300
+++ b/src/auth/auth-worker-client.c Fri Oct 23 15:21:15 2015 +0300
@@ -373,6 +373,8 @@
break;
case USERDB_RESULT_OK:
str_append(str, "OK\t");
+ str_append_tabescaped(str, auth_request->user);
+ str_append_c(str, '\t');
auth_fields_append(auth_request->userdb_reply, str, 0, 0);
if (auth_request->userdb_lookup_tempfailed)
str_append(str, "\ttempfail");
diff -r 3d576d682137 -r ce132257cbb5 src/auth/userdb-blocking.c
--- a/src/auth/userdb-blocking.c Thu Oct 22 16:59:01 2015 +0300
+++ b/src/auth/userdb-blocking.c Fri Oct 23 15:21:15 2015 +0300
@@ -18,7 +18,7 @@
{
struct auth_request *request = context;
enum userdb_result result;
- const char *args;
+ const char *username, *args;
if (strncmp(reply, "FAIL\t", 5) == 0) {
result = USERDB_RESULT_INTERNAL_FAILURE;
@@ -28,7 +28,14 @@
args = reply + 9;
} else if (strncmp(reply, "OK\t", 3) == 0) {
result = USERDB_RESULT_OK;
- args = reply + 3;
+ username = reply + 3;
+ args = strchr(username, '\t');
+ if (args == NULL)
+ args = "";
+ else
+ username = t_strdup_until(username, args++);
+ if (strcmp(request->user, username) != 0)
+ request->user = p_strdup(request->pool, username);
} else {
result = USERDB_RESULT_INTERNAL_FAILURE;
i_error("BUG: auth-worker sent invalid user reply");
More information about the dovecot-cvs
mailing list