From e0e481380612111664fbef34524876029f5a4cfb Mon Sep 17 00:00:00 2001 From: Gnarwhal Date: Wed, 2 Oct 2024 19:11:01 +0000 Subject: [PATCH] Don't listen on provided host --- smtp/server.go | 4 ++-- smtp/session.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/smtp/server.go b/smtp/server.go index e408033..e22c7c1 100644 --- a/smtp/server.go +++ b/smtp/server.go @@ -62,7 +62,7 @@ func handle(connection net.Conn, host string, password_hash string) { func Run(host string, password_hash string, plain_config *PlainConfig, tls_config *TLSConfig) error { var wait_group sync.WaitGroup if plain_config != nil { - listener, err := net.Listen("tcp", fmt.Sprintf("%v:%v", host, plain_config.Port)) + listener, err := net.Listen("tcp", fmt.Sprintf(":%v", plain_config.Port)) if err != nil { return err } @@ -71,7 +71,7 @@ func Run(host string, password_hash string, plain_config *PlainConfig, tls_confi go Listen(wait_group, host, password_hash, listener) } if tls_config != nil { - listener, err := tls.Listen("tcp", fmt.Sprintf("%v:%v", host, tls_config.Port), &tls_config.TlsConfig) + listener, err := tls.Listen("tcp", fmt.Sprintf(":%v", tls_config.Port), &tls_config.TlsConfig) if err != nil { return err } diff --git a/smtp/session.go b/smtp/session.go index b1c4313..5d36de9 100644 --- a/smtp/session.go +++ b/smtp/session.go @@ -157,7 +157,7 @@ func (self *SMTPSession) SendMail(data string) error { } var smtp_hostname string if len(mx) == 0 { - smtp_hostname = self.host + smtp_hostname = mx_hostname } else { smtp_hostname = mx[0].Host }