dovecot-2.2: auth: Fixed caching empty userdb result.

dovecot at dovecot.org dovecot at dovecot.org
Tue May 28 16:30:43 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/c40d67ee9de2
changeset: 16406:c40d67ee9de2
user:      Timo Sirainen <tss at iki.fi>
date:      Tue May 28 16:30:38 2013 +0300
description:
auth: Fixed caching empty userdb result.

diffstat:

 src/auth/auth-request.c |  8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diffs (32 lines):

diff -r f9f6467001b9 -r c40d67ee9de2 src/auth/auth-request.c
--- a/src/auth/auth-request.c	Tue May 28 16:30:19 2013 +0300
+++ b/src/auth/auth-request.c	Tue May 28 16:30:38 2013 +0300
@@ -32,6 +32,7 @@
 #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;
@@ -923,6 +924,11 @@
 		auth_fields_append(request->userdb_reply, str,
 				   AUTH_FIELD_FLAG_CHANGED,
 				   AUTH_FIELD_FLAG_CHANGED);
+		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);
+		}
 		cache_value = str_c(str);
 	}
 	/* last_success has no meaning with userdb */
@@ -1503,6 +1509,8 @@
 			warned = TRUE;
 		}
 		name = "system_groups_user";
+	} else if (strcmp(name, AUTH_REQUEST_KEY_IGNORE) == 0) {
+		return;
 	}
 
 	auth_fields_add(request->userdb_reply, name, value, 0);


More information about the dovecot-cvs mailing list