dovecot-1.1: message address parser: Check better if adress is i...
dovecot at dovecot.org
dovecot at dovecot.org
Sun Sep 7 19:50:09 EEST 2008
details: http://hg.dovecot.org/dovecot-1.1/rev/38c52536edca
changeset: 7860:38c52536edca
user: Timo Sirainen <tss at iki.fi>
date: Sun Sep 07 19:50:06 2008 +0300
description:
message address parser: Check better if adress is invalid and set invalid_syntax.
diffstat:
1 file changed, 9 insertions(+), 4 deletions(-)
src/lib-mail/message-address.c | 13 +++++++++----
diffs (39 lines):
diff -r 5d8aa306ca0e -r 38c52536edca src/lib-mail/message-address.c
--- a/src/lib-mail/message-address.c Sun Sep 07 19:43:53 2008 +0300
+++ b/src/lib-mail/message-address.c Sun Sep 07 19:50:06 2008 +0300
@@ -108,7 +108,7 @@ static int parse_angle_addr(struct messa
if (*ctx->parser.data == '@') {
if (parse_domain_list(ctx) <= 0 || *ctx->parser.data != ':') {
- ctx->addr.route = p_strdup(ctx->pool, "INVALID_ROUTE");
+ ctx->addr.route = "INVALID_ROUTE";
return -1;
}
ctx->parser.data++;
@@ -148,7 +148,8 @@ static int parse_name_addr(struct messag
}
if (parse_angle_addr(ctx) < 0) {
/* broken */
- ctx->addr.domain = p_strdup(ctx->pool, "SYNTAX_ERROR");
+ ctx->addr.domain = "SYNTAX_ERROR";
+ ctx->addr.invalid_syntax = TRUE;
}
return ctx->parser.data != ctx->parser.end;
}
@@ -176,10 +177,14 @@ static int parse_addr_spec(struct messag
static void add_fixed_address(struct message_address_parser_context *ctx)
{
- if (ctx->addr.mailbox == NULL)
+ if (ctx->addr.mailbox == NULL) {
ctx->addr.mailbox = !ctx->fill_missing ? "" : "MISSING_MAILBOX";
- if (ctx->addr.domain == NULL)
+ ctx->addr.invalid_syntax = TRUE;
+ }
+ if (ctx->addr.domain == NULL) {
ctx->addr.domain = !ctx->fill_missing ? "" : "MISSING_DOMAIN";
+ ctx->addr.invalid_syntax = TRUE;
+ }
add_address(ctx);
}
More information about the dovecot-cvs
mailing list