Skip to content

Commit

Permalink
fixed when an MX refereneces an MX
Browse files Browse the repository at this point in the history
  • Loading branch information
steffenfritz committed Dec 17, 2022
1 parent c623702 commit 5cfb0c2
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))

BINARY=mxcheck
VERSION=1.4.1
VERSION=1.4.2

BUILD=`git rev-parse --short HEAD`
PLATFORMS=darwin linux windows
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ You can set mailFrom, mailTo, the DNS server, DKIM selector and output a report

# Version

v1.4.1
v1.4.2

[![Go Report Card](https://goreportcard.com/badge/github.com/steffenfritz/mxcheck)](https://goreportcard.com/report/github.com/steffenfritz/mxcheck)
[![Go Reference](https://pkg.go.dev/badge/github.com/steffenfritz/mxcheck.svg)](https://pkg.go.dev/github.com/steffenfritz/mxcheck)
Expand Down
6 changes: 6 additions & 0 deletions dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ func getA(targetHostName string, dnsServer string) (string, error) {

if t, ok := in.Answer[0].(*dns.A); ok {
a = t.A.String()
// We check for a second ip address when the first entry is also an mx entry.
// We also have to update the targetHost because of the cwrt test in openrelay
} else {
if t, ok := in.Answer[1].(*dns.A); ok {
a = t.A.String()
}
}

return a, err
Expand Down
2 changes: 1 addition & 1 deletion mxcheck.1
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
.\" %%%LICENSE_END


.TH mxcheck 1 "November 2022" "version 1.4.1"
.TH mxcheck 1 "November 2022" "version 1.4.2"

.SH NAME
mxcheck
Expand Down
4 changes: 3 additions & 1 deletion openrelay.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"log"
"net"
"net/smtp"
"strings"
"time"
)

Expand Down Expand Up @@ -61,7 +62,8 @@ func openRelay(mailFrom string, mailTo string, targetHost string) (openResult, e
// update config to ignore invalid TLS certificates and proceed
tlsconfig = &tls.Config{InsecureSkipVerify: true}
err = c.StartTLS(tlsconfig)
if err == nil {
// As there are no error types returned by the TLS client we need this ugly or. Should be fixed with a switch
if err == nil || strings.HasSuffix(err.Error(), "certificate name does not match input") {
or.tlsbool = true
or.tlsvalid = false
}
Expand Down

0 comments on commit 5cfb0c2

Please sign in to comment.