mirror of
https://github.com/decke/smtprelay.git
synced 2025-12-25 07:43:06 -07:00
Allow "allowed_nets" to be empty, meaning any network is allowed
This commit is contained in:
4
main.go
4
main.go
@@ -20,6 +20,10 @@ func connectionChecker(peer smtpd.Peer) error {
|
|||||||
// This can't panic because we only have TCP listeners
|
// This can't panic because we only have TCP listeners
|
||||||
peerIP := peer.Addr.(*net.TCPAddr).IP
|
peerIP := peer.Addr.(*net.TCPAddr).IP
|
||||||
|
|
||||||
|
if len(allowedNets) == 0 {
|
||||||
|
// Special case: empty string means allow everything
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
for _, allowedNet := range allowedNets {
|
for _, allowedNet := range allowedNets {
|
||||||
if allowedNet.Contains(peerIP) {
|
if allowedNet.Contains(peerIP) {
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
;local_forcetls = false
|
;local_forcetls = false
|
||||||
|
|
||||||
; Networks that are allowed to send mails to us
|
; Networks that are allowed to send mails to us
|
||||||
|
; Defaults to localhost. If set to "", then any address is allowed.
|
||||||
;allowed_nets = 127.0.0.1/8 ::1/128
|
;allowed_nets = 127.0.0.1/8 ::1/128
|
||||||
|
|
||||||
; Regular expression for valid FROM EMail addresses
|
; Regular expression for valid FROM EMail addresses
|
||||||
|
|||||||
Reference in New Issue
Block a user