From b597cfb5143b1b13ed8f5a64f142476a6f7eea9a Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Sun, 27 Oct 2013 12:03:05 +0100 Subject: openssl-*: support custom s_server/s_client args --- openssl-listen | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'openssl-listen') diff --git a/openssl-listen b/openssl-listen index 65cf714..3919c40 100755 --- a/openssl-listen +++ b/openssl-listen @@ -13,12 +13,20 @@ ecc_pub=secp384r1-rsa.crt PSK=12345678 PSK=0102030405060708091011121314151617181920 -pkdir=$1 -portbase=${2:-4430} +pkdir=$1; shift +portbase=4430 +# assume that openssl options always start with - +if [[ $1 != -* ]]; then + portbase=$1; shift + if ! [[ $portbase -gt 0 ]] || ! [[ $portbase -le 65535 ]]; then + echo "Port must be between 1 and 65535" >&2 + exit 1 + fi +fi if [ -z "$pkdir" ]; then cat <