Mercurial > dovecot > core-2.2
changeset 10058:b81f4a4076de HEAD
lda: Escape local-part if it begins/ends with '.'.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 14 Oct 2009 16:35:16 -0400 |
parents | 21a09d9105b2 |
children | aa30fc7d771a |
files | src/lda/main.c |
diffstat | 1 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ { 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; }