dovecot-2.0: auth: passdb/userdb backends no longer know about s...

dovecot at dovecot.org dovecot at dovecot.org
Sat Mar 13 20:27:13 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/3d085b851db8
changeset: 10898:3d085b851db8
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Mar 13 20:16:12 2010 +0200
description:
auth: passdb/userdb backends no longer know about struct auth_passdb/auth_userdb.

diffstat:

 src/auth/auth-master-connection.c |   4 ++--
 src/auth/auth-worker-client.c     |   2 +-
 src/auth/auth.c                   |  12 ++++++------
 src/auth/passdb-bsdauth.c         |  11 +++++------
 src/auth/passdb-checkpassword.c   |   7 +++----
 src/auth/passdb-ldap.c            |   6 +++---
 src/auth/passdb-pam.c             |  10 ++++------
 src/auth/passdb-passwd-file.c     |  13 ++++++-------
 src/auth/passdb-sql.c             |   7 +++----
 src/auth/passdb-vpopmail.c        |   7 +++----
 src/auth/passdb.c                 |  23 +++++++++++------------
 src/auth/passdb.h                 |  13 +++++--------
 src/auth/userdb-blocking.c        |   6 +++---
 src/auth/userdb-blocking.h        |   2 +-
 src/auth/userdb-checkpassword.c   |   7 +++----
 src/auth/userdb-ldap.c            |  12 ++++++------
 src/auth/userdb-nss.c             |   3 +--
 src/auth/userdb-passwd-file.c     |  14 +++++++-------
 src/auth/userdb-passwd.c          |  11 +++++------
 src/auth/userdb-sql.c             |  13 ++++++-------
 src/auth/userdb-static.c          |   7 +++----
 src/auth/userdb-vpopmail.c        |   3 +--
 src/auth/userdb.c                 |  17 +++++++++--------
 src/auth/userdb.h                 |  13 ++++++-------
 24 files changed, 103 insertions(+), 120 deletions(-)

diffs (truncated from 746 to 300 lines):

diff -r 52eb8317514f -r 3d085b851db8 src/auth/auth-master-connection.c
--- a/src/auth/auth-master-connection.c	Sat Mar 13 20:00:32 2010 +0200
+++ b/src/auth/auth-master-connection.c	Sat Mar 13 20:16:12 2010 +0200
@@ -319,7 +319,7 @@
 		}
 
 		/* continue iterating next userdb */
-		ctx->iter = userdb_blocking_iter_init(ctx->userdb,
+		ctx->iter = userdb_blocking_iter_init(ctx->userdb->userdb,
 					master_input_list_callback, ctx);
 		userdb_blocking_iter_next(ctx->iter);
 		return;
@@ -372,7 +372,7 @@
 
 	io_remove(&conn->io);
 	o_stream_set_flush_callback(conn->output, master_output_list, ctx);
-	ctx->iter = userdb_blocking_iter_init(ctx->userdb,
+	ctx->iter = userdb_blocking_iter_init(ctx->userdb->userdb,
 					      master_input_list_callback, ctx);
 	return TRUE;
 }
diff -r 52eb8317514f -r 3d085b851db8 src/auth/auth-worker-client.c
--- a/src/auth/auth-worker-client.c	Sat Mar 13 20:00:32 2010 +0200
+++ b/src/auth/auth-worker-client.c	Sat Mar 13 20:16:12 2010 +0200
@@ -504,7 +504,7 @@
 				    auth_worker_list_output, ctx);
 	client->refcount++;
 	ctx->iter = ctx->userdb->iface->
-		iterate_init(userdb, list_iter_callback, ctx);
+		iterate_init(userdb->userdb, list_iter_callback, ctx);
 	ctx->userdb->iface->iterate_next(ctx->iter);
 }
 
diff -r 52eb8317514f -r 3d085b851db8 src/auth/auth.c
--- a/src/auth/auth.c	Sat Mar 13 20:00:32 2010 +0200
+++ b/src/auth/auth.c	Sat Mar 13 20:16:12 2010 +0200
@@ -204,11 +204,11 @@
 	const char *const *mechanisms;
 
 	for (passdb = auth->masterdbs; passdb != NULL; passdb = passdb->next)
