mirror of
https://github.com/decke/smtprelay.git
synced 2025-12-25 16:02:31 -07:00
Ensure that authentication was successfull before we relay mails
This commit is contained in:
4
main.go
4
main.go
@@ -122,6 +122,10 @@ func authChecker(peer smtpd.Peer, username string, password string) error {
|
||||
}
|
||||
|
||||
func mailHandler(peer smtpd.Peer, env smtpd.Envelope) error {
|
||||
if *allowedUsers != "" && peer.Username == "" {
|
||||
return smtpd.Error{Code: 530, Message: "Authentication Required"}
|
||||
}
|
||||
|
||||
peerIP := ""
|
||||
if addr, ok := peer.Addr.(*net.TCPAddr); ok {
|
||||
peerIP = addr.IP.String()
|
||||
|
||||
Reference in New Issue
Block a user