changeset 22338:7a30ce5f35b6

virtual: Match any metadata condition The old code ignored succesful earlier matches for patterns, and stopped looking on first non-matching metadata pattern. Now it breaks on error or on first matching pattern.
author Aki Tuomi <aki.tuomi@dovecot.fi>
date Thu, 18 May 2017 14:59:51 +0300
parents 31d2459cfcf2
children d3dd6c5defe8
files src/plugins/virtual/virtual-config.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/virtual/virtual-config.c	Mon Jul 17 14:05:45 2017 +0300
+++ b/src/plugins/virtual/virtual-config.c	Thu May 18 14:59:51 2017 +0300
@@ -375,7 +375,8 @@
 	box = mailbox_alloc(info->ns->list, info->vname, MAILBOX_FLAG_READONLY);
 	mailbox_set_reason(box, "virtual mailbox metadata match");
 	for (i = 0; i < count; i++) {
-		if ((ret = virtual_config_box_metadata_match(box, boxes[i], error_r)) <= 0)
+		/* break on error or match */
+		if ((ret = virtual_config_box_metadata_match(box, boxes[i], error_r)) < 0 || ret > 0)
 			break;
 	}
 	mailbox_free(&box);