go-smtp
go-smtp copied to clipboard
Incorrect handling of the interrupted AUTH command
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: https://github.com/emersion/go-smtp/blob/608f3c2840584931f2867716078c43485ea7ef3f/client.go#L353
server code which is triggered: https://github.com/emersion/go-smtp/blob/608f3c2840584931f2867716078c43485ea7ef3f/parse.go#L18 via https://github.com/emersion/go-smtp/blob/608f3c2840584931f2867716078c43485ea7ef3f/server.go#L175-L181
server code, which expected be triggered: https://github.com/emersion/go-smtp/blob/608f3c2840584931f2867716078c43485ea7ef3f/conn.go#L568-L572