]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lda: If mail_debug=yes and no -d parameter is given, log where username is taken...
authorTimo Sirainen <tss@iki.fi>
Tue, 21 Sep 2010 13:04:22 +0000 (14:04 +0100)
committerTimo Sirainen <tss@iki.fi>
Tue, 21 Sep 2010 13:04:22 +0000 (14:04 +0100)
src/lda/main.c

index 865f767ff369a9324b784b6e29d83b90e29f169c..82f4e197258b59689e95cf1a2303c12cede04426 100644 (file)
@@ -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]);