-		passdb_init(passdb);
+		passdb_init(passdb->passdb, passdb->set);
 	for (passdb = auth->passdbs; passdb != NULL; passdb = passdb->next)
-		passdb_init(passdb);
+		passdb_init(passdb->passdb, passdb->set);
 	for (userdb = auth->userdbs; userdb != NULL; userdb = userdb->next)
-		userdb_init(userdb);
+		userdb_init(userdb->userdb, userdb->set);
 	/* caching is handled only by the main auth process */
 	if (!worker)
 		passdb_cache_init(auth->set);
@@ -248,11 +248,11 @@
 	*_auth = NULL;
 
 	for (passdb = auth->masterdbs; passdb != NULL; passdb = passdb->next)
-		passdb_deinit(passdb);
+		passdb_deinit(passdb->passdb);
 	for (passdb = auth->passdbs; passdb != NULL; passdb = passdb->next)
-		passdb_deinit(passdb);
+		passdb_deinit(passdb->passdb);
 	for (userdb = auth->userdbs; userdb != NULL; userdb = userdb->next)
-		userdb_deinit(userdb);
+		userdb_deinit(userdb->userdb);
 
 	auth_request_handler_deinit();
 	passdb_cache_deinit();
diff -r 52eb8317514f -r 3d085b851db8 src/auth/passdb-bsdauth.c
--- a/src/auth/passdb-bsdauth.c	Sat Mar 13 20:00:32 2010 +0200
+++ b/src/auth/passdb-bsdauth.c	Sat Mar 13 20:16:12 2010 +0200
@@ -49,17 +49,16 @@
 }
 
 static struct passdb_module *
-bsdauth_preinit(struct auth_passdb *auth_passdb, const char *args)
+bsdauth_preinit(pool_t pool, const char *args)
 {
 	struct passdb_module *module;
 
-	module = p_new(auth_passdb->pool, struct passdb_module, 1);
+	module = p_new(pool, struct passdb_module, 1);
 	module->default_pass_scheme = "PLAIN"; /* same reason as PAM */
 
-	if (strncmp(args, "cache_key=", 10) == 0) {
-		module->cache_key =
-			auth_cache_parse_key(auth_passdb->pool, args + 10);
-	} else if (*args != '\0')
+	if (strncmp(args, "cache_key=", 10) == 0)
+		module->cache_key = auth_cache_parse_key(pool, args + 10);
+	else if (*args != '\0')
 		i_fatal("passdb bsdauth: Unknown setting: %s", args);
 	return module;
 }
diff -r 52eb8317514f -r 3d085b851db8 src/auth/passdb-checkpassword.c
--- a/src/auth/passdb-checkpassword.c	Sat Mar 13 20:00:32 2010 +0200
+++ b/src/auth/passdb-checkpassword.c	Sat Mar 13 20:16:12 2010 +0200
@@ -235,13 +235,12 @@
 }
 
 static struct passdb_module *
-checkpassword_preinit(struct auth_passdb *auth_passdb, const char *args)
+checkpassword_preinit(pool_t pool, const char *args)
 {
 	struct checkpassword_passdb_module *module;
 
-	module = p_new(auth_passdb->pool,
-		       struct checkpassword_passdb_module, 1);
-	module->checkpassword_path = p_strdup(auth_passdb->pool, args);
+	module = p_new(pool, struct checkpassword_passdb_module, 1);
+	module->checkpassword_path = p_strdup(pool, args);
 	module->checkpassword_reply_path =
 		PKG_LIBEXECDIR"/checkpassword-reply";
 
diff -r 52eb8317514f -r 3d085b851db8 src/auth/passdb-ldap.c
--- a/src/auth/passdb-ldap.c	Sat Mar 13 20:00:32 2010 +0200
+++ b/src/auth/passdb-ldap.c	Sat Mar 13 20:16:12 2010 +0200
@@ -392,12 +392,12 @@
 }
 
 static struct passdb_module *
