changeset 19110:b7f7ad2bc4d0

auth: If userdb lookup was found from auth cache, don't clear the earlier userdb fields.
author Timo Sirainen <tss@iki.fi>
date Mon, 07 Sep 2015 21:24:01 +0300
parents f3ed414944b8
children caaaa7c12edd
files src/auth/auth-request.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/auth-request.c	Mon Sep 07 21:02:51 2015 +0300
+++ b/src/auth/auth-request.c	Mon Sep 07 21:24:01 2015 +0300
@@ -1024,7 +1024,13 @@
 		return TRUE;
 	}
 
-	request->userdb_reply = auth_fields_init(request->pool);
+	/* We want to preserve any userdb fields set by the earlier passdb
+	   lookup, so initialize userdb_reply only if it doesn't exist.
+	   Don't use auth_request_init_userdb_reply(), because the entire
+	   userdb part of the result comes from the cache so we don't want to
+	   initialize it with default_fields. */
+	if (request->userdb_reply == NULL)
+		request->userdb_reply = auth_fields_init(request->pool);
 	auth_request_userdb_import(request, value);
 	*result_r = USERDB_RESULT_OK;
 	return TRUE;