Mercurial > dovecot > original-hg > dovecot-1.2
changeset 6436:fd7ffed49763 HEAD
Transfer also userdb information from blocking passdb workers, so prefetch
doesn't break with auth cache.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 17 Sep 2007 11:15:50 +0300 |
parents | 1672a4cb665e |
children | 92bce6a3fdad |
files | src/auth/auth-worker-client.c src/auth/passdb-blocking.c |
diffstat | 2 files changed, 23 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/src/auth/auth-worker-client.c Mon Sep 17 10:41:00 2007 +0300 +++ b/src/auth/auth-worker-client.c Mon Sep 17 11:15:50 2007 +0300 @@ -93,12 +93,13 @@ str = t_str_new(64); str_printfa(str, "%u\t", request->id); - if (result != PASSDB_RESULT_OK) { - str_printfa(str, "FAIL\t%d\t", result); - if (request->passdb_password != NULL) - str_append(str, request->passdb_password); - } else { - str_append(str, "OK\t"); + if (result == PASSDB_RESULT_INTERNAL_FAILURE) + str_printfa(str, "FAIL\t%d", result); + else { + if (result != PASSDB_RESULT_OK) + str_printfa(str, "FAIL\t%d\t", result); + else + str_append(str, "OK\t"); str_append(str, request->user); str_append_c(str, '\t'); if (request->passdb_password != NULL) @@ -110,13 +111,13 @@ auth_stream_reply_export(request->userdb_reply); add_userdb_replies(str, data); } - } - if (request->extra_fields != NULL) { - const char *field = - auth_stream_reply_export(request->extra_fields); + if (request->extra_fields != NULL) { + const char *field = + auth_stream_reply_export(request->extra_fields); - str_append_c(str, '\t'); - str_append(str, field); + str_append_c(str, '\t'); + str_append(str, field); + } } str_append_c(str, '\n'); o_stream_send(client->output, str_data(str), str_len(str));
--- a/src/auth/passdb-blocking.c Mon Sep 17 10:41:00 2007 +0300 +++ b/src/auth/passdb-blocking.c Mon Sep 17 11:15:50 2007 +0300 @@ -39,11 +39,17 @@ return PASSDB_RESULT_OK; } - if (strcmp(*args, "FAIL") == 0 && args[1] != NULL && args[2] != NULL) { - /* FAIL \t result \t password [\t extra] */ + if (strcmp(*args, "FAIL") == 0 && args[1] != NULL) { + /* FAIL \t result [\t user \t password [\t extra]] */ ret = atoi(args[1]); - if (ret != PASSDB_RESULT_OK) { - auth_worker_reply_parse_args(request, args + 2); + if (ret == PASSDB_RESULT_OK) { + /* shouldn't happen */ + } else if (args[2] == NULL) { + /* internal failure most likely */ + return ret; + } else if (args[3] != NULL) { + auth_request_set_field(request, "user", args[2], NULL); + auth_worker_reply_parse_args(request, args + 3); return ret; } }