-passdb_ldap_preinit(struct auth_passdb *auth_passdb, const char *args)
+passdb_ldap_preinit(pool_t pool, const char *args)
 {
 	struct ldap_passdb_module *module;
 	struct ldap_connection *conn;
 
-	module = p_new(auth_passdb->pool, struct ldap_passdb_module, 1);
+	module = p_new(pool, struct ldap_passdb_module, 1);
 	module->conn = conn = db_ldap_init(args);
 	conn->pass_attr_map =
 		hash_table_create(default_pool, conn->pool, 0, str_hash,
@@ -407,7 +407,7 @@
 			  conn->pass_attr_map,
 			  conn->set.auth_bind ? "password" : NULL);
 	module->module.cache_key =
-		auth_cache_parse_key(auth_passdb->pool,
+		auth_cache_parse_key(pool,
 				     t_strconcat(conn->set.base,
 						 conn->set.pass_filter, NULL));
 	module->module.default_pass_scheme = conn->set.default_pass_scheme;
diff -r 52eb8317514f -r 3d085b851db8 src/auth/passdb-pam.c
--- a/src/auth/passdb-pam.c	Sat Mar 13 20:00:32 2010 +0200
+++ b/src/auth/passdb-pam.c	Sat Mar 13 20:16:12 2010 +0200
@@ -327,13 +327,13 @@
 }
 
 static struct passdb_module *
-pam_preinit(struct auth_passdb *auth_passdb, const char *args)
+pam_preinit(pool_t pool, const char *args)
 {
 	struct pam_passdb_module *module;
 	const char *const *t_args;
 	int i;
 
-	module = p_new(auth_passdb->pool, struct pam_passdb_module, 1);
+	module = p_new(pool, struct pam_passdb_module, 1);
 	module->service_name = "dovecot";
 	/* we're caching the password by using directly the plaintext password
 	   given by the auth mechanism */
@@ -351,8 +351,7 @@
 			module->pam_setcred = TRUE;
 		else if (strncmp(t_args[i], "cache_key=", 10) == 0) {
 			module->module.cache_key =
-				auth_cache_parse_key(auth_passdb->pool,
-						     t_args[i] + 10);
+				auth_cache_parse_key(pool, t_args[i] + 10);
 		} else if (strcmp(t_args[i], "blocking=yes") == 0) {
 			/* ignore, for backwards compatibility */
 		} else if (strcmp(t_args[i], "failure_show_msg=yes") == 0) {
@@ -363,8 +362,7 @@
 		} else if (strncmp(t_args[i], "max_requests=", 13) == 0) {
 			module->requests_left = atoi(t_args[i] + 13);
 		} else if (t_args[i+1] == NULL) {
-			module->service_name =
-				p_strdup(auth_passdb->pool, t_args[i]);
+			module->service_name = p_strdup(pool, t_args[i]);
 		} else {
 			i_fatal("passdb pam: Unknown setting: %s", t_args[i]);
 		}
diff -r 52eb8317514f -r 3d085b851db8 src/auth/passdb-passwd-file.c
--- a/src/auth/passdb-passwd-file.c	Sat Mar 13 20:00:32 2010 +0200
+++ b/src/auth/passdb-passwd-file.c	Sat Mar 13 20:16:12 2010 +0200
@@ -107,7 +107,7 @@
 }
 
 static struct passdb_module *
-passwd_file_preinit(struct auth_passdb *auth_passdb, const char *args)
+passwd_file_preinit(pool_t pool, const char *args)
 {
 	struct passwd_file_passdb_module *module;
 	const char *scheme = PASSWD_FILE_DEFAULT_SCHEME;
@@ -135,9 +135,9 @@
 			args++;
 
 		if (strcmp(key, "scheme") == 0)
-			scheme = p_strdup(auth_passdb->pool, value);
+			scheme = p_strdup(pool, value);
 		else if (strcmp(key, "username_format") == 0)
-			format = p_strdup(auth_passdb->pool, value);
+			format = p_strdup(pool, value);
 		else
 			i_fatal("passdb passwd-file: Unknown setting: %s", key);
 	}
@@ -145,16 +145,15 @@
 	if (*args == '\0')
 		i_fatal("passdb passwd-file: Missing args");
 
-	module = p_new(auth_passdb->pool, struct passwd_file_passdb_module, 1);
+	module = p_new(pool, struct passwd_file_passdb_module, 1);
 	module->pwf = db_passwd_file_init(args, format, FALSE,
 					  global_auth_settings->debug);
 
 	if (!module->pwf->vars)
 		module->module.cache_key = format;
 	else {
-		module->module.cache_key =
-			auth_cache_parse_key(auth_passdb->pool,
-				t_strconcat(format, module->pwf->path, NULL));
+		module->module.cache_key = auth_cache_parse_key(pool,
+			t_strconcat(format, module->pwf->path, NULL));
 	}
 
 	module->module.default_pass_scheme = scheme;
diff -r 52eb8317514f -r 3d085b851db8 src/auth/passdb-sql.c
--- a/src/auth/passdb-sql.c	Sat Mar 13 20:00:32 2010 +0200
+++ b/src/auth/passdb-sql.c	Sat Mar 13 20:16:12 2010 +0200
@@ -225,17 +225,16 @@
 }
 
 static struct passdb_module *
