mirror of
				https://github.com/drwetter/testssl.sh.git
				synced 2025-10-31 05:45:26 +01:00 
			
		
		
		
	Fix shellcheck issue SC2128
This PR addresses the following issues raised by shellcheck:
In ../github/testssl_2.9dev_20190409b.sh line 1133:
if [[ "$BASH_VERSINFO" == 3 ]]; then
       ^-- SC2128: Expanding an array without an index only gives the first element.
In ../github/testssl_2.9dev_20190409b.sh line 4301:
          tmpfile_handle $FUNCNAME.dd
                         ^-- SC2128: Expanding an array without an index only gives the first element.
In ../github/testssl_2.9dev_20190409b.sh line 4388:
     tmpfile_handle $FUNCNAME.dd
                    ^-- SC2128: Expanding an array without an index only gives the first element.
In ../github/testssl_2.9dev_20190409b.sh line 4657:
     tmpfile_handle $FUNCNAME$1.txt
                    ^-- SC2128: Expanding an array without an index only gives the first element.
In ../github/testssl_2.9dev_20190409b.sh line 5327:
     tmpfile_handle $FUNCNAME.${debugname}.txt
                    ^-- SC2128: Expanding an array without an index only gives the first element.
In ../github/testssl_2.9dev_20190409b.sh line 5943:
          tmpfile_handle $FUNCNAME.byID.log $tmpfile || \
                         ^-- SC2128: Expanding an array without an index only gives the first element.
In ../github/testssl_2.9dev_20190409b.sh line 5944:
          tmpfile_handle $FUNCNAME.byticket.log $tmpfile
                         ^-- SC2128: Expanding an array without an index only gives the first element.
In ../github/testssl_2.9dev_20190409b.sh line 12410:
     tmpfile_handle $FUNCNAME.dd $SOCK_REPLY_FILE
                    ^-- SC2128: Expanding an array without an index only gives the first element.
In ../github/testssl_2.9dev_20190409b.sh line 13164:
               tmpfile_handle $FUNCNAME.dd
                              ^-- SC2128: Expanding an array without an index only gives the first element.
In ../github/testssl_2.9dev_20190409b.sh line 13284:
     tmpfile_handle $FUNCNAME.dd $SOCK_REPLY_FILE
                    ^-- SC2128: Expanding an array without an index only gives the first element.
In ../github/testssl_2.9dev_20190409b.sh line 13388:
     tmpfile_handle $FUNCNAME.dd $SOCK_REPLY_FILE
                    ^-- SC2128: Expanding an array without an index only gives the first element.
--
In ../github/testssl_2.9dev_20190409b.sh line 13801:
               [[ "$DEBUG" -ge 1 ]] && echo $tls_hello_ascii >$TEMPDIR/$FUNCNAME.tls_hello_ascii${i}.txt
                                                                       ^-- SC2128: Expanding an array without an index only gives the first element.
			
			
