Mercurial > dovecot > original-hg > dovecot-1.2
changeset 8169:cb01142bb9e8 HEAD
message address parser: Check better if adress is invalid and set invalid_syntax.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 07 Sep 2008 19:50:23 +0300 |
parents | 55871f3b4481 |
children | 3e21ec854acc |
files | src/lib-mail/message-address.c |
diffstat | 1 files changed, 9 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-mail/message-address.c Sun Sep 07 19:44:09 2008 +0300 +++ b/src/lib-mail/message-address.c Sun Sep 07 19:50:23 2008 +0300 @@ -108,7 +108,7 @@ 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 @@ } 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 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); }