Fix GnuTLS request_passphrase() if no UI callback function
authorDavid Woodhouse <David.Woodhouse@intel.com>
Thu, 31 May 2012 22:48:08 +0000 (23:48 +0100)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Thu, 31 May 2012 22:48:08 +0000 (23:48 +0100)
If it's NULL, don't call it. Also change 'gnutls' to 'ssl' in the auth_id,
since we may end up using this on the OpenSSL side too.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
gnutls.c

index 1ecc260..cbb972b 100644 (file)
--- a/gnutls.c
+++ b/gnutls.c
@@ -193,13 +193,16 @@ static int request_passphrase(struct openconnect_info *vpninfo,
        va_list args;
        int ret;
 
+       if (!vpninfo->process_auth_form)
+               return -EINVAL;
+
        buf[1023] = 0;
        memset(&f, 0, sizeof(f));
        va_start(args, fmt);
        vsnprintf(buf, 1023, fmt, args);
        va_end(args);
 
-       f.auth_id = (char *)"gnutls_certificate";
+       f.auth_id = (char *)"ssl_certificate";
        f.opts = &o;
 
        o.next = NULL;