X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Ftcpip.c;h=4efc19a937574905638ccbca2601c1387697e99e;hb=5bc2ee09e4dff0f872ce738a5327bced915e3474;hp=492cfef208b127b2bf190a770ca45d39b8d615fa;hpb=93c659dcd8c21e3ba1b9b1f18fecf229bdce996b;p=yaz-moved-to-github.git diff --git a/src/tcpip.c b/src/tcpip.c index 492cfef..4efc19a 100644 --- a/src/tcpip.c +++ b/src/tcpip.c @@ -580,21 +580,20 @@ int tcpip_rcvconnect(COMSTACK h) #if HAVE_GNUTLS_H if (h->type == ssl_type && !sp->session) { - int res; gnutls_global_init(); - tcpip_create_cred(h); - gnutls_init(&sp->session, GNUTLS_CLIENT); gnutls_set_default_priority(sp->session); gnutls_credentials_set (sp->session, GNUTLS_CRD_CERTIFICATE, sp->cred_ptr->xcred); - /* cast to intermediate size_t to avoid GCC warning. */ gnutls_transport_set_ptr(sp->session, (gnutls_transport_ptr_t) (size_t) h->iofile); - res = gnutls_handshake(sp->session); + } + if (sp->session) + { + int res = gnutls_handshake(sp->session); if (res < 0) { if (ssl_check_error(h, sp, res))