[dovecot-cvs] dovecot/src/auth auth-request.c, 1.50, 1.51 auth.c, 1.26, 1.27 auth.h, 1.19, 1.20

cras at dovecot.org cras at dovecot.org
Sat Mar 25 12:22:09 EET 2006


Update of /var/lib/cvs/dovecot/src/auth
In directory talvi:/tmp/cvs-serv7832/src/auth

Modified Files:
	auth-request.c auth.c auth.h 
Log Message:
Removed master_no_passdb setting. Added pass setting which can be used to do
the same thing, and other things. Now setting pass=yes to a passdb continues
to next passdb if the lookup succeeded. This allows eg. requiring the user
to be in multiple passdbs, or doing a username conversion before running the
actual userdb, etc.



Index: auth-request.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/auth-request.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- auth-request.c	27 Feb 2006 18:46:29 -0000	1.50
+++ auth-request.c	25 Mar 2006 10:22:06 -0000	1.51
@@ -272,7 +272,7 @@
 	request->skip_password_check = TRUE;
 	request->passdb_password = NULL;
 
-	if (request->passdb->master_no_passdb) {
+	if (!request->passdb->pass) {
 		/* skip the passdb lookup, we're authenticated now. */
 		return TRUE;
 	}
@@ -307,6 +307,13 @@
 			/* this was a master user lookup. */
 			if (!auth_request_master_lookup_finish(request))
 				return FALSE;
+		} else {
+			if (request->passdb->pass) {
+				/* this wasn't the final passdb lookup,
+				   continue to next passdb */
+				request->passdb = request->passdb->next;
+				return FALSE;
+			}
 		}
 	} else if (request->passdb->next != NULL &&
 		   *result != PASSDB_RESULT_USER_DISABLED) {

Index: auth.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/auth.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- auth.c	20 Feb 2006 13:14:58 -0000	1.26
+++ auth.c	25 Mar 2006 10:22:06 -0000	1.27
@@ -34,6 +34,7 @@
 	t_push();
 	passdb_p = &auth->passdbs;
 	masterdb_p = &auth->masterdbs;
+	auth_passdb = NULL;
 	for (i = 1; ; i++) {
 		driver = getenv(t_strdup_printf("PASSDB_%u_DRIVER", i));
 		if (driver == NULL)
@@ -44,12 +45,11 @@
 
                 auth_passdb->deny =
                         getenv(t_strdup_printf("PASSDB_%u_DENY", i)) != NULL;
-                auth_passdb->master_no_passdb =
-                        getenv(t_strdup_printf("PASSDB_%u_MASTER_NO_PASSDB",
-                                               i)) != NULL;
+		auth_passdb->pass =
+                        getenv(t_strdup_printf("PASSDB_%u_PASS", i)) != NULL;
 
 		if (getenv(t_strdup_printf("PASSDB_%u_MASTER", i)) == NULL) {
-                        *passdb_p = auth_passdb;
+			*passdb_p = auth_passdb;
 			passdb_p = &auth_passdb->next;
                 } else {
 			if (auth_passdb->deny)
@@ -59,6 +59,8 @@
 			masterdb_p = &auth_passdb->next;
 		}
 	}
+	if (auth_passdb != NULL && auth_passdb->pass)
+		i_fatal("Last passdb can't have pass=yes");
 	t_pop();
 
 	t_push();

Index: auth.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/auth.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- auth.h	20 Feb 2006 13:14:58 -0000	1.19
+++ auth.h	25 Mar 2006 10:22:06 -0000	1.20
@@ -14,8 +14,8 @@
 #endif
         /* if user is found from this passdb, deny authentication immediately */
 	unsigned int deny:1;
-	/* masterdb: no passdb lookup for user wanted */
-	unsigned int master_no_passdb:1;
+	/* after a successful lookup, continue to next passdb */
+	unsigned int pass:1;
 };
 
 struct auth_userdb {



More information about the dovecot-cvs mailing list