-
Notifications
You must be signed in to change notification settings - Fork 228
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
Allow custom EHLO after RSET again #270
Conversation
conn.go
Outdated
if c.session != nil { | ||
// RFC 5321: "If it is issued after the session begins | ||
// and the EHLO command is acceptable to the SMTP server, ..." | ||
if !c.fromReceived { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, I don't quite get why this condition is here. Why do we need to skip reset()
when the client has sent MAIL FROM
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's what I found in the connection that may be usable for the condition "if it is issued after the session begins".
If I interprete the RFC correctly, then only in this case, EHLO
acts like RSET
.
It's not stated what should happen if it's issued not at the start of the session (or not after a RSET
), though.
Maybe we can find out by examining some example sequences
EHLO // <-- session begins (no buffers and tables to be cleared anyway)
MAIL FROM
RCPT TO
DATA
RSET
EHLO // <-- redundant to previous RSET, but allowed
MAIL FROM
RCPT TO
EHLO // <-- should have not RSET effect
DATA // should then probably be okay (from, rcpt tables still there)
RSET
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Session begins" just means that a TCP connection is opened no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Intersting question. If so, then do you think that an EHLO after RSET should not be passed to the session as Reset()? Then I wonder how the session would become aware of the new EHLO argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My point is that we should probably always call c.reset()
, even in the case where MAIL FROM
was sent by the client (that's what fromReceived
means).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I can do that. I'll update the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But feel free to adapt it to your likings and code style etc.
a56e6c2
to
2a51e89
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
I've re-organized the changes into two commits.
Resolves EHLO after RSET #269