changeset 2943:6a6e794bb6d3 HEAD

Mechanism list / passdb compatibility checking wasn't working because we were checking it before any mechanisms were initialized.
author Timo Sirainen <tss@iki.fi>
date Mon, 06 Dec 2004 18:42:12 +0200
parents c7d426f8cb58
children cd436a43dfd3
files src/auth/mech.c src/auth/passdb.c
diffstat 2 files changed, 20 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/src/auth/mech.c	Mon Dec 06 18:39:02 2004 +0200
+++ b/src/auth/mech.c	Mon Dec 06 18:42:12 2004 +0200
@@ -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
--- a/src/auth/passdb.c	Mon Dec 06 18:39:02 2004 +0200
+++ b/src/auth/passdb.c	Mon Dec 06 18:42:12 2004 +0200
@@ -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)