dovecot-2.2: auth: If blocking passdb returned only NULLs for us...
dovecot at dovecot.org
dovecot at dovecot.org
Fri Jul 12 02:43:58 EEST 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/2be295a0b64f
changeset: 16612:2be295a0b64f
user: Timo Sirainen <tss at iki.fi>
date: Fri Jul 12 02:43:43 2013 +0300
description:
auth: If blocking passdb returned only NULLs for userdb_ fields, use userdb prefetch anyway.
diffstat:
src/auth/auth-request.c | 5 ++---
src/auth/auth-request.h | 2 ++
src/auth/auth-worker-client.c | 26 +++++++++++++++++---------
3 files changed, 21 insertions(+), 12 deletions(-)
diffs (91 lines):
diff -r 86275093e7b3 -r 2be295a0b64f src/auth/auth-request.c
--- a/src/auth/auth-request.c Fri Jul 12 02:29:00 2013 +0300
+++ b/src/auth/auth-request.c Fri Jul 12 02:43:43 2013 +0300
@@ -32,7 +32,6 @@
#define AUTH_DNS_DEFAULT_TIMEOUT_MSECS (1000*10)
#define AUTH_DNS_WARN_MSECS 500
#define CACHED_PASSWORD_SCHEME "SHA1"
-#define AUTH_REQUEST_KEY_IGNORE " "
struct auth_request_proxy_dns_lookup_ctx {
struct auth_request *request;
@@ -928,7 +927,7 @@
if (str_len(str) == 0) {
/* no userdb fields. but we can't save an empty string,
since that means "user unknown". */
- str_append(str, AUTH_REQUEST_KEY_IGNORE);
+ str_append(str, AUTH_REQUEST_USER_KEY_IGNORE);
}
cache_value = str_c(str);
}
@@ -1520,7 +1519,7 @@
warned = TRUE;
}
name = "system_groups_user";
- } else if (strcmp(name, AUTH_REQUEST_KEY_IGNORE) == 0) {
+ } else if (strcmp(name, AUTH_REQUEST_USER_KEY_IGNORE) == 0) {
return;
}
diff -r 86275093e7b3 -r 2be295a0b64f src/auth/auth-request.h
--- a/src/auth/auth-request.h Fri Jul 12 02:29:00 2013 +0300
+++ b/src/auth/auth-request.h Fri Jul 12 02:43:43 2013 +0300
@@ -7,6 +7,8 @@
#include "userdb.h"
#include "passdb.h"
+#define AUTH_REQUEST_USER_KEY_IGNORE " "
+
struct auth_client_connection;
enum auth_request_state {
diff -r 86275093e7b3 -r 2be295a0b64f src/auth/auth-worker-client.c
--- a/src/auth/auth-worker-client.c Fri Jul 12 02:29:00 2013 +0300
+++ b/src/auth/auth-worker-client.c Fri Jul 12 02:43:43 2013 +0300
@@ -109,6 +109,21 @@
o_stream_nsend(client->output, str_data(str), str_len(str));
}
+static void
+reply_append_extra_fields(string_t *str, struct auth_request *request)
+{
+ if (!auth_fields_is_empty(request->extra_fields)) {
+ str_append_c(str, '\t');
+ auth_fields_append(request->extra_fields, str, 0, 0);
+ }
+ if (request->userdb_reply != NULL &&
+ auth_fields_is_empty(request->userdb_reply)) {
+ /* all userdb_* fields had NULL values. we'll still
+ need to tell this to the master */
+ str_append(str, "\tuserdb_"AUTH_REQUEST_USER_KEY_IGNORE);
+ }
+}
+
static void verify_plain_callback(enum passdb_result result,
struct auth_request *request)
{
@@ -131,10 +146,7 @@
str_append_c(str, '\t');
if (request->passdb_password != NULL)
str_append_tabescaped(str, request->passdb_password);
- if (!auth_fields_is_empty(request->extra_fields)) {
- str_append_c(str, '\t');
- auth_fields_append(request->extra_fields, str, 0, 0);
- }
+ reply_append_extra_fields(str, request);
}
str_append_c(str, '\n');
auth_worker_send_reply(client, str);
@@ -215,11 +227,7 @@
str_append_tabescaped(str, request->user);
str_printfa(str, "\t{%s.b64}", request->credentials_scheme);
base64_encode(credentials, size, str);
-
- if (!auth_fields_is_empty(request->extra_fields)) {
- str_append_c(str, '\t');
- auth_fields_append(request->extra_fields, str, 0, 0);
- }
+ reply_append_extra_fields(str, request);
}
str_append_c(str, '\n');
auth_worker_send_reply(client, str);
More information about the dovecot-cvs
mailing list