Skip to content

Commit

Permalink
Auth check for mail, from, data commands emersion#216
Browse files Browse the repository at this point in the history
  • Loading branch information
mukul-brevo committed Mar 25, 2023
1 parent e7e393a commit 26d1b98
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ func (c *Conn) handle(cmd string, arg string) {
}

cmd = strings.ToUpper(cmd)
// Auth should be checked for mail, rcpt, data commands.
if (cmd == "MAIL" || cmd == "RCPT" || cmd == "DATA") && !c.server.AuthDisabled && !c.didAuth {
c.writeResponse(502, EnhancedCode{5, 7, 0}, "Please authenticate first")
return
}

switch cmd {
case "SEND", "SOML", "SAML", "EXPN", "HELP", "TURN":
// These commands are not implemented in any state
Expand Down

0 comments on commit 26d1b98

Please sign in to comment.