dovecot-2.0: auth: Fixed userdb tempfail to work with blocking u...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Apr 14 16:07:13 EEST 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/093591e1110b
changeset: 11151:093591e1110b
user: Timo Sirainen <tss at iki.fi>
date: Wed Apr 14 16:06:59 2010 +0300
description:
auth: Fixed userdb tempfail to work with blocking userdbs.
diffstat:
src/auth/auth-request.c | 1 +
src/auth/auth-stream.c | 4 ++++
src/auth/auth-worker-client.c | 11 ++---------
src/auth/userdb-blocking.c | 3 +++
4 files changed, 10 insertions(+), 9 deletions(-)
diffs (72 lines):
diff -r 4f06636cd03f -r 093591e1110b src/auth/auth-request.c
--- 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;
diff -r 4f06636cd03f -r 093591e1110b src/auth/auth-stream.c
--- 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;
diff -r 4f06636cd03f -r 093591e1110b src/auth/auth-worker-client.c
--- 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');
diff -r 4f06636cd03f -r 093591e1110b src/auth/userdb-blocking.c
--- 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);
More information about the dovecot-cvs
mailing list