dovecot-1.2: Separate "unknown passdb/userdb X" and "support for...

dovecot at dovecot.org dovecot at dovecot.org
Wed Sep 24 19:01:27 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/c47b78e843aa
changeset: 8217:c47b78e843aa
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Sep 24 19:01:23 2008 +0300
description:
Separate "unknown passdb/userdb X" and "support for X not compiled in" error messages.

diffstat:

20 files changed, 99 insertions(+), 81 deletions(-)
src/auth/passdb-bsdauth.c       |    7 +++++--
src/auth/passdb-checkpassword.c |    7 +++++--
src/auth/passdb-ldap.c          |    7 +++++--
src/auth/passdb-pam.c           |    9 ++++++---
src/auth/passdb-passwd-file.c   |    7 +++++--
src/auth/passdb-passwd.c        |    6 +++++-
src/auth/passdb-shadow.c        |    7 +++++--
src/auth/passdb-sia.c           |    7 +++++--
src/auth/passdb-sql.c           |    7 +++++--
src/auth/passdb-vpopmail.c      |    7 +++++--
src/auth/passdb.c               |   28 ++++------------------------
src/auth/userdb-ldap.c          |    7 +++++--
src/auth/userdb-nss.c           |    7 +++++--
src/auth/userdb-passwd-file.c   |    7 +++++--
src/auth/userdb-passwd.c        |    7 +++++--
src/auth/userdb-prefetch.c      |    7 +++++--
src/auth/userdb-sql.c           |    7 +++++--
src/auth/userdb-static.c        |    5 ++++-
src/auth/userdb-vpopmail.c      |   10 ++++++----
src/auth/userdb.c               |   24 ++++--------------------

diffs (truncated from 593 to 300 lines):

diff -r 11ff5d768660 -r c47b78e843aa src/auth/passdb-bsdauth.c
--- a/src/auth/passdb-bsdauth.c	Tue Sep 23 19:58:07 2008 +0300
+++ b/src/auth/passdb-bsdauth.c	Wed Sep 24 19:01:23 2008 +0300
@@ -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 <login_cap.h>
@@ -78,5 +78,8 @@ struct passdb_module_interface passdb_bs
 	NULL,
 	NULL
 };
-
+#else
+struct passdb_module_interface passdb_bsdauth = {
+	MEMBER(name) "bsdauth"
+};
 #endif
diff -r 11ff5d768660 -r c47b78e843aa src/auth/passdb-checkpassword.c
--- a/src/auth/passdb-checkpassword.c	Tue Sep 23 19:58:07 2008 +0300
+++ b/src/auth/passdb-checkpassword.c	Wed Sep 24 19:01:23 2008 +0300
@@ -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 <stdlib.h>
@@ -478,5 +478,8 @@ struct passdb_module_interface passdb_ch
 	NULL,
 	NULL
 };
-
+#else
+struct passdb_module_interface passdb_checkpassword = {
+	MEMBER(name) "checkpassword"
+};
 #endif
diff -r 11ff5d768660 -r c47b78e843aa src/auth/passdb-ldap.c
--- a/src/auth/passdb-ldap.c	Tue Sep 23 19:58:07 2008 +0300
+++ b/src/auth/passdb-ldap.c	Wed Sep 24 19:01:23 2008 +0300
@@ -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 <ldap.h>
 #include <stdlib.h>
@@ -430,5 +430,8 @@ struct passdb_module_interface passdb_ld
 	ldap_lookup_credentials,
 	NULL
 };
-
+#else
+struct passdb_module_interface passdb_ldap = {
+	MEMBER(name) "ldap"
+};
 #endif
diff -r 11ff5d768660 -r c47b78e843aa src/auth/passdb-pam.c
--- a/src/auth/passdb-pam.c	Tue Sep 23 19:58:07 2008 +0300
+++ b/src/auth/passdb-pam.c	Wed Sep 24 19:01:23 2008 +0300
@@ -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_pa
 	NULL,
 	NULL
 };
-
-#endif
+#else
+struct passdb_module_interface passdb_pam = {
+	MEMBER(name) "pam"
+};
+#endif
diff -r 11ff5d768660 -r c47b78e843aa src/auth/passdb-passwd-file.c
--- a/src/auth/passdb-passwd-file.c	Tue Sep 23 19:58:07 2008 +0300
+++ b/src/auth/passdb-passwd-file.c	Wed Sep 24 19:01:23 2008 +0300
@@ -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_pa
 	passwd_file_lookup_credentials,
 	NULL
 };
