Commit e7309a2c authored by Alberto Bertogli's avatar Alberto Bertogli

smtpsrv: Send enhanced status codes

SMTP supports enhanced status codes, which help with
internationalization and accessibility in cases where protocol errors
make their way to the users.

This patch makes chasquid include these extended status codes in the
corresponding replies, as well as advertising support in the EHLO reply.

Main references:
- RFC 3463 (https://tools.ietf.org/html/rfc3463)
- RFC 2034 (https://tools.ietf.org/html/rfc2034)
- SMTP Enhanced Status Codes Registry
  (https://www.iana.org/assignments/smtp-enhanced-status-codes/smtp-enhanced-status-codes.xhtml)
parent 78937aca
This diff is collapsed.
......@@ -272,8 +272,8 @@ func TestSimpleCommands(t *testing.T) {
defer c.Close()
simpleCmd(t, c, "HELP", 214)
simpleCmd(t, c, "NOOP", 250)
simpleCmd(t, c, "VRFY", 252)
simpleCmd(t, c, "EXPN", 252)
simpleCmd(t, c, "VRFY", 502)
simpleCmd(t, c, "EXPN", 502)
}
func TestReset(t *testing.T) {
......
......@@ -11,17 +11,17 @@ c <~ 534
c -> AUTH PLAIN
c <~ 334
c -> dXNlckB0ZXN0c2VydmVyAHlalala==
c <~ 535 error decoding AUTH response
c <~ 501 5.5.2 Error decoding AUTH response
c -> AUTH PLAIN
c <~ 334
c -> dXNlckB0ZXN0c2VydmVyAHVzZXJAdGVzdHNlcnZlcgB3cm9uZ3Bhc3N3b3Jk
c <~ 535 Incorrect user or password
c <~ 535 5.7.8 Incorrect user or password
c -> AUTH PLAIN
c <~ 334
c -> dXNlckB0ZXN0c2VydmVyAHVzZXJAdGVzdHNlcnZlcgBzZWNyZXRwYXNzd29yZA==
c <~ 235
c <~ 235 2.7.0 Authentication successful
c -> AUTH PLAIN
c <~ 503 You are already wearing that!
c <~ 503 5.5.1 You are already wearing that!
......@@ -5,4 +5,4 @@ c <~ 220
c -> EHLO localhost
c <... 250 HELP
c -> AUTH PLAIN
c <- 503 You feel vulnerable
c <- 503 5.7.10 You feel vulnerable
......@@ -6,13 +6,13 @@ c -> EHLO localhost
c <... 250 HELP
c -> AUTH PLAIN something
c <~ 535
c <~ 501
c -> AUTH PLAIN something
c <~ 535
c <~ 501
c -> AUTH PLAIN something
c <~ 535
c <~ 501
c -> AUTH PLAIN something
c <~ 535
c <~ 501
c -> AUTH PLAIN something
c <~ 503 Too many attempts - go away
c <~ 503 5.7.8 Too many attempts, go away
......@@ -4,12 +4,12 @@ c tcp_connect localhost:1025
c <~ 220
c -> DATA
c <- 503 Invisible customers are not welcome!
c <- 503 5.5.1 Invisible customers are not welcome!
c -> HELO localhost
c <~ 250
c -> DATA
c <- 503 sender not yet given
c <- 503 5.5.1 Sender not yet given
c -> MAIL FROM:<a@b>
c <~ 250
......@@ -25,7 +25,7 @@ c -> Muahahahaha
c ->
c ->
c -> .
c <~ 554 error parsing message
c <~ 554 5.6.0 Error parsing message
c -> QUIT
c <~ 221
......
......@@ -5,7 +5,7 @@ c <~ 220
c -> HELO localhost
c <~ 250
c -> MAIL LALA: <>
c <- 500 unknown command
c <- 500 5.5.2 Unknown command
c -> MAIL FROM:
c <~ 500
......@@ -14,7 +14,7 @@ c -> MAIL FROM:<pepe>
c <~ 501
c -> MAIL FROM:<a@xn--->
c <- 501 malformed address (IDNA conversion failed)
c <- 501 5.1.8 Malformed sender domain (IDNA conversion failed)
c -> MAIL FROM:<aaaa5aaaaXaaaa5aaaaXaaaa5aaaaXaaaa5aaaaXaaaa5aaaaXaaaa5aaaaXaaaa5aaaaXaaaa5aaaaXaaaa5aaaaXaaaa5aaaaXaaaa5aaaaXaaaa5aaaaXaaaa5aaaaXaaaa5aaaaXaaaa5aaaaX@bbbb5bbbbXbbbb5bbbbXbbbb5bbbbXbbbb5bbbbXbbbb5bbbbXbbbb5bbbbXbbbb5bbbbXbbbb5bbbbXbbbb5bbbbXbbbb5bbbbXbbbb5bbbbXbbbb5bbbbXbbbb5bbbbXbbbb5bbbbXbbbb5bbbbX>
c <- 501 address too long
c <- 501 5.1.7 Sender address too long
......@@ -8,7 +8,7 @@ c -> MAIL FROM:<test@testy.com>
c <~ 250
c -> RCPT LALA: <>
c <- 500 unknown command
c <- 500 5.5.2 Unknown command
c -> RCPT TO:
c <~ 500
......@@ -17,10 +17,10 @@ c -> RCPT TO:<pepe>
c <~ 501
c -> RCPT TO:<a@xn--->
c <- 501 malformed address (IDNA conversion failed)
c <- 501 5.1.2 Malformed destination domain (IDNA conversion failed)
c -> RCPT TO:<henryⅣ@testserver>
c <- 550 recipient invalid, please check the address for typos
c <- 550 5.1.3 Destination address is invalid
c -> RCPT TO:<aaaa5aaaaXaaaa5aaaaXaaaa5aaaaXaaaa5aaaaXaaaa5aaaaXaaaa5aaaaXaaaa5aaaaXaaaa5aaaaXaaaa5aaaaXaaaa5aaaaXaaaa5aaaaXaaaa5aaaaXaaaa5aaaaXaaaa5aaaaXaaaa5aaaaX@bbbb5bbbbXbbbb5bbbbXbbbb5bbbbXbbbb5bbbbXbbbb5bbbbXbbbb5bbbbXbbbb5bbbbXbbbb5bbbbXbbbb5bbbbXbbbb5bbbbXbbbb5bbbbXbbbb5bbbbXbbbb5bbbbXbbbb5bbbbXbbbb5bbbbX>
c <- 501 address too long
c <- 501 5.1.3 Destination address too long
......@@ -5,5 +5,4 @@ c <~ 220
c -> EHLO localhost
c <... 250 HELP
c -> WHATISTHIS
c <- 500 unknown command
c <- 500 5.5.1 Unknown command
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment