dovecot-2.0: lda: If mail_debug=yes and no -d parameter is given...

dovecot at dovecot.org dovecot at dovecot.org
Tue Sep 21 16:04:27 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/942bb9258e49
changeset: 12140:942bb9258e49
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Sep 21 14:04:22 2010 +0100
description:
lda: If mail_debug=yes and no -d parameter is given, log where username is taken from.

diffstat:

 src/lda/main.c |  8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diffs (36 lines):

diff -r af45e2f36059 -r 942bb9258e49 src/lda/main.c
--- a/src/lda/main.c	Mon Sep 20 19:06:26 2010 +0100
+++ b/src/lda/main.c	Tue Sep 21 14:04:22 2010 +0100
@@ -221,6 +221,7 @@
 	struct istream *input;
 	struct mailbox_transaction_context *t;
 	struct mailbox_header_lookup_ctx *headers_ctx;
+	const char *user_source = "";
 	void **sets;
 	uid_t process_euid;
 	bool stderr_rejection = FALSE;
@@ -319,10 +320,12 @@
 		home = getenv("HOME");
 		if (user != NULL && home != NULL) {
 			/* no need for a pw lookup */
+			user_source = "USER environment";
 		} else if ((pw = getpwuid(process_euid)) != NULL) {
 			user = t_strdup(pw->pw_name);
 			if (home == NULL)
 				env_put(t_strconcat("HOME=", pw->pw_dir, NULL));
+			user_source = "passwd lookup for process euid";
 		} else if (user == NULL) {
 			i_fatal_status(EX_USAGE,
 				       "Couldn't lookup our username (uid=%s)",
@@ -356,6 +359,11 @@
 #endif
 	ctx.set = mail_storage_service_user_get_set(service_user)[1];
 
+	if (ctx.dest_user->mail_debug && *user_source != '\0') {
+		i_debug("userdb lookup skipped, username taken from %s",
+			user_source);
+	}
+
 	/* create a separate mail user for the internal namespace */
 	sets = master_service_settings_get_others(master_service);
 	raw_mail_user = mail_user_alloc(user, ctx.dest_user->set_info, sets[0]);


More information about the dovecot-cvs mailing list