Don't listen on provided host

This commit is contained in:
Gnarwhal 2024-10-02 19:11:01 +00:00
parent 7b2d7c3f42
commit e0e4813806
Signed by: Gnarwhal
GPG key ID: 0989A73D8C421174
2 changed files with 3 additions and 3 deletions

View file

@ -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
}

View file

@ -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
}