dovecot-2.2: pop3-migration: Convert NULs to 0x80 chars in heade...

dovecot at dovecot.org dovecot at dovecot.org
Tue Feb 4 18:22:57 EET 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/3839e4e62413
changeset: 17123:3839e4e62413
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Feb 03 10:49:03 2014 -0500
description:
pop3-migration: Convert NULs to 0x80 chars in header when hashing.
This should help at least with Dovecot and I think also with UW-IMAP/POP3.

diffstat:

 src/plugins/pop3-migration/pop3-migration-plugin.c |  11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diffs (21 lines):

diff -r 18d0ce83bf7a -r 3839e4e62413 src/plugins/pop3-migration/pop3-migration-plugin.c
--- a/src/plugins/pop3-migration/pop3-migration-plugin.c	Mon Feb 03 10:47:31 2014 -0500
+++ b/src/plugins/pop3-migration/pop3-migration-plugin.c	Mon Feb 03 10:49:03 2014 -0500
@@ -142,6 +142,17 @@
 
 	sha1_init(&sha1_ctx);
 	while (i_stream_read_data(input, &data, &size, 0) > 0) {
+		/* if there are NULs in header, replace them with 0x80
+		   character. This is done by at least Dovecot IMAP and also
+		   POP3 with outlook-no-nuls workaround. */
+		while ((p = memchr(data, '\0', size)) != NULL) {
+			idx = p - data;
+			sha1_loop(&sha1_ctx, data, idx);
+			sha1_loop(&sha1_ctx, "\x80", 1);
+			i_assert(size > idx);
+			data += idx + 1;
+			size -= idx + 1;
+		}
 		sha1_loop(&sha1_ctx, data, size);
 		i_stream_skip(input, size);
 	}


More information about the dovecot-cvs mailing list