Skip to content

Commit 2824e34

Browse files
committed
Cleanup bash $(( )) arithmetic usage
1 parent 43e5561 commit 2824e34

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

testssl.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17112,15 +17112,15 @@ run_renego() {
1711217112
# If we dont wait for the session to be established on slow server, we will try to re-negotiate
1711317113
# too early losing all the attempts before the session establishment as OpenSSL will not buffer them
1711417114
# (only the first will be till the establishement of the session).
17115-
(j=0; while [[ $(grep -ac '^SSL-Session:' $TMPFILE) -ne 1 ]] && [[ $j -lt 30 ]]; do sleep $ssl_reneg_wait; j=$(($j+1)); done; \
17115+
(j=0; while [[ $(grep -ac '^SSL-Session:' $TMPFILE) -ne 1 ]] && [[ $j -lt 30 ]]; do sleep $ssl_reneg_wait; j=$((j++)); done; \
1711617116
for ((i=0; i < ssl_reneg_attempts; i++ )); do sleep $ssl_reneg_wait; echo R; k=0; \
17117-
while [[ $(grep -ac '^RENEGOTIATING' $ERRFILE) -ne $(($i+3)) ]] && [[ -f $TEMPDIR/allowed_to_loop ]] \
17117+
while [[ $(grep -ac '^RENEGOTIATING' $ERRFILE) -ne $((i+3)) ]] && [[ -f $TEMPDIR/allowed_to_loop ]] \
1711817118
&& [[ $(tail -n1 $ERRFILE |grep -acE '^(RENEGOTIATING|depth|verify)') -eq 1 ]] && [[ $k -lt 120 ]]; \
17119-
do sleep $ssl_reneg_wait; k=$(($k+1)); done; \
17119+
do sleep $ssl_reneg_wait; k=$((k++)); done; \
1712017120
done) | \
1712117121
$OPENSSL s_client $(s_client_options "$proto $legacycmd $STARTTLS $BUGS -connect $NODEIP:$PORT $PROXY $SNI") >$TMPFILE 2>>$ERRFILE &
1712217122
pid=$!
17123-
( sleep $(($ssl_reneg_attempts*3)) && kill $pid && touch $TEMPDIR/was_killed ) >&2 2>/dev/null &
17123+
( sleep $((ssl_reneg_attempts*3)) && kill $pid && touch $TEMPDIR/was_killed ) >&2 2>/dev/null &
1712417124
watcher=$!
1712517125
# Trick to get the return value of the openssl command, output redirection and a timeout. Yes, some target hang/block after some tries.
1712617126
wait $pid
@@ -17129,7 +17129,7 @@ run_renego() {
1712917129
wait $watcher
1713017130
rm -f $TEMPDIR/allowed_to_loop
1713117131
# If we are here, we have done two successful renegotiation (-2) and do the loop
17132-
loop_reneg=$(($(grep -ac '^RENEGOTIATING' $ERRFILE )-2))
17132+
loop_reneg=$(($(grep -ac '^RENEGOTIATING' $ERRFILE)-2))
1713317133
if [[ -f $TEMPDIR/was_killed ]]; then
1713417134
tmp_result=2
1713517135
rm -f $TEMPDIR/was_killed

0 commit comments

Comments
 (0)