-passdb_sql_preinit(struct auth_passdb *auth_passdb, const char *args)
+passdb_sql_preinit(pool_t pool, const char *args)
 {
 	struct sql_passdb_module *module;
 	struct sql_connection *conn;
 
-	module = p_new(auth_passdb->pool, struct sql_passdb_module, 1);
+	module = p_new(pool, struct sql_passdb_module, 1);
 	module->conn = conn = db_sql_init(args);
 
 	module->module.cache_key =
-		auth_cache_parse_key(auth_passdb->pool,
-				     conn->set.password_query);
+		auth_cache_parse_key(pool, conn->set.password_query);
 	module->module.default_pass_scheme = conn->set.default_pass_scheme;
 	return &module->module;
 }
diff -r 52eb8317514f -r 3d085b851db8 src/auth/passdb-vpopmail.c
--- a/src/auth/passdb-vpopmail.c	Sat Mar 13 20:00:32 2010 +0200
+++ b/src/auth/passdb-vpopmail.c	Sat Mar 13 20:16:12 2010 +0200
@@ -159,20 +159,19 @@
 }
 
 static struct passdb_module *
-vpopmail_preinit(struct auth_passdb *auth_passdb, const char *args)
+vpopmail_preinit(pool_t pool, const char *args)
 {
 	struct vpopmail_passdb_module *module;
 	const char *const *tmp;
 
-	module = p_new(auth_passdb->pool, struct vpopmail_passdb_module, 1);
+	module = p_new(pool, struct vpopmail_passdb_module, 1);
 	module->module.default_pass_scheme = VPOPMAIL_DEFAULT_PASS_SCHEME;
 
 	tmp = t_strsplit_spaces(args, " ");
 	for (; *tmp != NULL; tmp++) {
 		if (strncmp(*tmp, "cache_key=", 10) == 0) {
 			module->module.cache_key =
-				auth_cache_parse_key(auth_passdb->pool,
-						     *tmp + 10);
+				auth_cache_parse_key(pool, *tmp + 10);
 		} else if (strncmp(*tmp, "webmail=", 8) == 0) {
 			if (net_addr2ip(*tmp + 8, &module->webmail_ip) < 0)
 				i_fatal("vpopmail: Invalid webmail IP address");
diff -r 52eb8317514f -r 3d085b851db8 src/auth/passdb.c
--- a/src/auth/passdb.c	Sat Mar 13 20:00:32 2010 +0200
+++ b/src/auth/passdb.c	Sat Mar 13 20:16:12 2010 +0200
@@ -154,8 +154,7 @@
 	callback(result, credentials, size, auth_request);
 }
 
-struct auth_passdb *
-passdb_preinit(struct auth *auth, struct auth_passdb_settings *set)
+void passdb_preinit(struct auth *auth, const struct auth_passdb_settings *set)
 {
 	static unsigned int auth_passdb_id = 0;
 	struct passdb_module_interface *iface;
@@ -187,26 +186,26 @@
 			p_new(auth->pool, struct passdb_module, 1);
 	} else {
 		auth_passdb->passdb =
-			iface->preinit(auth_passdb, set->args);
+			iface->preinit(auth->pool, set->args);
 	}
 	auth_passdb->passdb->id = ++auth_passdb_id;
 	auth_passdb->passdb->iface = *iface;
-	return auth_passdb;
 }
 
-void passdb_init(struct auth_passdb *passdb)
+void passdb_init(struct passdb_module *passdb,


More information about the dovecot-cvs mailing list