Blame SOURCES/dovecot-2.2-e84555e6eb59.patch

386c00
386c00
# HG changeset patch
386c00
# User Timo Sirainen <tss@iki.fi>
386c00
# Date 1399020005 -10800
386c00
# Node ID e84555e6eb5927cf128d47bd324c83fdedc2cfeb
386c00
# Parent  99f59d6fce05bc6957c1f540de45bbe0eeb47738
386c00
auth: Fixed userdb extra fields handling in passdb failure.
386c00
userdb prefetch -flag wasn't correctly set, causing the prefetch userdb in
386c00
some situations incorrectly either to be called or not be called.
386c00
386c00
This also fixes a crash when using userdb static and multiple passdbs. The
386c00
userdb_reply was set to NULL, which caused a crash later.
386c00
386c00
diff -r 99f59d6fce05 -r e84555e6eb59 src/auth/auth-request.c
386c00
--- a/src/auth/auth-request.c	Fri May 02 11:12:58 2014 +0300
386c00
+++ b/src/auth/auth-request.c	Fri May 02 11:40:05 2014 +0300
386c00
@@ -625,21 +625,18 @@
386c00
 			/* this passdb lookup succeeded, preserve its extra
386c00
 			   fields */
386c00
 			auth_fields_snapshot(request->extra_fields);
386c00
-			request->snapshot_has_userdb_reply =
386c00
-				request->userdb_reply != NULL;
386c00
+			request->snapshot_have_userdb_prefetch_set =
386c00
+				request->userdb_prefetch_set;
386c00
 			if (request->userdb_reply != NULL)
386c00
 				auth_fields_snapshot(request->userdb_reply);
386c00
 		} else {
386c00
 			/* this passdb lookup failed, remove any extra fields
386c00
 			   it set */
386c00
 			auth_fields_rollback(request->extra_fields);
386c00
-			if (request->userdb_reply == NULL)
386c00
-				;
386c00
-			else if (request->snapshot_has_userdb_reply)
386c00
+			if (request->userdb_reply != NULL) {
386c00
 				auth_fields_rollback(request->userdb_reply);
386c00
-			else {
386c00
-				request->userdb_reply = NULL;
386c00
-				request->userdb_prefetch_set = FALSE;
386c00
+				request->userdb_prefetch_set =
386c00
+					request->snapshot_have_userdb_prefetch_set;
386c00
 			}
386c00
 		}
386c00
 
386c00
diff -r 99f59d6fce05 -r e84555e6eb59 src/auth/auth-request.h
386c00
--- a/src/auth/auth-request.h	Fri May 02 11:12:58 2014 +0300
386c00
+++ b/src/auth/auth-request.h	Fri May 02 11:40:05 2014 +0300
386c00
@@ -124,7 +124,7 @@
386c00
 	unsigned int prefer_plain_credentials:1;
386c00
 	unsigned int in_delayed_failure_queue:1;
386c00
 	unsigned int removed_from_handler:1;
386c00
-	unsigned int snapshot_has_userdb_reply:1;
386c00
+	unsigned int snapshot_have_userdb_prefetch_set:1;
386c00
 	/* each passdb lookup can update the current success-status using the
386c00
 	   result_* rules. the authentication succeeds only if this is TRUE
386c00
 	   at the end. mechanisms that don't require passdb, but do a passdb
386c00