aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-01-12 13:54:28 +0800
committerRunxi Yu <me@runxiyu.org>2025-01-12 13:54:28 +0800
commitd0475e356b3d5af26af2f0cae638b41b43478e4c (patch)
tree2a9213d7b04ec5a64b54f3e64f463488333b91bd
parentReject STARTTLS when already active or with excessive parameters (diff)
downloadmaild-d0475e356b3d5af26af2f0cae638b41b43478e4c.tar.gz
maild-d0475e356b3d5af26af2f0cae638b41b43478e4c.tar.zst
maild-d0475e356b3d5af26af2f0cae638b41b43478e4c.zip
Reset state on STARTTLS, conforming to RFC7817ยง4.2
-rw-r--r--mta_recv.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/mta_recv.go b/mta_recv.go
index 0ca81d9..7042901 100644
--- a/mta_recv.go
+++ b/mta_recv.go
@@ -70,6 +70,10 @@ func handle_incoming_server_connection(buf_conn *bufio.ReadWriter, net_conn *net
_ = buf_conn.Flush()
tls_conn = tls.Server(*net_conn, tls_config)
buf_conn = bufio.NewReadWriter(bufio.NewReader(tls_conn), bufio.NewWriter(tls_conn))
+ server_state = server_state_begin
+ remote_server_name = ""
+ current_mail_from = ""
+ current_rcpt_to = []string{""}
case "HELO":
if param == "" { // TODO: actually validate the hostname
_, _ = buf_conn.WriteString("501 Syntax: HELO hostname\r\n")