Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect handling of the interrupted AUTH command #191

Open
kayrus opened this issue Jun 13, 2022 · 1 comment
Open

Incorrect handling of the interrupted AUTH command #191

kayrus opened this issue Jun 13, 2022 · 1 comment
Labels

Comments

@kayrus
Copy link
Contributor

kayrus commented Jun 13, 2022

Example server logs:

...
AUTH PLAIN *masked*
454 4.7.0 auth failed
* -> produces 'Command too short: "*"'
501 5.5.2 Bad command
QUIT
221 2.0.0 Bye

Expected behavior:

...
AUTH PLAIN *masked*
454 4.7.0 auth failed
*
501 5.0.0 Negotiation cancelled
QUIT
221 2.0.0 Bye

See related code:

client:

c.cmd(501, "*")

server code which is triggered:

return "", "", fmt.Errorf("Command too short: %q", line)

via

go-smtp/server.go

Lines 175 to 181 in 608f3c2

line, err := c.ReadLine()
if err == nil {
cmd, arg, err := parseCmd(line)
if err != nil {
c.protocolError(501, EnhancedCode{5, 5, 2}, "Bad command")
continue
}

server code, which expected be triggered:

go-smtp/conn.go

Lines 568 to 572 in 608f3c2

if encoded == "*" {
// https://tools.ietf.org/html/rfc4954#page-4
c.WriteResponse(501, EnhancedCode{5, 0, 0}, "Negotiation cancelled")
return
}

@emersion
Copy link
Owner

That's not my reading of the RFC here. To my understanding * is only valid as a response to a 334, ie. it's not valid as a response to a 454.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants