Skip to content

Commit c076f56

Browse files
authored
Merge pull request #2048 from drwetter/fix_badFileDescriptor_3.0
Fix for "Bad file descriptor" with --connect-timeout option (3.0)
2 parents f5bd5d3 + 4a02dcb commit c076f56

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

testssl.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10417,7 +10417,9 @@ fd_socket() {
1041710417
fi
1041810418
done
1041910419
# For the following execs: 2>/dev/null would remove a potential error message, but disables debugging.
10420-
# First we check whether a socket connect timeout was specified
10420+
# First we check whether a socket connect timeout was specified. We exec the connect in a subshell,
10421+
# then we'll see whether we can connect. If not we take the emergency exit. If we're still alive we'll
10422+
# proceed with the "usual case", see below.
1042110423
elif [[ -n "$CONNECT_TIMEOUT" ]]; then
1042210424
if ! $TIMEOUT_CMD $CONNECT_TIMEOUT bash -c "exec 5<>/dev/tcp/$nodeip/$PORT"; then
1042310425
((NR_SOCKET_FAIL++))
@@ -10426,8 +10428,9 @@ fd_socket() {
1042610428
pr_warning "Unable to open a socket to $NODEIP:$PORT. "
1042710429
return 6
1042810430
fi
10431+
fi
1042910432
# Now comes the the usual case
10430-
elif ! exec 5<>/dev/tcp/$nodeip/$PORT; then
10433+
if ! exec 5<>/dev/tcp/$nodeip/$PORT && [[ -z "$PROXY" ]]; then
1043110434
((NR_SOCKET_FAIL++))
1043210435
connectivity_problem $NR_SOCKET_FAIL $MAX_SOCKET_FAIL "TCP connect problem" "repeated TCP connect problems, giving up"
1043310436
outln
@@ -20040,7 +20043,6 @@ parse_cmd_line() {
2004020043
[[ $CMDLINE_IP == one ]] && [[ "$NODNS" == none ]] && fatal "\"--ip=one\" and \"--nodns=none\" don't work together" $ERR_CMDLINE
2004120044
[[ $CMDLINE_IP == one ]] && ( is_ipv4addr "$URI" || is_ipv6addr "$URI" ) && fatal "\"--ip=one\" plus supplying an IP address doesn't work" $ERR_CMDLINE
2004220045
"$do_mx_all_ips" && [[ "$NODNS" == none ]] && fatal "\"--mx\" and \"--nodns=none\" don't work together" $ERR_CMDLINE
20043-
[[ -n "$CONNECT_TIMEOUT" ]] && [[ "$MASS_TESTING_MODE" == parallel ]] && fatal "Parallel mass scanning and specifying connect timeouts currently don't work together" $ERR_CMDLINE
2004420046

2004520047
ADDITIONAL_CA_FILES="${ADDITIONAL_CA_FILES//,/ }"
2004620048
for fname in $ADDITIONAL_CA_FILES; do

0 commit comments

Comments
 (0)