Skip to content

Commit 5cfb0c2

Browse files
committed
fixed when an MX refereneces an MX
1 parent c623702 commit 5cfb0c2

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
22

33
BINARY=mxcheck
4-
VERSION=1.4.1
4+
VERSION=1.4.2
55

66
BUILD=`git rev-parse --short HEAD`
77
PLATFORMS=darwin linux windows

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ You can set mailFrom, mailTo, the DNS server, DKIM selector and output a report
2727

2828
# Version
2929

30-
v1.4.1
30+
v1.4.2
3131

3232
[![Go Report Card](https://goreportcard.com/badge/github.com/steffenfritz/mxcheck)](https://goreportcard.com/report/github.com/steffenfritz/mxcheck)
3333
[![Go Reference](https://pkg.go.dev/badge/github.com/steffenfritz/mxcheck.svg)](https://pkg.go.dev/github.com/steffenfritz/mxcheck)

dns.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,12 @@ func getA(targetHostName string, dnsServer string) (string, error) {
6060

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

6571
return a, err

mxcheck.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
.\" %%%LICENSE_END
2323

2424

25-
.TH mxcheck 1 "November 2022" "version 1.4.1"
25+
.TH mxcheck 1 "November 2022" "version 1.4.2"
2626

2727
.SH NAME
2828
mxcheck

openrelay.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"log"
88
"net"
99
"net/smtp"
10+
"strings"
1011
"time"
1112
)
1213

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

0 commit comments

Comments
 (0)