]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
expire plugin: Don't crash when doveadm is run with proxying
authorTimo Sirainen <tss@iki.fi>
Fri, 30 Nov 2012 01:14:10 +0000 (03:14 +0200)
committerTimo Sirainen <tss@iki.fi>
Fri, 30 Nov 2012 01:14:10 +0000 (03:14 +0200)
src/doveadm/client-connection.c
src/doveadm/doveadm-mail.h
src/plugins/expire/doveadm-expire.c

index 163099d90b3eac271c965e922bfb1fdb515fe98d..ab17b1056fccd61be3f0c57ae2dff98eb2a8c86b 100644 (file)
@@ -57,6 +57,7 @@ doveadm_mail_cmd_server_parse(const char *cmd_name,
 
        ctx = doveadm_mail_cmd_init(cmd, set);
        ctx->full_args = (const void *)(argv + 1);
+       ctx->proxying = TRUE;
 
        ctx->service_flags |=
                MAIL_STORAGE_SERVICE_FLAG_NO_LOG_INIT |
index dc94045a2b46c8f8529d82dc57c973d84dbe7d38..d9f241f2c1999aaeb5d29cec30bd4da1618defa8 100644 (file)
@@ -62,6 +62,8 @@ struct doveadm_mail_cmd_context {
        /* if non-zero, exit with this code */
        int exit_code;
 
+       /* This command is being called by a remote doveadm client. */
+       unsigned int proxying:1;
        /* We're handling only a single user */
        unsigned int iterate_single_user:1;
        /* We're going through all users (not set for wildcard usernames) */
index 8a5fed168031170453cba98aa3bf74a7dc97f686..3ab3c3745906f0656ab61416d5ac7baa2a22f023 100644 (file)
@@ -374,7 +374,10 @@ static void doveadm_expire_mail_init(struct doveadm_mail_cmd_context *ctx)
        if (expire_dict == NULL)
                return;
 
-       if (ctx->iterate_single_user) {
+       /* doveadm proxying uses expire database only locally. the remote
+          doveadm handles each user one at a time (even though
+          iterate_single_user=FALSE) */
+       if (ctx->iterate_single_user || ctx->proxying) {
                if (doveadm_debug) {
                        i_debug("expire: Iterating only a single user, "
                                "ignoring expire database");