-
+#else
+struct passdb_module_interface passdb_passwd_file = {
+	MEMBER(name) "passwd-file"
+};
 #endif
diff -r 11ff5d768660 -r c47b78e843aa src/auth/passdb-passwd.c
--- a/src/auth/passdb-passwd.c	Tue Sep 23 19:58:07 2008 +0300
+++ b/src/auth/passdb-passwd.c	Wed Sep 24 19:01:23 2008 +0300
@@ -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 <pwd.h>
 
@@ -83,4 +83,8 @@ struct passdb_module_interface passdb_pa
 	NULL
 };
 
+#else
+struct passdb_module_interface passdb_passwd = {
+	MEMBER(name) "passwd"
+};
 #endif
diff -r 11ff5d768660 -r c47b78e843aa src/auth/passdb-shadow.c
--- a/src/auth/passdb-shadow.c	Tue Sep 23 19:58:07 2008 +0300
+++ b/src/auth/passdb-shadow.c	Wed Sep 24 19:01:23 2008 +0300
@@ -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 <shadow.h>
 
@@ -82,5 +82,8 @@ struct passdb_module_interface passdb_sh
 	NULL,
 	NULL
 };
-
+#else
+struct passdb_module_interface passdb_shadow = {
+	MEMBER(name) "shadow"
+};
 #endif
diff -r 11ff5d768660 -r c47b78e843aa src/auth/passdb-sia.c
--- a/src/auth/passdb-sia.c	Tue Sep 23 19:58:07 2008 +0300
+++ b/src/auth/passdb-sia.c	Wed Sep 24 19:01:23 2008 +0300
@@ -3,11 +3,11 @@
 /* Tru64 SIA support */
 
 #include "common.h"
+#include "passdb.h"
 
 #ifdef PASSDB_SIA
 
 #include "safe-memset.h"
-#include "passdb.h"
 
 #include <sia.h>
 #include <siad.h>
@@ -59,5 +59,8 @@ struct passdb_module_interface passdb_si
 	NULL,
 	NULL
 };
-
+#else
+struct passdb_module_interface passdb_sia = {
+	MEMBER(name) "sia"
+};
 #endif
diff -r 11ff5d768660 -r c47b78e843aa src/auth/passdb-sql.c
--- a/src/auth/passdb-sql.c	Tue Sep 23 19:58:07 2008 +0300
+++ b/src/auth/passdb-sql.c	Wed Sep 24 19:01:23 2008 +0300
@@ -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 <stdlib.h>
 #include <string.h>
@@ -273,5 +273,8 @@ struct passdb_module_interface passdb_sq
 	sql_lookup_credentials,
 	sql_set_credentials
 };
-
+#else
+struct passdb_module_interface passdb_sql = {
+	MEMBER(name) "sql"
+};
 #endif
diff -r 11ff5d768660 -r c47b78e843aa src/auth/passdb-vpopmail.c
--- a/src/auth/passdb-vpopmail.c	Tue Sep 23 19:58:07 2008 +0300
+++ b/src/auth/passdb-vpopmail.c	Wed Sep 24 19:01:23 2008 +0300
@@ -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_vp
 	vpopmail_lookup_credentials,
 	NULL
 };
-
+#else
+struct passdb_module_interface passdb_vpopmail = {
+	MEMBER(name) "vpopmail"
+};
 #endif
diff -r 11ff5d768660 -r c47b78e843aa src/auth/passdb.c
--- a/src/auth/passdb.c	Tue Sep 23 19:58:07 2008 +0300
+++ b/src/auth/passdb.c	Wed Sep 24 19:01:23 2008 +0300
@@ -139,10 +139,10 @@ struct auth_passdb *passdb_preinit(struc
         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 @@ void passdbs_init(void)
 void passdbs_init(void)
 {
 	i_array_init(&passdb_interfaces, 16);
-#ifdef PASSDB_PASSWD
 	passdb_register_module(&passdb_passwd);
-#endif
-#ifdef PASSDB_BSDAUTH


More information about the dovecot-cvs mailing list