This commit is contained in:
		
							
								
								
									
										24
									
								
								testssl.sh
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								testssl.sh
									
									
									
									
									
								
							| @@ -1130,7 +1130,7 @@ prepare_logging() { | |||||||
|  |  | ||||||
| ###### START helper function definitions ###### | ###### START helper function definitions ###### | ||||||
|  |  | ||||||
| if [[ "$BASH_VERSINFO" == 3 ]]; then | if [[ "${BASH_VERSINFO[0]}" == 3 ]]; then | ||||||
|      # older bash can do this only (MacOS X), even SLES 11, see #697 |      # older bash can do this only (MacOS X), even SLES 11, see #697 | ||||||
|      toupper() { tr 'a-z' 'A-Z' <<< "$1"; } |      toupper() { tr 'a-z' 'A-Z' <<< "$1"; } | ||||||
|      tolower() { tr 'A-Z' 'a-z' <<< "$1"; } |      tolower() { tr 'A-Z' 'a-z' <<< "$1"; } | ||||||
| @@ -4298,7 +4298,7 @@ client_simulation_sockets() { | |||||||
|      elif [[ $ret -eq 1 ]] || [[ $ret -eq 6 ]]; then |      elif [[ $ret -eq 1 ]] || [[ $ret -eq 6 ]]; then | ||||||
|           close_socket |           close_socket | ||||||
|           TMPFILE=$SOCK_REPLY_FILE |           TMPFILE=$SOCK_REPLY_FILE | ||||||
|           tmpfile_handle $FUNCNAME.dd |           tmpfile_handle ${FUNCNAME[0]}.dd | ||||||
|           return $ret |           return $ret | ||||||
|      fi |      fi | ||||||
|  |  | ||||||
| @@ -4385,7 +4385,7 @@ client_simulation_sockets() { | |||||||
|  |  | ||||||
|      close_socket |      close_socket | ||||||
|      TMPFILE=$SOCK_REPLY_FILE |      TMPFILE=$SOCK_REPLY_FILE | ||||||
|      tmpfile_handle $FUNCNAME.dd |      tmpfile_handle ${FUNCNAME[0]}.dd | ||||||
|      return $ret |      return $ret | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -4654,7 +4654,7 @@ run_prototest_openssl() { | |||||||
|      ret=$? |      ret=$? | ||||||
|      debugme grep -E "error|failure" $ERRFILE | grep -Eav "unable to get local|verify error" |      debugme grep -E "error|failure" $ERRFILE | grep -Eav "unable to get local|verify error" | ||||||
|      grep -aq "no cipher list" $TMPFILE && ret=5       # <--- important indicator for SSL2 (maybe others, too) |      grep -aq "no cipher list" $TMPFILE && ret=5       # <--- important indicator for SSL2 (maybe others, too) | ||||||
|      tmpfile_handle $FUNCNAME$1.txt |      tmpfile_handle ${FUNCNAME[0]}$1.txt | ||||||
|      return $ret |      return $ret | ||||||
|  |  | ||||||
|      # 0: offered |      # 0: offered | ||||||
| @@ -5324,7 +5324,7 @@ listciphers() { | |||||||
|      ret=$? |      ret=$? | ||||||
|      debugme cat $TMPFILE |      debugme cat $TMPFILE | ||||||
|      debugname="$(sed -e s'/\!/not/g' -e 's/\:/_/g' <<< "$1")" |      debugname="$(sed -e s'/\!/not/g' -e 's/\:/_/g' <<< "$1")" | ||||||
|      tmpfile_handle $FUNCNAME.${debugname}.txt |      tmpfile_handle ${FUNCNAME[0]}.${debugname}.txt | ||||||
|      return $ret |      return $ret | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -5940,8 +5940,8 @@ sub_session_resumption() { | |||||||
|           fi |           fi | ||||||
|      fi |      fi | ||||||
|      "$byID" && \ |      "$byID" && \ | ||||||
|           tmpfile_handle $FUNCNAME.byID.log $tmpfile || \ |           tmpfile_handle ${FUNCNAME[0]}.byID.log $tmpfile || \ | ||||||
|           tmpfile_handle $FUNCNAME.byticket.log $tmpfile |           tmpfile_handle ${FUNCNAME[0]}.byticket.log $tmpfile | ||||||
|      return $ret |      return $ret | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -12407,7 +12407,7 @@ sslv2_sockets() { | |||||||
|      ret=$? |      ret=$? | ||||||
|  |  | ||||||
|      close_socket |      close_socket | ||||||
|      tmpfile_handle $FUNCNAME.dd $SOCK_REPLY_FILE |      tmpfile_handle ${FUNCNAME[0]}.dd $SOCK_REPLY_FILE | ||||||
|      return $ret |      return $ret | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -13161,7 +13161,7 @@ tls_sockets() { | |||||||
|           elif [[ $ret -eq 1 ]] || [[ $ret -eq 6 ]]; then |           elif [[ $ret -eq 1 ]] || [[ $ret -eq 6 ]]; then | ||||||
|                close_socket |                close_socket | ||||||
|                TMPFILE=$SOCK_REPLY_FILE |                TMPFILE=$SOCK_REPLY_FILE | ||||||
|                tmpfile_handle $FUNCNAME.dd |                tmpfile_handle ${FUNCNAME[0]}.dd | ||||||
|                return $ret |                return $ret | ||||||
|           fi |           fi | ||||||
|  |  | ||||||
| @@ -13281,7 +13281,7 @@ tls_sockets() { | |||||||
|      fi |      fi | ||||||
|  |  | ||||||
|      "$close_connection" && close_socket |      "$close_connection" && close_socket | ||||||
|      tmpfile_handle $FUNCNAME.dd $SOCK_REPLY_FILE |      tmpfile_handle ${FUNCNAME[0]}.dd $SOCK_REPLY_FILE | ||||||
|      return $ret |      return $ret | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -13385,7 +13385,7 @@ run_heartbleed(){ | |||||||
|           fi |           fi | ||||||
|      fi |      fi | ||||||
|      outln |      outln | ||||||
|      tmpfile_handle $FUNCNAME.dd $SOCK_REPLY_FILE |      tmpfile_handle ${FUNCNAME[0]}.dd $SOCK_REPLY_FILE | ||||||
|      close_socket |      close_socket | ||||||
|      return 0 |      return 0 | ||||||
| } | } | ||||||
| @@ -13798,7 +13798,7 @@ run_ticketbleed() { | |||||||
|                     echo -n "$sid_input in SID:       " ; |                     echo -n "$sid_input in SID:       " ; | ||||||
|                          [[ "${sid_detected[i]}"  =~ $sid_input ]] && echo "yes" || echo "no" |                          [[ "${sid_detected[i]}"  =~ $sid_input ]] && echo "yes" || echo "no" | ||||||
|                fi |                fi | ||||||
|                [[ "$DEBUG" -ge 1 ]] && echo $tls_hello_ascii >$TEMPDIR/$FUNCNAME.tls_hello_ascii${i}.txt |                [[ "$DEBUG" -ge 1 ]] && echo $tls_hello_ascii >$TEMPDIR/${FUNCNAME[0]}.tls_hello_ascii${i}.txt | ||||||
|           else |           else | ||||||
|                ret=1 |                ret=1 | ||||||
|                pr_warning "test failed" |                pr_warning "test failed" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 David Cooper
					David Cooper