openconnect: simplified cmdline appending
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Fri, 5 Dec 2014 19:27:45 +0000 (20:27 +0100)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Fri, 5 Dec 2014 19:27:45 +0000 (20:27 +0100)
Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
net/openconnect/files/openconnect.sh

index 307e3a758f7645b2f29ba0d9aa0e0bef5aaf8a41..ca8fff97d2bd09fe20a1360a01e7303f584a27c3 100755 (executable)
@@ -38,10 +38,16 @@ proto_openconnect_setup() {
 
        cmdline="$server$port -i vpn-$config --non-inter --syslog --script /lib/netifd/vpnc-script"
 
-       [ -f /etc/openconnect/ca-vpn-$config.pem ] && append cmdline "--no-system-trust --cafile /etc/openconnect/ca-vpn-$config.pem"
        [ -f /etc/openconnect/user-cert-vpn-$config.pem ] && append cmdline "-c /etc/openconnect/user-cert-vpn-$config.pem"
        [ -f /etc/openconnect/user-key-vpn-$config.pem ] && append cmdline "--sslkey /etc/openconnect/user-key-vpn-$config.pem"
-       [ -n "$serverhash" ] && append cmdline "--no-system-trust --servercert=$serverhash"
+       if test -f /etc/openconnect/ca-vpn-$config.pem;then
+               append cmdline "--cafile /etc/openconnect/ca-vpn-$config.pem"
+               append cmdline "--no-system-trust"
+       fi
+       if test -n "$serverhash";then
+               append cmdline " --servercert=$serverhash"
+               append cmdline "--no-system-trust"
+       fi
        [ -n "$authgroup" ] && append cmdline "--authgroup $authgroup"
        [ -n "$username" ] && append cmdline "-u $username"
        [ -n "$password" ] && {