Merge pull request #1235 from drwetter/mx_ip1

make --mx and --ip=one to work together
This commit is contained in:
Dirk Wetter 2019-04-13 18:22:07 +02:00 committed by GitHub
commit d1e14634bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 3 deletions

View File

@ -6801,7 +6801,7 @@ tls_time() {
# returns 0 if connect was successful, 1 if not # returns 0 if connect was successful, 1 if not
# #
sclient_connect_successful() { sclient_connect_successful() {
local server_hello="$(cat "$2")" local server_hello="$(<"$2")"
local re='Master-Key: ([^\ local re='Master-Key: ([^\
]*)' ]*)'
@ -17869,11 +17869,17 @@ run_mx_all_ips() {
local mxs mx local mxs mx
local mxport local mxport
local -i ret=0 local -i ret=0
local word=""
STARTTLS_PROTOCOL="smtp" STARTTLS_PROTOCOL="smtp"
# test first higher priority servers # test first higher priority servers
mxs=$(get_mx_record "$1" | sort -n | sed -e 's/^.* //' -e 's/\.$//' | tr '\n' ' ') mxs=$(get_mx_record "$1" | sort -n | sed -e 's/^.* //' -e 's/\.$//' | tr '\n' ' ')
if [[ $CMDLINE_IP == one ]]; then
word="as instructed one" # with highest priority
mxs=${mxs%% *}
else
word="the only"
fi
mxport=${2:-25} mxport=${2:-25}
if [[ -n "$LOGFILE" ]]; then if [[ -n "$LOGFILE" ]]; then
prepare_logging prepare_logging
@ -17882,7 +17888,12 @@ run_mx_all_ips() {
fi fi
if [[ -n "$mxs" ]] && [[ "$mxs" != ' ' ]]; then if [[ -n "$mxs" ]] && [[ "$mxs" != ' ' ]]; then
[[ $(count_words "$mxs") -gt 1 ]] && MULTIPLE_CHECKS=true [[ $(count_words "$mxs") -gt 1 ]] && MULTIPLE_CHECKS=true
pr_bold "Testing all MX records (on port $mxport): "; outln "$mxs" if "$MULTIPLE_CHECKS"; then
pr_bold "Testing all MX records (on port $mxport): "
else
pr_bold "Testing $word MX record (on port $mxport): "
fi
outln "$mxs"
[[ $mxport == 465 ]] && STARTTLS_PROTOCOL="" # no starttls for tcp 465, all other ports are starttls [[ $mxport == 465 ]] && STARTTLS_PROTOCOL="" # no starttls for tcp 465, all other ports are starttls
for mx in $mxs; do for mx in $mxs; do
draw_line "-" $((TERM_WIDTH * 2 / 3)) draw_line "-" $((TERM_WIDTH * 2 / 3))