[gnutls-devel] [PATCH 4/4] tests: openpgp-certs: cleanup shell usage

Alon Bar-Lev alon.barlev at gmail.com
Thu Jun 18 08:41:55 CEST 2015


Add quotes for most usages of variables.

Added ${} for variables.

Signed-off-by: Alon Bar-Lev <alon.barlev at gmail.com>
---
 tests/openpgp-certs/testcerts    | 50 ++++++++++++++++++++--------------------
 tests/openpgp-certs/testselfsigs |  8 +++----
 2 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/tests/openpgp-certs/testcerts b/tests/openpgp-certs/testcerts
index add6908..c8d25d1 100755
--- a/tests/openpgp-certs/testcerts
+++ b/tests/openpgp-certs/testcerts
@@ -29,59 +29,59 @@ if test "${WINDIR}" != "";then
   exit 77
 fi 
 
-. $srcdir/../scripts/common.sh
+. "${srcdir}/../scripts/common.sh"
 
 PORT="${PORT:-$RPORT}"
 
 echo "Checking OpenPGP certificate verification"
 
-launch_server $$ --priority NORMAL:+CTYPE-OPENPGP --pgpcertfile $srcdir/srv-public-127.0.0.1-signed.gpg --pgpkeyfile $srcdir/srv-secret.gpg >/dev/null 2>&1 & PID=$!
-wait_server $PID
+launch_server $$ --priority NORMAL:+CTYPE-OPENPGP --pgpcertfile "${srcdir}/srv-public-127.0.0.1-signed.gpg" --pgpkeyfile "${srcdir}/srv-secret.gpg" >/dev/null 2>&1 & PID=$!
+wait_server ${PID}
 
 # give the server a chance to initialize
 
 #gnutls currently only considers PGP certificates verified only if
 #all user IDs in the certificate were signed.
 
-#$CLI -p $PORT 127.0.0.1 --pgpkeyring ca-public.gpg </dev/null >/dev/null || \
+#"${CLI}" -p "${PORT}" 127.0.0.1 --pgpkeyring ca-public.gpg </dev/null >/dev/null || \
 #  fail "Connection to verified IP address should have succeeded! (error code $?)" $?
 
-$CLI $DEBUG -p $PORT 127.0.0.2 --priority NORMAL:+CTYPE-OPENPGP --pgpkeyring $srcdir/ca-public.gpg </dev/null >/dev/null 2>&1 && \
-  fail $PID "Connection to unrecognized IP address should have failed!"
+"${CLI}" ${DEBUG} -p "${PORT}" 127.0.0.2 --priority NORMAL:+CTYPE-OPENPGP --pgpkeyring "${srcdir}/ca-public.gpg" </dev/null >/dev/null 2>&1 && \
+  fail ${PID} "Connection to unrecognized IP address should have failed!"
 
-$CLI $DEBUG -p $PORT localhost --priority NORMAL:+CTYPE-OPENPGP --pgpkeyring $srcdir/ca-public.gpg </dev/null >/dev/null 2>&1 && \
-  fail $PID "Connection to unverified (but present) 'localhost' should have failed!"
+"${CLI}" ${DEBUG} -p "${PORT}" localhost --priority NORMAL:+CTYPE-OPENPGP --pgpkeyring "${srcdir}/ca-public.gpg" </dev/null >/dev/null 2>&1 && \
+  fail ${PID} "Connection to unverified (but present) 'localhost' should have failed!"
 
-kill $PID
+kill ${PID}
 wait
 
-launch_server $$ --priority NORMAL:+CTYPE-OPENPGP --pgpcertfile $srcdir/srv-public-localhost-signed.gpg --pgpkeyfile $srcdir/srv-secret.gpg >/dev/null 2>&1 & PID=$!
-wait_server $PID
+launch_server $$ --priority NORMAL:+CTYPE-OPENPGP --pgpcertfile "${srcdir}/srv-public-localhost-signed.gpg" --pgpkeyfile "${srcdir}/srv-secret.gpg" >/dev/null 2>&1 & PID=$!
+wait_server ${PID}
 
-echo | $CLI $DEBUG --priority NORMAL:+CTYPE-OPENPGP -p $PORT 127.0.0.1 --pgpkeyring $srcdir/ca-public.gpg </dev/null >/dev/null 2>&1 && \
-  fail $PID "Connection to unverified IP address should have failed! (error code $?)" $?
+echo | "${CLI}" ${DEBUG} --priority NORMAL:+CTYPE-OPENPGP -p "${PORT}" 127.0.0.1 --pgpkeyring "${srcdir}/ca-public.gpg" </dev/null >/dev/null 2>&1 && \
+  fail ${PID} "Connection to unverified IP address should have failed! (error code $?)" $?
 
