dovecot-2.0: lda: Escape local-part if it begins/ends with '.'.
dovecot at dovecot.org
dovecot at dovecot.org
Wed Oct 14 23:35:22 EEST 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/b81f4a4076de
changeset: 10058:b81f4a4076de
user: Timo Sirainen <tss at iki.fi>
date: Wed Oct 14 16:35:16 2009 -0400
description:
lda: Escape local-part if it begins/ends with '.'.
diffstat:
1 file changed, 8 insertions(+), 6 deletions(-)
src/lda/main.c | 14 ++++++++------
diffs (25 lines):
diff -r 21a09d9105b2 -r b81f4a4076de src/lda/main.c
--- a/src/lda/main.c Wed Oct 14 15:45:52 2009 -0400
+++ b/src/lda/main.c Wed Oct 14 16:35:16 2009 -0400
@@ -49,13 +49,15 @@ static const char *escape_local_part(con
{
const char *p;
- /* if local_part isn't dot-atom-text, we need to return quoted-string */
+ /* if local_part isn't dot-atom-text, we need to return quoted-string
+ dot-atom-text = 1*atext *("." 1*atext) */
for (p = local_part; *p != '\0'; p++) {
- if (!IS_ATEXT(*p) && *p != '.') {
- return t_strdup_printf("\"%s\"",
- str_escape(local_part));
- }
- }
+ if (!IS_ATEXT(*p) && *p != '.')
+ break;
+ }
+ if (*p != '\0' || *local_part == '.' ||
+ (p != local_part && p[-1] == '.'))
+ local_part = t_strdup_printf("\"%s\"", str_escape(local_part));
return local_part;
}
More information about the dovecot-cvs
mailing list