dovecot-2.0: lib-storage: Added no_userdb_lookup flag to storage...

dovecot at dovecot.org dovecot at dovecot.org
Mon Oct 18 20:30:45 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/27289650ed4c
changeset: 12302:27289650ed4c
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Oct 18 18:09:56 2010 +0100
description:
lib-storage: Added no_userdb_lookup flag to storage service lookups.

diffstat:

 src/lib-storage/mail-storage-service.c |  8 +++++---
 src/lib-storage/mail-storage-service.h |  3 +++
 2 files changed, 8 insertions(+), 3 deletions(-)

diffs (52 lines):

diff -r 17957b5082cd -r 27289650ed4c src/lib-storage/mail-storage-service.c
--- a/src/lib-storage/mail-storage-service.c	Mon Oct 18 16:51:12 2010 +0100
+++ b/src/lib-storage/mail-storage-service.c	Mon Oct 18 18:09:56 2010 +0100
@@ -633,7 +633,7 @@
 	/* settings reader may exec doveconf, which is going to clear
 	   environment, and if we're not doing a userdb lookup we want to
 	   use $HOME */
-	set_input.preserve_home = 
+	set_input.preserve_home =
 		(ctx->flags & MAIL_STORAGE_SERVICE_FLAG_USERDB_LOOKUP) == 0;
 	set_input.use_sysexits =
 		(ctx->flags & MAIL_STORAGE_SERVICE_FLAG_USE_SYSEXITS) != 0;
@@ -739,6 +739,8 @@
 				struct mail_storage_service_user **user_r,
 				const char **error_r)
 {
+	const bool userdb_lookup = !input->no_userdb_lookup &&
+		(ctx->flags & MAIL_STORAGE_SERVICE_FLAG_USERDB_LOOKUP) != 0;
 	struct mail_storage_service_user *user;
 	const char *username = input->username;
 	const struct setting_parser_info *user_info;
@@ -775,7 +777,7 @@
 	mail_storage_service_load_modules(ctx, user_info, user_set);
 
 	temp_pool = pool_alloconly_create("userdb lookup", 2048);
-	if ((ctx->flags & MAIL_STORAGE_SERVICE_FLAG_USERDB_LOOKUP) != 0) {
+	if (userdb_lookup) {
 		ret = service_auth_userdb_lookup(ctx, input, temp_pool,
 						 &username, &userdb_fields,
 						 error_r);
@@ -802,7 +804,7 @@
 
 	user->user_set = settings_parser_get_list(user->set_parser)[1];
 
-	if ((ctx->flags & MAIL_STORAGE_SERVICE_FLAG_USERDB_LOOKUP) == 0) {
+	if (!userdb_lookup) {
 		const char *home = getenv("HOME");
 		if (home != NULL)
 			set_keyval(ctx, user, "mail_home", home);
diff -r 17957b5082cd -r 27289650ed4c src/lib-storage/mail-storage-service.h
--- a/src/lib-storage/mail-storage-service.h	Mon Oct 18 16:51:12 2010 +0100
+++ b/src/lib-storage/mail-storage-service.h	Mon Oct 18 18:09:56 2010 +0100
@@ -41,6 +41,9 @@
 	struct ip_addr local_ip, remote_ip;
 
 	const char *const *userdb_fields;
+
+	/* override MAIL_STORAGE_SERVICE_FLAG_USERDB_LOOKUP for this lookup */
+	unsigned int no_userdb_lookup:1;
 };
 
 extern struct module *mail_storage_service_modules;


More information about the dovecot-cvs mailing list