Skip to content

Incorrect handling of the interrupted AUTH command #191

@kayrus

Description

@kayrus

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
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions