From: Timo Sirainen Date: Wed, 24 Sep 2008 16:01:23 +0000 (+0300) Subject: Separate "unknown passdb/userdb X" and "support for X not compiled in" error messages. X-Git-Tag: 1.2.alpha2~31 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d5abbb932a0a598f002da39a8b3326643b1b5efc;p=thirdparty%2Fdovecot%2Fcore.git Separate "unknown passdb/userdb X" and "support for X not compiled in" error messages. --HG-- branch : HEAD --- diff --git a/src/auth/passdb-bsdauth.c b/src/auth/passdb-bsdauth.c index 5e33926ae2..12b850fa5f 100644 --- a/src/auth/passdb-bsdauth.c +++ b/src/auth/passdb-bsdauth.c @@ -1,11 +1,11 @@ /* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */ #include "common.h" +#include "passdb.h" #ifdef PASSDB_BSDAUTH #include "safe-memset.h" -#include "passdb.h" #include "mycrypt.h" #include @@ -78,5 +78,8 @@ struct passdb_module_interface passdb_bsdauth = { NULL, NULL }; - +#else +struct passdb_module_interface passdb_bsdauth = { + MEMBER(name) "bsdauth" +}; #endif diff --git a/src/auth/passdb-checkpassword.c b/src/auth/passdb-checkpassword.c index 76ffe4e93f..eb50b7cfd2 100644 --- a/src/auth/passdb-checkpassword.c +++ b/src/auth/passdb-checkpassword.c @@ -1,6 +1,7 @@ /* Copyright (c) 2004-2008 Dovecot authors, see the included COPYING file */ #include "common.h" +#include "passdb.h" #ifdef PASSDB_CHECKPASSWORD @@ -10,7 +11,6 @@ #include "ioloop.h" #include "hash.h" #include "env-util.h" -#include "passdb.h" #include "safe-memset.h" #include @@ -478,5 +478,8 @@ struct passdb_module_interface passdb_checkpassword = { NULL, NULL }; - +#else +struct passdb_module_interface passdb_checkpassword = { + MEMBER(name) "checkpassword" +}; #endif diff --git a/src/auth/passdb-ldap.c b/src/auth/passdb-ldap.c index 17b3a452d6..7c59add163 100644 --- a/src/auth/passdb-ldap.c +++ b/src/auth/passdb-ldap.c @@ -1,6 +1,7 @@ /* Copyright (c) 2003-2008 Dovecot authors, see the included COPYING file */ #include "common.h" +#include "passdb.h" #ifdef PASSDB_LDAP @@ -11,7 +12,6 @@ #include "password-scheme.h" #include "auth-cache.h" #include "db-ldap.h" -#include "passdb.h" #include #include @@ -430,5 +430,8 @@ struct passdb_module_interface passdb_ldap = { ldap_lookup_credentials, NULL }; - +#else +struct passdb_module_interface passdb_ldap = { + MEMBER(name) "ldap" +}; #endif diff --git a/src/auth/passdb-pam.c b/src/auth/passdb-pam.c index 8621fb1bac..0b847d0b50 100644 --- a/src/auth/passdb-pam.c +++ b/src/auth/passdb-pam.c @@ -8,6 +8,7 @@ */ #include "common.h" +#include "passdb.h" #ifdef PASSDB_PAM @@ -15,7 +16,6 @@ #include "str.h" #include "var-expand.h" #include "network.h" -#include "passdb.h" #include "safe-memset.h" #include "auth-cache.h" @@ -320,5 +320,8 @@ struct passdb_module_interface passdb_pam = { NULL, NULL }; - +#else +struct passdb_module_interface passdb_pam = { + MEMBER(name) "pam" +}; #endif diff --git a/src/auth/passdb-passwd-file.c b/src/auth/passdb-passwd-file.c index 3bc06d5e61..935c2e02b4 100644 --- a/src/auth/passdb-passwd-file.c +++ b/src/auth/passdb-passwd-file.c @@ -1,13 +1,13 @@ /* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */ #include "common.h" +#include "passdb.h" #ifdef PASSDB_PASSWD_FILE #include "str.h" #include "auth-cache.h" #include "var-expand.h" -#include "passdb.h" #include "password-scheme.h" #include "db-passwd-file.h" @@ -187,5 +187,8 @@ struct passdb_module_interface passdb_passwd_file = { passwd_file_lookup_credentials, NULL }; - +#else +struct passdb_module_interface passdb_passwd_file = { + MEMBER(name) "passwd-file" +}; #endif diff --git a/src/auth/passdb-passwd.c b/src/auth/passdb-passwd.c index 39862eeeda..fa50ea28a2 100644 --- a/src/auth/passdb-passwd.c +++ b/src/auth/passdb-passwd.c @@ -1,11 +1,11 @@ /* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */ #include "common.h" +#include "passdb.h" #ifdef PASSDB_PASSWD #include "safe-memset.h" -#include "passdb.h" #include @@ -83,4 +83,8 @@ struct passdb_module_interface passdb_passwd = { NULL }; +#else +struct passdb_module_interface passdb_passwd = { + MEMBER(name) "passwd" +}; #endif diff --git a/src/auth/passdb-shadow.c b/src/auth/passdb-shadow.c index 091a462d8f..04a95fd0cb 100644 --- a/src/auth/passdb-shadow.c +++ b/src/auth/passdb-shadow.c @@ -1,11 +1,11 @@ /* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */ #include "common.h" +#include "passdb.h" #ifdef PASSDB_SHADOW #include "safe-memset.h" -#include "passdb.h" #include @@ -82,5 +82,8 @@ struct passdb_module_interface passdb_shadow = { NULL, NULL }; - +#else +struct passdb_module_interface passdb_shadow = { + MEMBER(name) "shadow" +}; #endif diff --git a/src/auth/passdb-sia.c b/src/auth/passdb-sia.c index a4d8b320fe..a7ebae7146 100644 --- a/src/auth/passdb-sia.c +++ b/src/auth/passdb-sia.c @@ -3,11 +3,11 @@ /* Tru64 SIA support */ #include "common.h" +#include "passdb.h" #ifdef PASSDB_SIA #include "safe-memset.h" -#include "passdb.h" #include #include @@ -59,5 +59,8 @@ struct passdb_module_interface passdb_sia = { NULL, NULL }; - +#else +struct passdb_module_interface passdb_sia = { + MEMBER(name) "sia" +}; #endif diff --git a/src/auth/passdb-sql.c b/src/auth/passdb-sql.c index ac5e536212..c40f0937ca 100644 --- a/src/auth/passdb-sql.c +++ b/src/auth/passdb-sql.c @@ -1,6 +1,7 @@ /* Copyright (c) 2004-2008 Dovecot authors, see the included COPYING file */ #include "common.h" +#include "passdb.h" #ifdef PASSDB_SQL @@ -11,7 +12,6 @@ #include "password-scheme.h" #include "auth-cache.h" #include "db-sql.h" -#include "passdb.h" #include #include @@ -273,5 +273,8 @@ struct passdb_module_interface passdb_sql = { sql_lookup_credentials, sql_set_credentials }; - +#else +struct passdb_module_interface passdb_sql = { + MEMBER(name) "sql" +}; #endif diff --git a/src/auth/passdb-vpopmail.c b/src/auth/passdb-vpopmail.c index 47ed4a80bc..4f072f0004 100644 --- a/src/auth/passdb-vpopmail.c +++ b/src/auth/passdb-vpopmail.c @@ -3,11 +3,11 @@ /* Thanks to Courier-IMAP for showing how the vpopmail API should be used */ #include "common.h" +#include "passdb.h" #ifdef PASSDB_VPOPMAIL #include "safe-memset.h" -#include "passdb.h" #include "password-scheme.h" #include "auth-cache.h" @@ -194,5 +194,8 @@ struct passdb_module_interface passdb_vpopmail = { vpopmail_lookup_credentials, NULL }; - +#else +struct passdb_module_interface passdb_vpopmail = { + MEMBER(name) "vpopmail" +}; #endif diff --git a/src/auth/passdb.c b/src/auth/passdb.c index 2f320061ac..12f841cd97 100644 --- a/src/auth/passdb.c +++ b/src/auth/passdb.c @@ -139,10 +139,10 @@ struct auth_passdb *passdb_preinit(struct auth *auth, const char *driver, auth_passdb->id = id; iface = passdb_interface_find(driver); - if (iface == NULL) { - i_fatal("Unknown passdb driver '%s' " - "(typo, or Dovecot was built without support for it? " - "Check with dovecot --build-options)", + if (iface == NULL) + i_fatal("Unknown passdb driver '%s'", driver); + if (iface->verify_plain == NULL) { + i_fatal("Support not compiled in for passdb driver '%s'", driver); } @@ -191,36 +191,16 @@ extern struct passdb_module_interface passdb_sia; void passdbs_init(void) { i_array_init(&passdb_interfaces, 16); -#ifdef PASSDB_PASSWD passdb_register_module(&passdb_passwd); -#endif -#ifdef PASSDB_BSDAUTH passdb_register_module(&passdb_bsdauth); -#endif -#ifdef PASSDB_PASSWD_FILE passdb_register_module(&passdb_passwd_file); -#endif -#ifdef PASSDB_PAM passdb_register_module(&passdb_pam); -#endif -#ifdef PASSDB_CHECKPASSWORD passdb_register_module(&passdb_checkpassword); -#endif -#ifdef PASSDB_SHADOW passdb_register_module(&passdb_shadow); -#endif -#ifdef PASSDB_VPOPMAIL passdb_register_module(&passdb_vpopmail); -#endif -#if defined(PASSDB_LDAP) && defined(BUILTIN_LDAP) passdb_register_module(&passdb_ldap); -#endif -#ifdef PASSDB_SQL passdb_register_module(&passdb_sql); -#endif -#ifdef PASSDB_SIA passdb_register_module(&passdb_sia); -#endif } void passdbs_deinit(void) diff --git a/src/auth/userdb-ldap.c b/src/auth/userdb-ldap.c index 5d22a6f8e5..c6e488d0a3 100644 --- a/src/auth/userdb-ldap.c +++ b/src/auth/userdb-ldap.c @@ -1,6 +1,7 @@ /* Copyright (c) 2003-2008 Dovecot authors, see the included COPYING file */ #include "common.h" +#include "userdb.h" #ifdef USERDB_LDAP @@ -9,7 +10,6 @@ #include "var-expand.h" #include "auth-cache.h" #include "db-ldap.h" -#include "userdb.h" #include #include @@ -161,5 +161,8 @@ struct userdb_module_interface userdb_ldap = { userdb_ldap_lookup }; - +#else +struct userdb_module_interface userdb_ldap = { + MEMBER(name) "ldap" +}; #endif diff --git a/src/auth/userdb-nss.c b/src/auth/userdb-nss.c index acc2f4976b..fae6cab441 100644 --- a/src/auth/userdb-nss.c +++ b/src/auth/userdb-nss.c @@ -3,11 +3,11 @@ /* Currently supports only GLIBC-compatible NSS modules */ #include "common.h" +#include "userdb.h" #ifdef USERDB_NSS #include "module-dir.h" -#include "userdb.h" #include #include @@ -148,5 +148,8 @@ struct userdb_module_interface userdb_nss = { userdb_nss_lookup }; - +#else +struct userdb_module_interface userdb_nss = { + MEMBER(name) "nss" +}; #endif diff --git a/src/auth/userdb-passwd-file.c b/src/auth/userdb-passwd-file.c index 0b61fba2c2..5e2635a9d3 100644 --- a/src/auth/userdb-passwd-file.c +++ b/src/auth/userdb-passwd-file.c @@ -1,13 +1,13 @@ /* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */ #include "common.h" +#include "userdb.h" #ifdef USERDB_PASSWD_FILE #include "str.h" #include "auth-cache.h" #include "var-expand.h" -#include "userdb.h" #include "db-passwd-file.h" #define PASSWD_FILE_CACHE_KEY "%u" @@ -137,5 +137,8 @@ struct userdb_module_interface userdb_passwd_file = { passwd_file_lookup }; - +#else +struct userdb_module_interface userdb_passwd_file = { + MEMBER(name) "passwd-file" +}; #endif diff --git a/src/auth/userdb-passwd.c b/src/auth/userdb-passwd.c index c4767e9fd3..3720c7006b 100644 --- a/src/auth/userdb-passwd.c +++ b/src/auth/userdb-passwd.c @@ -1,10 +1,10 @@ /* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */ #include "common.h" +#include "userdb.h" #ifdef USERDB_PASSWD -#include "userdb.h" #include "userdb-static.h" #include @@ -92,5 +92,8 @@ struct userdb_module_interface userdb_passwd = { passwd_lookup }; - +#else +struct userdb_module_interface userdb_passwd = { + MEMBER(name) "passwd" +}; #endif diff --git a/src/auth/userdb-prefetch.c b/src/auth/userdb-prefetch.c index 7471b9a655..02b15a4e4b 100644 --- a/src/auth/userdb-prefetch.c +++ b/src/auth/userdb-prefetch.c @@ -1,12 +1,12 @@ /* Copyright (c) 2004-2008 Dovecot authors, see the included COPYING file */ #include "common.h" +#include "userdb.h" #ifdef USERDB_PREFETCH #include "str.h" #include "var-expand.h" -#include "userdb.h" #include @@ -44,5 +44,8 @@ struct userdb_module_interface userdb_prefetch = { prefetch_lookup }; - +#else +struct userdb_module_interface userdb_prefetch = { + MEMBER(name) "prefetch" +}; #endif diff --git a/src/auth/userdb-sql.c b/src/auth/userdb-sql.c index 7afb36f5ab..59401b9025 100644 --- a/src/auth/userdb-sql.c +++ b/src/auth/userdb-sql.c @@ -1,6 +1,7 @@ /* Copyright (c) 2004-2008 Dovecot authors, see the included COPYING file */ #include "common.h" +#include "userdb.h" #ifdef USERDB_SQL @@ -9,7 +10,6 @@ #include "var-expand.h" #include "auth-cache.h" #include "db-sql.h" -#include "userdb.h" #include #include @@ -151,5 +151,8 @@ struct userdb_module_interface userdb_sql = { userdb_sql_lookup }; - +#else +struct userdb_module_interface userdb_sql = { + MEMBER(name) "sql" +}; #endif diff --git a/src/auth/userdb-static.c b/src/auth/userdb-static.c index 3351f1385a..90d6507015 100644 --- a/src/auth/userdb-static.c +++ b/src/auth/userdb-static.c @@ -238,5 +238,8 @@ struct userdb_module_interface userdb_static = { static_lookup }; - +#else +struct userdb_module_interface userdb_static = { + MEMBER(name) "static" +}; #endif diff --git a/src/auth/userdb-vpopmail.c b/src/auth/userdb-vpopmail.c index c2e5103fd6..feabc18469 100644 --- a/src/auth/userdb-vpopmail.c +++ b/src/auth/userdb-vpopmail.c @@ -3,11 +3,11 @@ /* Thanks to Courier-IMAP for showing how the vpopmail API should be used */ #include "common.h" +#include "userdb.h" #if defined(PASSDB_VPOPMAIL) || defined(USERDB_VPOPMAIL) #include "str.h" #include "var-expand.h" -#include "userdb.h" #include "userdb-vpopmail.h" struct vpopmail_userdb_module { @@ -48,9 +48,9 @@ struct vqpasswd *vpopmail_lookup_vqp(struct auth_request *request, return vpw; } +#endif #ifdef USERDB_VPOPMAIL - static const char * userdb_vpopmail_get_quota(const char *template, const char *vpop_str) { @@ -172,6 +172,8 @@ struct userdb_module_interface userdb_vpopmail = { vpopmail_lookup }; - -#endif +#else +struct userdb_module_interface userdb_vpopmail = { + MEMBER(name) "vpopmail" +}; #endif diff --git a/src/auth/userdb.c b/src/auth/userdb.c index 9e9ddd0e7d..bcb0c602c3 100644 --- a/src/auth/userdb.c +++ b/src/auth/userdb.c @@ -116,10 +116,10 @@ void userdb_preinit(struct auth *auth, const char *driver, const char *args) *dest = auth_userdb; iface = userdb_interface_find(driver); - if (iface == NULL) { - i_fatal("Unknown userdb driver '%s' " - "(typo, or Dovecot was built without support for it? " - "Check with dovecot --build-options)", + if (iface == NULL) + i_fatal("Unknown userdb driver '%s'", driver); + if (iface->lookup == NULL) { + i_fatal("Support not compiled in for userdb driver '%s'", driver); } @@ -162,30 +162,14 @@ extern struct userdb_module_interface userdb_nss; void userdbs_init(void) { i_array_init(&userdb_interfaces, 16); -#ifdef USERDB_PASSWD userdb_register_module(&userdb_passwd); -#endif -#ifdef USERDB_PASSWD_FILE userdb_register_module(&userdb_passwd_file); -#endif -#ifdef USERDB_PREFETCH userdb_register_module(&userdb_prefetch); -#endif -#ifdef USERDB_STATIC userdb_register_module(&userdb_static); -#endif -#ifdef USERDB_VPOPMAIL userdb_register_module(&userdb_vpopmail); -#endif -#if defined(USERDB_LDAP) && defined(BUILTIN_LDAP) userdb_register_module(&userdb_ldap); -#endif -#ifdef USERDB_SQL userdb_register_module(&userdb_sql); -#endif -#ifdef USERDB_NSS userdb_register_module(&userdb_nss); -#endif } void userdbs_deinit(void)