[dovecot-cvs] dovecot/src/lib-storage mail-search.c,1.19,1.20

tss-movial at dovecot.org tss-movial at dovecot.org
Tue Jun 20 18:16:39 EEST 2006


Update of /var/lib/cvs/dovecot/src/lib-storage
In directory talvi:/tmp/cvs-serv14347

Modified Files:
	mail-search.c 
Log Message:
NOT condition wasn't handled correctly in SEARCH.



Index: mail-search.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/mail-search.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- mail-search.c	13 Jan 2006 20:26:24 -0000	1.19
+++ mail-search.c	20 Jun 2006 15:16:34 -0000	1.20
@@ -46,7 +46,7 @@
 
 			if (subarg->result == -1)
 				arg->result = -1;
-			else if (subarg->result == arg->not) {
+			else if (subarg->result == 0) {
 				/* didn't match */
 				arg->result = 0;
 				break;
@@ -54,6 +54,8 @@
 
 			subarg = subarg->next;
 		}
+		if (arg->not && arg->result != -1)
+			arg->result = !arg->result;
 	} else if (arg->type == SEARCH_OR) {
 		/* OR-list of conditions */
 		i_assert(arg->value.subargs != NULL);
@@ -64,18 +66,18 @@
 			if (subarg->result == -1)
 				search_arg_foreach(subarg, callback, context);
 
-			if (subarg->result != -1) {
-				if (subarg->result == !arg->not) {
-					/* matched */
-					arg->result = 1;
-					break;
-				}
-			} else {
+			if (subarg->result == -1)
 				arg->result = -1;
+			else if (subarg->result > 0) {
+				/* matched */
+				arg->result = 1;
+				break;
 			}
 
 			subarg = subarg->next;
 		}
+		if (arg->not && arg->result != -1)
+			arg->result = !arg->result;
 	} else {
 		/* just a single condition */
 		callback(arg, context);



More information about the dovecot-cvs mailing list