From: Simon Ruderich Date: Sun, 11 Mar 2012 21:48:16 +0000 (+0100) Subject: src/*,test/*: Add missing quotes to shell scripts. X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=44ab705f30eb1fcb7a86155a6abf01b9394a8db1;p=tlsproxy%2Ftlsproxy.git src/*,test/*: Add missing quotes to shell scripts. --- diff --git a/src/tlsproxy-add b/src/tlsproxy-add index 1acd03d..c3acf3e 100755 --- a/src/tlsproxy-add +++ b/src/tlsproxy-add @@ -41,23 +41,23 @@ fi tempfile=`mktemp` || exit 1 die() { - rm -f $tempfile + rm -f "$tempfile" exit 1 } # Generate server certificate for given host. -echo 'organization = tlsproxy' > $tempfile -echo "cn = $1" >> $tempfile -echo tls_www_server >> $tempfile -echo encryption_key >> $tempfile -echo signing_key >> $tempfile +echo 'organization = tlsproxy' > "$tempfile" +echo "cn = $1" >> "$tempfile" +echo tls_www_server >> "$tempfile" +echo encryption_key >> "$tempfile" +echo signing_key >> "$tempfile" certtool --generate-certificate \ --load-privkey proxy-key.pem \ --load-ca-certificate proxy-ca.pem \ --load-ca-privkey proxy-ca-key.pem \ - --template $tempfile \ + --template "$tempfile" \ --outfile "certificate-$1-proxy.pem" || die -rm $tempfile +rm "$tempfile" if [ "x$2" = x ]; then echo please enter server certificate diff --git a/src/tlsproxy-setup b/src/tlsproxy-setup index 48a034f..24f1e0d 100755 --- a/src/tlsproxy-setup +++ b/src/tlsproxy-setup @@ -23,19 +23,19 @@ tempfile=`mktemp` || exit 1 die() { - rm -f $tempfile + rm -f "$tempfile" exit 1 } # Generate proxy CA key file. certtool --generate-privkey > proxy-ca-key.pem || die # Generate proxy CA. -echo 'cn = tlsproxy CA' > $tempfile -echo ca >> $tempfile -echo cert_signing_key >> $tempfile +echo 'cn = tlsproxy CA' > "$tempfile" +echo ca >> "$tempfile" +echo cert_signing_key >> "$tempfile" certtool --generate-self-signed \ --load-privkey proxy-ca-key.pem \ - --template $tempfile \ + --template "$tempfile" \ --outfile proxy-ca.pem || die # Generate proxy key file. @@ -43,16 +43,16 @@ certtool --generate-privkey > proxy-key.pem || die # Generate proxy "invalid" server certificate. It's used for problematic # connections. -echo 'organization = tlsproxy' > $tempfile -echo 'cn = invalid' >> $tempfile -echo tls_www_server >> $tempfile -echo encryption_key >> $tempfile -echo signing_key >> $tempfile +echo 'organization = tlsproxy' > "$tempfile" +echo 'cn = invalid' >> "$tempfile" +echo tls_www_server >> "$tempfile" +echo encryption_key >> "$tempfile" +echo signing_key >> "$tempfile" certtool --generate-self-signed \ --load-privkey proxy-key.pem \ - --template $tempfile \ + --template "$tempfile" \ --outfile proxy-invalid.pem || die -rm $tempfile +rm "$tempfile" echo done diff --git a/tests/tests-normal.sh b/tests/tests-normal.sh index 1d8f07b..11c5eaf 100755 --- a/tests/tests-normal.sh +++ b/tests/tests-normal.sh @@ -21,17 +21,17 @@ # Handle empty $srcdir. [ "x$srcdir" = x ] && srcdir=. -. $srcdir/common.sh +. "$srcdir/common.sh" # Create necessary files. cleanup -$srcdir/../src/tlsproxy-setup >/dev/null 2>/dev/null +"$srcdir/../src/tlsproxy-setup" >/dev/null 2>/dev/null # Normal tests. ../src/tlsproxy -d2 4711 >/dev/null & -server --x509certfile $srcdir/server.pem \ - --x509keyfile $srcdir/server-key.pem +server --x509certfile "$srcdir/server.pem" \ + --x509keyfile "$srcdir/server-key.pem" sleep 1 @@ -46,7 +46,7 @@ test_proxy_successful test_invalid_certificate # Create the proxy certificate. -$srcdir/../src/tlsproxy-add localhost $srcdir/server.pem \ +"$srcdir/../src/tlsproxy-add" localhost "$srcdir/server.pem" \ >/dev/null 2>/dev/null echo missing server certificate @@ -73,8 +73,8 @@ test_no_invalid_certificate # Stop server and try a "MITM" with a bad certificate. echo pkill -n gnutls-serv -server --x509certfile $srcdir/server-bad.pem \ - --x509keyfile $srcdir/server-key.pem +server --x509certfile "$srcdir/server-bad.pem" \ + --x509keyfile "$srcdir/server-key.pem" sleep 1 rm -f certificate-localhost-proxy.pem certificate-localhost-server.pem @@ -90,7 +90,7 @@ test_proxy_successful test_invalid_certificate # Create the proxy certificate. -$srcdir/../src/tlsproxy-add localhost $srcdir/server.pem \ +"$srcdir/../src/tlsproxy-add" localhost "$srcdir/server.pem" \ >/dev/null 2>/dev/null echo mitm missing server certificate diff --git a/tests/tests-passthrough.sh b/tests/tests-passthrough.sh index 253d160..c93fbba 100755 --- a/tests/tests-passthrough.sh +++ b/tests/tests-passthrough.sh @@ -21,17 +21,17 @@ # Handle empty $srcdir. [ "x$srcdir" = x ] && srcdir=. -. $srcdir/common.sh +. "$srcdir/common.sh" # Create necessary files. cleanup -$srcdir/../src/tlsproxy-setup >/dev/null 2>/dev/null +"$srcdir/../src/tlsproxy-setup" >/dev/null 2>/dev/null # Normal tests. ../src/tlsproxy -d2 -u 4711 >/dev/null & -server --x509certfile $srcdir/server.pem \ - --x509keyfile $srcdir/server-key.pem +server --x509certfile "$srcdir/server.pem" \ + --x509keyfile "$srcdir/server-key.pem" sleep 1 @@ -46,7 +46,7 @@ test_proxy_successful test_invalid_certificate # Create the proxy certificate. -$srcdir/../src/tlsproxy-add localhost $srcdir/server.pem \ +"$srcdir/../src/tlsproxy-add" localhost "$srcdir/server.pem" \ >/dev/null 2>/dev/null echo missing server certificate @@ -75,8 +75,8 @@ test_no_invalid_certificate # Stop server and try a "MITM" with a bad certificate. echo pkill -n gnutls-serv -server --x509certfile $srcdir/server-bad.pem \ - --x509keyfile $srcdir/server-key.pem +server --x509certfile "$srcdir/server-bad.pem" \ + --x509keyfile "$srcdir/server-key.pem" sleep 1 rm -f certificate-localhost-proxy.pem certificate-localhost-server.pem @@ -92,7 +92,7 @@ test_proxy_successful test_invalid_certificate # Create the proxy certificate. -$srcdir/../src/tlsproxy-add localhost $srcdir/server.pem \ +"$srcdir/../src/tlsproxy-add" localhost "$srcdir/server.pem" \ >/dev/null 2>/dev/null echo mitm missing server certificate diff --git a/tests/tests.sh b/tests/tests.sh index d831db3..6a87957 100755 --- a/tests/tests.sh +++ b/tests/tests.sh @@ -22,9 +22,9 @@ [ "x$srcdir" = x ] && srcdir=. echo "RUNNING NORMAL TESTS" -$srcdir/tests-normal.sh || exit 1 +"$srcdir/tests-normal.sh" || exit 1 echo echo "RUNNING PASSTHROUGH (-u) TESTS" -$srcdir/tests-passthrough.sh || exit 1 +"$srcdir/tests-passthrough.sh" || exit 1