Mercurial > dovecot > core-2.2
changeset 11151:093591e1110b HEAD
auth: Fixed userdb tempfail to work with blocking userdbs.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 14 Apr 2010 16:06:59 +0300 |
parents | 4f06636cd03f |
children | e019febd7eb3 |
files | src/auth/auth-request.c src/auth/auth-stream.c src/auth/auth-worker-client.c src/auth/userdb-blocking.c |
diffstat | 4 files changed, 10 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/auth/auth-request.c Wed Apr 14 15:57:43 2010 +0300 +++ b/src/auth/auth-request.c Wed Apr 14 16:06:59 2010 +0300 @@ -1198,6 +1198,7 @@ value = dec2str(gid); } else if (strcmp(name, "tempfail") == 0) { request->userdb_lookup_failed = TRUE; + return; } else if (strcmp(name, "user") == 0) { auth_request_change_userdb_user(request, value); return;
--- a/src/auth/auth-stream.c Wed Apr 14 15:57:43 2010 +0300 +++ b/src/auth/auth-stream.c Wed Apr 14 16:06:59 2010 +0300 @@ -97,6 +97,10 @@ return NULL; else { keylen = strlen(key); + if (len == keylen) { + /* key without =value */ + return ""; + } i_assert(len > keylen); idx += keylen + 1; len -= keylen + 1;
--- a/src/auth/auth-worker-client.c Wed Apr 14 15:57:43 2010 +0300 +++ b/src/auth/auth-worker-client.c Wed Apr 14 16:06:59 2010 +0300 @@ -335,21 +335,12 @@ struct auth_worker_client *client = auth_request->context; struct auth_stream_reply *reply = auth_request->userdb_reply; string_t *str; - const char *value; - - if (auth_request->userdb_lookup_failed) - result = USERDB_RESULT_INTERNAL_FAILURE; str = t_str_new(128); str_printfa(str, "%u\t", auth_request->id); switch (result) { case USERDB_RESULT_INTERNAL_FAILURE: str_append(str, "FAIL\t"); - if (auth_request->userdb_lookup_failed) { - value = auth_stream_reply_find(reply, "reason"); - if (value != NULL) - str_printfa(str, "reason=%s", value); - } break; case USERDB_RESULT_USER_UNKNOWN: str_append(str, "NOTFOUND\t"); @@ -357,6 +348,8 @@ case USERDB_RESULT_OK: str_append(str, "OK\t"); str_append(str, auth_stream_reply_export(reply)); + if (auth_request->userdb_lookup_failed) + str_append(str, "\ttempfail"); break; } str_append_c(str, '\n');
--- a/src/auth/userdb-blocking.c Wed Apr 14 15:57:43 2010 +0300 +++ b/src/auth/userdb-blocking.c Wed Apr 14 16:06:59 2010 +0300 @@ -39,6 +39,9 @@ if (*args != '\0') { request->userdb_reply = auth_stream_reply_init(request->pool); auth_stream_reply_import(request->userdb_reply, args); + if (auth_stream_reply_find(request->userdb_reply, + "tempfail") != NULL) + request->userdb_lookup_failed = TRUE; } auth_request_userdb_callback(result, request);