# HG changeset patch # User Timo Sirainen # Date 1102351332 -7200 # Node ID 6a6e794bb6d35af293d28b876c0d42581650b741 # Parent c7d426f8cb5823b13e1cbf3c26d1416328f6cf5f Mechanism list / passdb compatibility checking wasn't working because we were checking it before any mechanisms were initialized. diff -r c7d426f8cb58 -r 6a6e794bb6d3 src/auth/mech.c --- 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 @@ -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 diff -r c7d426f8cb58 -r 6a6e794bb6d3 src/auth/passdb.c --- 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)