changeset 15545:75dc4cb4bfe0

expire plugin: Don't crash when doveadm is run with proxying
author Timo Sirainen <tss@iki.fi>
date Fri, 30 Nov 2012 03:14:10 +0200
parents f77e87298a66
children 75bfda4a7c6c
files src/doveadm/client-connection.c src/doveadm/doveadm-mail.h src/plugins/expire/doveadm-expire.c
diffstat 3 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/doveadm/client-connection.c	Thu Nov 29 12:43:54 2012 +0200
+++ b/src/doveadm/client-connection.c	Fri Nov 30 03:14:10 2012 +0200
@@ -57,6 +57,7 @@
 
 	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 |
--- a/src/doveadm/doveadm-mail.h	Thu Nov 29 12:43:54 2012 +0200
+++ b/src/doveadm/doveadm-mail.h	Fri Nov 30 03:14:10 2012 +0200
@@ -62,6 +62,8 @@
 	/* 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) */
--- a/src/plugins/expire/doveadm-expire.c	Thu Nov 29 12:43:54 2012 +0200
+++ b/src/plugins/expire/doveadm-expire.c	Fri Nov 30 03:14:10 2012 +0200
@@ -374,7 +374,10 @@
 	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");