dovecot-2.0-pigeonhole: ManageSieve: fixed problems in previous ...
pigeonhole at rename-it.nl
pigeonhole at rename-it.nl
Sat Feb 19 09:49:31 EET 2011
details: http://hg.rename-it.nl/dovecot-2.0-pigeonhole/rev/b4f57b02d2ed
changeset: 1479:b4f57b02d2ed
user: Stephan Bosch <stephan at rename-it.nl>
date: Sat Feb 19 08:45:13 2011 +0100
description:
ManageSieve: fixed problems in previous change; utf-8 was actually denied completely.
diffstat:
src/lib-managesieve/managesieve-parser.c | 2 +-
src/lib-managesieve/managesieve-quote.c | 21 +++++++++++----------
2 files changed, 12 insertions(+), 11 deletions(-)
diffs (75 lines):
diff -r bd894c3cbf7b -r b4f57b02d2ed src/lib-managesieve/managesieve-parser.c
--- a/src/lib-managesieve/managesieve-parser.c Fri Feb 18 14:03:28 2011 +0100
+++ b/src/lib-managesieve/managesieve-parser.c Sat Feb 19 08:45:13 2011 +0100
@@ -280,7 +280,7 @@
continue;
}
- if ( !IS_SAFE_CHAR(data[i]) ) {
+ if ( (data[i] & 0x80) == 0 && !IS_SAFE_CHAR(data[i]) ) {
parser->error = "String contains invalid character.";
return FALSE;
}
diff -r bd894c3cbf7b -r b4f57b02d2ed src/lib-managesieve/managesieve-quote.c
--- a/src/lib-managesieve/managesieve-quote.c Fri Feb 18 14:03:28 2011 +0100
+++ b/src/lib-managesieve/managesieve-quote.c Sat Feb 19 08:45:13 2011 +0100
@@ -16,6 +16,7 @@
size_t value_len, bool compress_lwsp)
{
size_t i, extra = 0, escape = 0;
+ string_t *tmp;
bool
last_lwsp = TRUE,
literal = FALSE,
@@ -62,10 +63,10 @@
str_printfa(str, "{%"PRIuSIZE_T"}\r\n", value_len - extra);
}
+ tmp = t_str_new(value_len+escape+4);
if (!modify && (literal || escape == 0))
- str_append_n(str, value, value_len);
+ str_append_n(tmp, value, value_len);
else {
- string_t *unchecked = t_str_new(value_len+escape+4);
last_lwsp = TRUE;
for (i = 0; i < value_len; i++) {
switch (value[i]) {
@@ -73,30 +74,30 @@
case '\\':
last_lwsp = FALSE;
if (!literal)
- str_append_c(unchecked, '\\');
- str_append_c(unchecked, value[i]);
+ str_append_c(tmp, '\\');
+ str_append_c(tmp, value[i]);
break;
case ' ':
case '\t':
if (!last_lwsp || !compress_lwsp)
- str_append_c(unchecked, ' ');
+ str_append_c(tmp, ' ');
last_lwsp = TRUE;
break;
case 13:
case 10:
last_lwsp = TRUE;
- str_append_c(unchecked, value[i]);
+ str_append_c(tmp, value[i]);
break;
default:
last_lwsp = FALSE;
- str_append_c(unchecked, value[i]);
+ str_append_c(tmp, value[i]);
break;
}
}
+ }
- if ( uni_utf8_get_valid_data(str_data(unchecked), str_len(unchecked), str) )
- str_append_str(str, unchecked);
- }
+ if ( uni_utf8_get_valid_data(str_data(tmp), str_len(tmp), str) )
+ str_append_str(str, tmp);
if (!literal)
str_append_c(str, '"');
More information about the dovecot-cvs
mailing list