Beispiel #1
0
def handle_ehlo(state: State, arguments: str) -> Reply:
    if not arguments.strip():
        return handle_missing_arguments()
    if not is_valid_domain(arguments) and not is_valid_address_literal(
            arguments):
        return handle_wrong_arguments()
    state.greeted = True
    return SMTPStatus.OK, f"{getfqdn()} Hello {arguments}"
Beispiel #2
0
 def test_comp_ipv6v4__invalid_ip4(self) -> None:
     assert not is_valid_address_literal("[IPv6:0:0::0:192.168.9.333]")
Beispiel #3
0
 def test_comp_ipv6v4__too_many_groups(self) -> None:
     assert not is_valid_address_literal("[IPv6:0:0:0:0::0:192.168.9.12]")
Beispiel #4
0
 def test_comp_ipv6v4__ends_with_empty_group(self) -> None:
     assert is_valid_address_literal("[IPv6:0:0:0:0::192.168.9.12]")
Beispiel #5
0
 def test_full_ipv6v4__invalid_ip4(self) -> None:
     assert not is_valid_address_literal("[IPv6:0:0:0:0:0:0:192.567.9.12]")
Beispiel #6
0
 def test_valid_comp_ipv6v4(self) -> None:
     assert is_valid_address_literal("[IPv6:0:0::0:192.168.9.12]")
Beispiel #7
0
 def test_valid_comp_ipv6(self) -> None:
     assert is_valid_address_literal("[IPv6:0:0::0]")
Beispiel #8
0
 def test_ipv4_out_of_bounds(self) -> None:
     assert not is_valid_address_literal("[192.256.23.24]")
Beispiel #9
0
 def test_valid_ipv4(self) -> None:
     assert is_valid_address_literal("[192.168.23.24]")
Beispiel #10
0
 def test_invalid_literal(self) -> None:
     assert not is_valid_address_literal("[INVALID]")
Beispiel #11
0
 def test_missing_brackets(self) -> None:
     assert not is_valid_address_literal("192.168.23.24")