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>
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##*/}!"