dovecot-2.2-pigeonhole: Merged changes from Pigeonhole v0.3 tree.

pigeonhole at rename-it.nl pigeonhole at rename-it.nl
Mon Nov 11 02:44:29 EET 2013


details:   http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/16671ce66f75
changeset: 1819:16671ce66f75
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Mon Nov 11 01:44:19 2013 +0100
description:
Merged changes from Pigeonhole v0.3 tree.

diffstat:

 .hgsigs                                          |   1 +
 .hgtags                                          |   1 +
 NEWS                                             |  12 +++++
 src/lib-sieve/plugins/notify/ext-notify-common.c |  12 ++--
 src/lib-sievestorage/sieve-storage-script.c      |  51 +++++++++++++++++++++++-
 tests/deprecated/notify/basic.svtest             |  48 ++++++++++++++++++++++
 6 files changed, 117 insertions(+), 8 deletions(-)

diffs (207 lines):

diff -r 58e6a73e5bc6 -r 16671ce66f75 .hgsigs
--- a/.hgsigs	Sun Nov 03 02:02:56 2013 +0100
+++ b/.hgsigs	Mon Nov 11 01:44:19 2013 +0100
@@ -9,6 +9,7 @@
 64474c35967852bc452f71bc099ec3f8ded0369a 0 iQEcBAABAgAGBQJQWMvhAAoJEATWKx49+7T0NrYH/2PQuuFqzlku+NG8Iw0UN2yeDEML+2n1xG31ud7m3sNWw8lX+03gEd+LU8+LygHJJ0IAde/jBYRBbC8zj9UXDl3v5FIRwhcvGnllBCMMH7motfg+aLrCR/xs+0jV/AqpRin1VILHYFaB9UFP5PUgvJJiCUniQWoe+r41gra1hRA7OK3923YOOi9t4zJxoat7e0OMhc0IcdB7n3iQmyicbb8izKw/UvR2tR3T7fVcEl6u1LlbGaojtJA03V1L+a8QkmltiurD9VNmiHz++bGGJlA7LSmVYBq7BeC1lDnXUGO9ryZgln6aXRwUS0VaTI51F9gSMw+0UDJCwA5yBKqYyR8=
 4932026768454443d87d2e6445552b331589dbb1 0 iQEcBAABAgAGBQJRYIePAAoJEATWKx49+7T0p2oH/ROhjt/m+wZmT9+2NxEDwnaOoQ8m9TxkZiZ50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ZTCyHvqOCHj6sRTJtc7GP1cdFXzYo7yIGg+W1hZn7yBB32p6stE+9SurxinK312LGFvBRrJ9t7y9gIeP1aV9yd0AhTorAP0XsOMflNQnnxsNXR/8LhwsqpOt9TR8hTVdGZHi2ZqjqK37/XAGYAJpBvpQRFq2UPWj6fEGNRLsh9TzGodQh/RoESvTeoHpEVy5o2yHUcnY71bYfMpb2IJH7NHKAA=
diff -r 58e6a73e5bc6 -r 16671ce66f75 .hgtags
--- a/.hgtags	Sun Nov 03 02:02:56 2013 +0100
+++ b/.hgtags	Mon Nov 11 01:44:19 2013 +0100
@@ -15,6 +15,7 @@
 64474c35967852bc452f71bc099ec3f8ded0369a 0.3.3
 4932026768454443d87d2e6445552b331589dbb1 0.3.4
 374ec93999588b1acc554f81f61c93bf9fad7037 0.3.5
+87d8f0aae957ad290ea2e10033ce9ef70b291bb4 0.3.6
 3a8dc1250e9b850044acbcd9d63d63597e67c7cb 0.4.0
 f1535e2255cd84849d8b4fad6d82bdd6e01f810f 0.4.1
 2176d400eca4fa5d89597793a09c0b194eaed05f 0.4.2
diff -r 58e6a73e5bc6 -r 16671ce66f75 NEWS
--- a/NEWS	Sun Nov 03 02:02:56 2013 +0100
+++ b/NEWS	Mon Nov 11 01:44:19 2013 +0100
@@ -56,6 +56,18 @@
 	  possible. Environment items "location", "phase" and "domain" now also
 	  return a usable value.
 
