gen-smtp / gen_smtp

The extensible Erlang SMTP client and server library.
Other
683 stars 266 forks source link

Switch to SASL subprotocol on AUTH command #277

Closed seriyps closed 3 years ago

seriyps commented 3 years ago

I noticed that Python's SMTPLIB sends all verbs in lowercase and gen_smtp fails to recognize rset\r\n command.

UPD: while digging deeper, I found https://datatracker.ietf.org/doc/html/rfc4954 and it says that AUTH xxxx verb actually makes client/server switch to a SASL subprotocol which uses base64-encoded data exchange. So, it does not make sense to use the same handle_request/parse_request functions as the ones we use for regular SMTP. RFC also says that client may interrupt SASL subprotocol by sending *\r\n, but I'm not implementing this feature here.

mworrell commented 3 years ago

That is quite a change (and a good one) for something that looked so simple.

seriyps commented 3 years ago

Thanks for your review! The change itself is not that big, mostly moved some clauses of handle_request to their own function. But yes, quite surpizing!