-$CLI $DEBUG --priority NORMAL:+CTYPE-OPENPGP -p $PORT 127.0.0.2 --pgpkeyring $srcdir/ca-public.gpg </dev/null >/dev/null 2>&1 && \
-  fail $PID "Connection to unrecognized IP address should have failed!"
+"${CLI}" ${DEBUG} --priority NORMAL:+CTYPE-OPENPGP -p "${PORT}" 127.0.0.2 --pgpkeyring "${srcdir}/ca-public.gpg" </dev/null >/dev/null 2>&1 && \
+  fail ${PID} "Connection to unrecognized IP address should have failed!"
 
 #see reason above
-#$CLI -p $PORT localhost --pgpkeyring ca-public.gpg </dev/null >/dev/null || \
-#  fail $PID "Connection to verified 'localhost' should have succeded! (error code $?)" $?
+#"${CLI}" -p "${PORT}" localhost --pgpkeyring ca-public.gpg </dev/null >/dev/null || \
+#  fail ${PID} "Connection to verified 'localhost' should have succeded! (error code $?)" $?
 
-kill $PID
+kill ${PID}
 wait
 
-launch_server $$ --priority NORMAL:+CTYPE-OPENPGP --pgpcertfile $srcdir/srv-public-all-signed.gpg --pgpkeyfile $srcdir/srv-secret.gpg >/dev/null 2>&1 & PID=$!
-wait_server $PID
+launch_server $$ --priority NORMAL:+CTYPE-OPENPGP --pgpcertfile "${srcdir}/srv-public-all-signed.gpg" --pgpkeyfile "${srcdir}/srv-secret.gpg" >/dev/null 2>&1 & PID=$!
+wait_server ${PID}
 
 # give the server a chance to initialize
-echo | $CLI $DEBUG --priority NORMAL:+CTYPE-OPENPGP -p $PORT 127.0.0.1 --pgpkeyring $srcdir/ca-public.gpg </dev/null >/dev/null || \
-  fail $PID "Connection to signed PGP certificate should have succeeded! (error code $?)" $?
+echo | "${CLI}" ${DEBUG} --priority NORMAL:+CTYPE-OPENPGP -p "${PORT}" 127.0.0.1 --pgpkeyring "${srcdir}/ca-public.gpg" </dev/null >/dev/null || \
+  fail ${PID} "Connection to signed PGP certificate should have succeeded! (error code $?)" $?
 
-$CLI $DEBUG --priority NORMAL:+CTYPE-OPENPGP -p $PORT 127.0.0.2 --pgpkeyring $srcdir/ca-public.gpg </dev/null >/dev/null 2>&1 && \
-  fail $PID "Connection to unrecognized IP address should have failed!"
+"${CLI}" ${DEBUG} --priority NORMAL:+CTYPE-OPENPGP -p "${PORT}" 127.0.0.2 --pgpkeyring "${srcdir}/ca-public.gpg" </dev/null >/dev/null 2>&1 && \
+  fail ${PID} "Connection to unrecognized IP address should have failed!"
 
-kill $PID
+kill ${PID}
 wait
 
 exit 0
diff --git a/tests/openpgp-certs/testselfsigs b/tests/openpgp-certs/testselfsigs
index 3c99a6f..c997f9a 100755
--- a/tests/openpgp-certs/testselfsigs
+++ b/tests/openpgp-certs/testselfsigs
@@ -34,19 +34,19 @@ fail() {
 
 echo "Checking OpenPGP certificate self verification"
 
-($CERTTOOL --inraw --pgp-certificate-info --infile $srcdir/selfsigs/alice.pub \
+("${CERTTOOL}" --inraw --pgp-certificate-info --infile "${srcdir}/selfsigs/alice.pub" \
     | grep "^Self Signature verification: ok" > /dev/null) || \
     fail "Self sig Verification should have succeeded!"
 
-($CERTTOOL --inraw --pgp-certificate-info --infile $srcdir/selfsigs/alice-mallory-badsig18.pub \
+("${CERTTOOL}" --inraw --pgp-certificate-info --infile "${srcdir}/selfsigs/alice-mallory-badsig18.pub" \
     | grep "^Self Signature verification: failed" > /dev/null) || \
     fail "Self sig Verification should have failed!"
 
-($CERTTOOL --inraw --pgp-certificate-info --infile $srcdir/selfsigs/alice-mallory-irrelevantsig.pub \
+("${CERTTOOL}" --inraw --pgp-certificate-info --infile "${srcdir}/selfsigs/alice-mallory-irrelevantsig.pub" \
     | grep "^Self Signature verification: failed" >/dev/null) || \
     fail "Self sig Verification should have failed!"
 
-($CERTTOOL --inraw --pgp-certificate-info --infile $srcdir/selfsigs/alice-mallory-nosig18.pub \
+("${CERTTOOL}" --inraw --pgp-certificate-info --infile "${srcdir}/selfsigs/alice-mallory-nosig18.pub" \
     | grep "^Self Signature verification: failed" >/dev/null) || \
     fail "Self sig Verification should have failed!"
 
-- 
2.3.6




More information about the Gnutls-devel mailing list