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

Envelope paths with only a mailbox part are now allowed.

parent 21e7f1e0
No related branches found
No related tags found
No related merge requests found
......@@ -371,6 +371,14 @@ static const char *addrp_all_extract_from
const char *local_part = address->local_part;
const char *domain = address->domain;
if ( domain == NULL ) {
return local_part;
}
if ( local_part == NULL ) {
return NULL;
}
return t_strconcat(local_part, "@", domain, NULL);
}
......
......@@ -692,14 +692,14 @@ static int path_parse_mailbox(struct sieve_envelope_address_parser *parser)
/* Mailbox = Local-part "@" Domain */
if ( (ret=path_parse_local_part(parser)) <= 0 )
if ( (ret=path_parse_local_part(parser)) < 0
|| (ret=path_skip_white_space(parser)) < 0 )
return -1;
if ( (ret=path_skip_white_space(parser)) <= 0 )
return -1;
if ( ret == 0 || *parser->data != '@' ) {
return ret;
}
if ( *parser->data != '@' )
return -1;
parser->data++;
if ( (ret=path_skip_white_space(parser)) <= 0 )
......
......@@ -67,10 +67,10 @@ test "Envelope - from empty" {
test "Envelope - invalid paths" {
/* Return_path: "hutsefluts" */
test_set "envelope.from" "hutsefluts";
test_set "envelope.to" "knurft";
test_set "envelope.from" "hutsefluts@";
test_set "envelope.to" "knurft@";
if not envelope :all :is "from" "hutsefluts" {
if not envelope :all :is "from" "hutsefluts@" {
test_fail ":all address part mangled syntactically incorrect reverse path";
}
......@@ -82,7 +82,7 @@ test "Envelope - invalid paths" {
test_fail ":domain address part matched syntactically incorrect reverse path";
}
if not envelope :all :is "to" "knurft" {
if not envelope :all :is "to" "knurft@" {
test_fail ":all address part mangled syntactically incorrect forward path";
}
......@@ -216,3 +216,30 @@ test "Envelope - source route errors" {
test_fail ":all address part mangled syntactically incorrect path";
}
}
test "Envelope - local part only" {
test_set "envelope.to" "<MAILER-DAEMON>";
if not envelope :is "to" "MAILER-DAEMON" {
test_fail "failed to parse local_part only path";
}
test_set "envelope.to" "MAILER-DAEMON@";
if envelope :is "to" "MAILER-DAEMON" {
test_fail "parsing syntactically incorrect path with missing domain";
}
test_set "envelope.to" "<MAILER-DAEMON>";
if not envelope :is "to" "MAILER-DAEMON" {
test_fail "failed to parse local_part only path with angle brackets";
}
test_set "envelope.to" "<MAILER-DAEMON >";
if not envelope :is "to" "MAILER-DAEMON" {
test_fail "failed to parse local_part only path with angle brackets and whitespace";
}
test_set "envelope.to" " MAILER-DAEMON ";
if not envelope :is "to" "MAILER-DAEMON" {
test_fail "failed to parse local_part only path with whitespace";
}
}
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.