+v0.3.6 26-09-2013 Stephan Bosch <stephan at rename-it.nl>
+
+	- Fixed a binary code read problem in the `set' command of the Sieve variables
+	  extension. Using the set command with a modifier and an empty string value
+	  would cause code corruption problems while running the script.
+	- Various fixes for compiler and static analyzer warnings, as reported
+	  by CLang.
+	- ManageSieve: Fixed '[' ']' stupidity for response codes (only happened
+	  before login).
+	- Fixed setting name in example-config/conf.d/20-managesieve.conf.
+	- Fixed messed up hex output for sieve-dump tool.
+
 v0.3.5 09-05-2013 Stephan Bosch <stephan at rename-it.nl>
 
 	- Sieve editheader extension: fixed interaction with the Sieve body extension.
diff -r 58e6a73e5bc6 -r 16671ce66f75 src/lib-sieve/plugins/notify/ext-notify-common.c
--- a/src/lib-sieve/plugins/notify/ext-notify-common.c	Sun Nov 03 02:02:56 2013 +0100
+++ b/src/lib-sieve/plugins/notify/ext-notify-common.c	Mon Nov 11 01:44:19 2013 +0100
@@ -243,14 +243,14 @@
 	/* Scan message for substitutions */
 	p = msg_format;
 	while ( *p != '\0' ) {
-		const char *const *header;
+		const char *header;
 
 		if ( strncasecmp(p, "$from$", 6) == 0 ) {
 			p += 6;
 
-			/* Fetch sender from oriinal message */
-			if ( mail_get_headers_utf8(msgdata->mail, "from", &header) >= 0 )
-				 str_append(out_msg, header[0]);
+			/* Fetch sender from original message */
+			if ( mail_get_first_header_utf8(msgdata->mail, "from", &header) > 0 )
+				 str_append(out_msg, header);
 
 		} else if ( strncasecmp(p, "$env-from$", 10) == 0 ) {
 			p += 10;
@@ -262,8 +262,8 @@
 			p += 9;
 
 			/* Fetch sender from oriinal message */
-			if ( mail_get_headers_utf8(msgdata->mail, "subject", &header) >= 0 )
-				 str_append(out_msg, header[0]);
+			if ( mail_get_first_header_utf8(msgdata->mail, "subject", &header) > 0 )
+				 str_append(out_msg, header);
 
 		} else if ( strncasecmp(p, "$text", 5) == 0
 			&& (p[5] == '[' || p[5] == '$') ) {
diff -r 58e6a73e5bc6 -r 16671ce66f75 src/lib-sievestorage/sieve-storage-script.c
--- a/src/lib-sievestorage/sieve-storage-script.c	Sun Nov 03 02:02:56 2013 +0100
+++ b/src/lib-sievestorage/sieve-storage-script.c	Mon Nov 11 01:44:19 2013 +0100
@@ -31,6 +31,53 @@
 	struct sieve_storage *storage;
 };
 
+static int _file_path_cmp(const char *path1, const char *path2)
+{
+	const char *p1, *p2;
+	int ret;
+	
+	p1 = path1; p2 = path2;
+	if (*p2 == '\0' && p1 != '\0')
+		return 1;
+	if (*p1 == '\0' && p2 != '\0')
+		return -1;
+	if (*p1 == '/' && *p2 != '/')
+		return 1;
+	if (*p2 == '/' && *p1 != '/')
+		return -1;	
+	for (;;) {
+		const char *s1, *s2;
+		size_t size1, size2;
+
+		/* skip repeated slashes */
+		for (; *p1 == '/'; p1++);
+		for (; *p2 == '/'; p2++);	
+		/* check for end of comparison */
+		if (*p1 == '\0' || *p2 == '\0')
+			break;
+		/* mark start of path element */
+		s1 = p1;
+		s2 = p2;
+		/* scan to end of path elements */
+		for (; *p1 != '\0' && *p1 != '/'; p1++);
+		for (; *p2 != '\0' && *p2 != '/'; p2++);
+		/* compare sizes */
+		size1 = p1 - s1;
+		size2 = p2 - s2;
+		if (size1 != size2)
+			return size1 - size2;
+		/* compare */
+		if (size1 > 0 && (ret=memcmp(s1, s2, size1)) != 0)
+			return ret;
+	}
+	if (*p1 == '\0') {
+		if (*p2 == '\0')
+			return 0;
+		return -1;
+	}
+	return 1;
+}
+
 struct sieve_script *sieve_storage_script_init_from_path
 (struct sieve_storage *storage, const char *path,
 	const char *scriptname)
@@ -183,8 +230,8 @@
 	}
 
 	/* Check whether the path is any good */
-	if ( strcmp(scriptpath, storage->link_path) != 0 &&
-		strcmp(scriptpath, storage->dir) != 0 ) {
+	if ( _file_path_cmp(scriptpath, storage->link_path) != 0 &&
+		_file_path_cmp(scriptpath, storage->dir) != 0 ) {
 		i_warning
 			("sieve-storage: Active sieve script symlink %s is broken: "
 				"invalid/unknown path to storage (points to %s).",
diff -r 58e6a73e5bc6 -r 16671ce66f75 tests/deprecated/notify/basic.svtest
--- a/tests/deprecated/notify/basic.svtest	Sun Nov 03 02:02:56 2013 +0100
+++ b/tests/deprecated/notify/basic.svtest	Mon Nov 11 01:44:19 2013 +0100
@@ -1,5 +1,6 @@
 require "vnd.dovecot.testsuite";
 require "notify";
+require "body";
 
 test "Execute" {
 	/* Test to catch runtime segfaults */
@@ -8,4 +9,51 @@
 		:low
 		:method "mailto"
 		:options ["stephan at example.com", "stephan at example.org"];
+
+	if not test_result_execute {
+		test_fail "Execute failed";
+	}
 }
+
+test_result_reset;
+
+test_set "message" text:
+To: user at example.com
+From: stephan at example.org
+Subject: Mail
+
+Test!
+.
+;
+
+test "Substitutions" {
+	notify
+		:message "$from$: $subject$"
+		:options "stephan at example.com";
+	if not test_result_execute {
+		test_fail "Execute failed";
+	}
+	test_message :smtp 0;
+	if not body :contains "stephan at example.org: Mail" {
+		test_fail "Substitution failed";
+	}
+}
+
+test_result_reset;
+
+test_set "message" text:
+To: user at example.com
+
+Test!
+.
+;
+
+test "Empty substitutions" {
+	notify
+		:message "$from$: $subject$"
+		:options "stephan at example.com";
+	if not test_result_execute {
+		test_fail "Execute failed";
+	}
+}
+


More information about the dovecot-cvs mailing list