]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm: Getting user from USER environment wasn't done in the right place.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 23 Mar 2016 01:08:06 +0000 (10:08 +0900)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 29 Mar 2016 08:21:11 +0000 (11:21 +0300)
doveadm_mail_cmdline_init() is also called when parsing commands from
doveadm-server. The USER environment is supposed to be read only from
doveadm command line.

src/doveadm/doveadm-mail.c
src/doveadm/doveadm.c

index 4ace372ef6a31a82c49e8a8f9895266edc613c0a..bcc03978a594a26934d216f806708d66ec0c27cb 100644 (file)
@@ -557,7 +557,6 @@ doveadm_mail_cmdline_init(const struct doveadm_mail_cmd *cmd)
        ctx->service_flags |= MAIL_STORAGE_SERVICE_FLAG_NO_LOG_INIT;
        if (doveadm_debug)
                ctx->service_flags |= MAIL_STORAGE_SERVICE_FLAG_DEBUG;
-       ctx->cur_username = getenv("USER");
        return ctx;
 }
 
@@ -933,7 +932,7 @@ doveadm_cmd_ver2_to_mail_cmd_wrapper(struct doveadm_cmd_context *cctx)
        };
 
        mctx = doveadm_mail_cmdline_init(&mail_cmd);
-
+       mctx->cur_username = cctx->username;
        mctx->iterate_all_users = FALSE;
        wildcard_user = NULL;
        p_array_init(&pargv, mctx->pool, 8);
index 80166c40f53d1c1970846b11f8eb95004945b79a..8eb04d7172276776c02e59999b74f4c7bdc7885f 100644 (file)
@@ -291,6 +291,7 @@ int main(int argc, char *argv[])
 
        memset(&cctx,0,sizeof(cctx));
        cctx.cli = TRUE;
+       cctx.username = getenv("USER");
 
        i_set_failure_exit_callback(failure_exit_callback);
        doveadm_dsync_main(&argc, &argv);