Skip to content
Snippets Groups Projects
Commit e46dea37 authored by Stephan Bosch's avatar Stephan Bosch
Browse files

Fixed bug in the outgoing mail address verification.

parent 7dab1255
No related branches found
No related tags found
No related merge requests found
......@@ -166,11 +166,11 @@ static int parse_mailbox(struct sieve_message_address_parser *ctx)
const unsigned char *start;
/* sieve-address = addr-spec ; simple address
* / phrase "<" addr-spec ">" ; name & addr-spec
*/
* / phrase "<" addr-spec ">" ; name & addr-spec
*/
/* Record parser state in case we fail at our first attempt */
start = ctx->parser.data;
/* Record parser state in case we fail at our first attempt */
start = ctx->parser.data;
/* First try: phrase "<" addr-spec ">" ; name & addr-spec */
str_truncate(ctx->str, 0);
......@@ -227,6 +227,14 @@ static bool parse_mailbox_address
if ((ret = parse_mailbox(ctx)) < 0) {
return FALSE;
}
if (ctx->parser.data != ctx->parser.end) {
if ( *ctx->parser.data == ',' )
sieve_address_error(ctx, "not a single addres (found ',')");
else
sieve_address_error(ctx, "address ends in invalid characters");
return FALSE;
}
if ( str_len(ctx->domain) == 0 ) {
/* Not gonna happen */
......@@ -315,7 +323,7 @@ const char *sieve_address_normalize
*error_r = NULL;
(void)str_lcase(str_c_modifiable(ctx.domain));
return t_strconcat(str_c(ctx.local_part), "@", str_c(ctx.domain), NULL);
}
......
......@@ -293,7 +293,7 @@ test "Outgoing address errors (FIXME: count only)" {
test_fail "compile should have failed.";
}
if not test_error :count "eq" :comparator "i;ascii-numeric" "13" {
if not test_error :count "eq" :comparator "i;ascii-numeric" "15" {
test_fail "wrong number of errors reported";
}
}
......
require "vacation";
# Error
redirect "@wrong.example.com";
redirect "error";
redirect "error@";
......@@ -11,6 +13,8 @@ redirect "<>";
redirect "Error <";
redirect "Error <stephan";
redirect "Error <stephan@";
redirect "stephan@rename-it.nl,tss@iki.fi";
redirect "stephan@rename-it.nl,%&^&!!~";
vacation :from "Error" "Ik ben er niet.";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment

Consent

On this website, we use the web analytics service Matomo to analyze and review the use of our website. Through the collected statistics, we can improve our offerings and make them more appealing for you. Here, you can decide whether to allow us to process your data and set corresponding cookies for these purposes, in addition to technically necessary cookies. Further information on data protection—especially regarding "cookies" and "Matomo"—can be found in our privacy policy. You can withdraw your consent at any time.