From: Timo Sirainen Date: Tue, 21 Sep 2010 13:04:22 +0000 (+0100) Subject: lda: If mail_debug=yes and no -d parameter is given, log where username is taken... X-Git-Tag: 2.0.4~41 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c60ae7afb07bc78bbe382245ed6281338eafb372;p=thirdparty%2Fdovecot%2Fcore.git lda: If mail_debug=yes and no -d parameter is given, log where username is taken from. --- diff --git a/src/lda/main.c b/src/lda/main.c index 865f767ff3..82f4e19725 100644 --- a/src/lda/main.c +++ b/src/lda/main.c @@ -221,6 +221,7 @@ int main(int argc, char *argv[]) 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 @@ int main(int argc, char *argv[]) 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 @@ int main(int argc, char *argv[]) #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]);