dovecot-2.2-pigeonhole: lib-sieve: redirect: Adjusted loop detec...

pigeonhole at rename-it.nl pigeonhole at rename-it.nl
Thu May 8 23:33:01 UTC 2014


details:   http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/3b6917a4807c
changeset: 1856:3b6917a4807c
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Fri May 09 01:32:52 2014 +0200
description:
lib-sieve: redirect: Adjusted loop detection to show leniency to resent messages.

diffstat:

 src/lib-sieve/cmd-redirect.c |  16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r 2a8af66dc66a -r 3b6917a4807c src/lib-sieve/cmd-redirect.c
--- a/src/lib-sieve/cmd-redirect.c	Thu May 08 21:23:24 2014 +0200
+++ b/src/lib-sieve/cmd-redirect.c	Fri May 09 01:32:52 2014 +0200
@@ -386,13 +386,21 @@
 	const struct sieve_message_data *msgdata = aenv->msgdata;
 	const struct sieve_script_env *senv = aenv->scriptenv;
 	const char *orig_recipient = sieve_message_get_orig_recipient(aenv->msgctx);
-	const char *dupeid;
+	const char *dupeid = NULL, *resent_id = NULL, *resent_from = NULL;
 	int ret;
 
 	/* Prevent mail loops if possible */
-	dupeid = msgdata->id == NULL ? NULL : t_strdup_printf
-		("%s-%s-%s", msgdata->id, orig_recipient, ctx->to_address);
-	if (dupeid != NULL) {
+	(void)mail_get_first_header(msgdata->mail, "resent-message-id", &resent_id);
+	if ( msgdata->id != NULL || resent_id != NULL ) {
+		if ( resent_id == NULL )
+			(void)mail_get_first_header(msgdata->mail, "resent-from", &resent_from);
+		dupeid = t_strdup_printf("%s-%s-%s-%s",
+			(msgdata->id == NULL ? "" : msgdata->id),
+			orig_recipient, ctx->to_address,
+			(resent_id != NULL ?	
+				resent_id : (resent_from == NULL ? "" : resent_from)));
+	}
+	if ( dupeid != NULL ) {
 		/* Check whether we've seen this message before */
 		if (sieve_action_duplicate_check(senv, dupeid, strlen(dupeid))) {
 			sieve_result_global_log(aenv, "discarded duplicate forward to <%s>",


More information about the dovecot-cvs mailing list