]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
Fix key filename mangling in auth-certificate test
authorDavid Woodhouse <dwmw2@infradead.org>
Wed, 7 Apr 2021 15:57:18 +0000 (16:57 +0100)
committerDavid Woodhouse <dwmw2@infradead.org>
Wed, 7 Apr 2021 16:00:48 +0000 (17:00 +0100)
We want to strip the -key-xxx.yyy suffix from the key filename and
replace it with -cert.pem to find the corresponding certificate.

The original implementation was stripping all from the first - but
that fails when ${srcdir} contains a hyphen, so fix it up to be
more precise.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
tests/auth-certificate

index 615d5f2016645d1ac2e882d94d65c00591012ff3..7cd2785edb9dd7ed56f797d605a66c7acce958b0 100755 (executable)
@@ -38,7 +38,7 @@ for KEY in ${key_list}; do
     if [ "${KEY%%.p12}" != "${KEY}" ]; then
        CERTARGS="-c ${KEY} --key-password password"
     else
-       CERTARGS="--sslkey ${KEY} --key-password password -c ${KEY%%-*}-cert.pem "
+       CERTARGS="--sslkey ${KEY} --key-password password -c ${KEY%-key-*}-cert.pem "
     fi
     ( echo "test" | LD_PRELOAD=libsocket_wrapper.so $OPENCONNECT -q $ADDRESS:443 -u test $CERTARGS --servercert=d66b507ae074d03b02eafca40d35f87dd81049d3 --cookieonly --passwd-on-stdin ) ||
        fail $PID "Could not connect with key ${KEY##*/}!"