[dovecot-cvs] dovecot/src/auth mech.c,1.47,1.48 passdb.c,1.26,1.27

cras at dovecot.org cras at dovecot.org
Mon Dec 6 18:42:14 EET 2004


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

Modified Files:
	mech.c passdb.c 
Log Message:
Mechanism list / passdb compatibility checking wasn't working because we
were checking it before any mechanisms were initialized.



Index: mech.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/mech.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -d -r1.47 -r1.48
--- mech.c	21 Oct 2004 02:23:12 -0000	1.47
+++ mech.c	6 Dec 2004 16:42:12 -0000	1.48
@@ -11,6 +11,7 @@
 #include "var-expand.h"
 #include "auth-client-connection.h"
 #include "auth-master-connection.h"
+#include "passdb.h"
 #include "passdb-cache.h"
 
 #include <stdlib.h>
@@ -382,6 +383,24 @@
 	auth_failure_buf_flush();
 }
 
+static void mech_list_verify_passdb(struct passdb_module *passdb)
+{
+	struct mech_module_list *list;
+
+	for (list = mech_modules; list != NULL; list = list->next) {
+		if (list->module.passdb_need_plain &&
+		    passdb->verify_plain == NULL)
+			break;
+		if (list->module.passdb_need_credentials &&
+		    passdb->lookup_credentials == NULL)
+			break;
+	}
+
+	if (list != NULL) {
+		i_fatal("Passdb %s doesn't support %s method",
+			passdb->name, list->module.mech_name);
+	}
+}
 extern struct mech_module mech_plain;
 extern struct mech_module mech_login;
 extern struct mech_module mech_apop;
@@ -440,6 +459,7 @@
 
 	if (mech_modules == NULL)
 		i_fatal("No authentication mechanisms configured");
+	mech_list_verify_passdb(passdb);
 
 	/* get our realm - note that we allocate from data stack so
 	   this function should never be called inside I/O loop or anywhere

Index: passdb.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/passdb.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- passdb.c	6 Dec 2004 16:39:02 -0000	1.26
+++ passdb.c	6 Dec 2004 16:42:12 -0000	1.27
@@ -1,7 +1,6 @@
 /* Copyright (C) 2002-2003 Timo Sirainen */
 
 #include "common.h"
-#include "mech.h"
 #include "auth-module.h"
 #include "password-scheme.h"
 #include "passdb.h"
@@ -112,25 +111,6 @@
 	callback(password, auth_request);
 }
 
-static void mech_list_verify_passdb(struct passdb_module *passdb)
-{
-	struct mech_module_list *list;
-
-	for (list = mech_modules; list != NULL; list = list->next) {
-		if (list->module.passdb_need_plain &&
-		    passdb->verify_plain == NULL)
-			break;
-		if (list->module.passdb_need_credentials &&
-		    passdb->lookup_credentials == NULL)
-			break;
-	}
-
-	if (list != NULL) {
-		i_fatal("Passdb %s doesn't support %s method",
-			passdb->name, list->module.mech_name);
-	}
-}
-
 void passdb_preinit(void)
 {
 	struct passdb_module **p;
@@ -170,8 +150,6 @@
 
 	if (passdb->preinit != NULL)
 		passdb->preinit(passdb_args);
-
-	mech_list_verify_passdb(passdb);
 }
 
 void passdb_init(void)



More information about the dovecot-cvs mailing list