dovecot-2.2: auth: Ignore first passdbs that contain skip=unauth...

dovecot at dovecot.org dovecot at dovecot.org
Mon Sep 7 14:11:22 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/757a566a0d1c
changeset: 19106:757a566a0d1c
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Sep 07 17:10:19 2015 +0300
description:
auth: Ignore first passdbs that contain skip=unauthenticated.
They can never match anything.

diffstat:

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

diffs (29 lines):

diff -r 2e420ceaee1d -r 757a566a0d1c src/auth/auth.c
--- a/src/auth/auth.c	Mon Sep 07 16:39:28 2015 +0300
+++ b/src/auth/auth.c	Mon Sep 07 17:10:19 2015 +0300
@@ -227,6 +227,13 @@
 		if (passdbs[i]->master)
 			continue;
 
+		/* passdb { skip=unauthenticated } as the first passdb doesn't
+		   make sense, since user is never authenticated at that point.
+		   skip over them silently. */
+		if (auth->passdbs == NULL &&
+		    auth_passdb_skip_parse(passdbs[i]->skip) == AUTH_PASSDB_SKIP_UNAUTHENTICATED)
+			continue;
+
 		auth_passdb_preinit(auth, passdbs[i], &auth->passdbs);
 		passdb_count++;
 		last_passdb = i;
@@ -238,6 +245,11 @@
 		if (!passdbs[i]->master)
 			continue;
 
+		/* skip skip=unauthenticated, as explained above */
+		if (auth->masterdbs == NULL &&
+		    auth_passdb_skip_parse(passdbs[i]->skip) == AUTH_PASSDB_SKIP_UNAUTHENTICATED)
+			continue;
+
 		if (passdbs[i]->deny)
 			i_fatal("Master passdb can't have deny=yes");
 		if (passdbs[i]->pass && passdb_count == 0) {


More information about the dovecot-cvs mailing list