comparison src/tls.c @ 5825:5d5aeb79edb4

Fix build with g++. This patch fixes various issues that cause build failures with g++ 4.8.3. See <CAHCOHQ=6yKcjQELvG8FOHXcWVez+HufUWb4FdcJKpUNhm+8B=g@mail.gmail.com> in xemacs-patches.
author Jerry James <james@xemacs.org>
date Thu, 06 Nov 2014 09:34:06 -0700
parents d59bfb050ca8
children 6eca500211f4 574f0cded429
comparison
equal deleted inserted replaced
5824:6928877dbc26 5825:5d5aeb79edb4
120 addr = (struct sockaddr *) xrealloc (addr, addrlen); 120 addr = (struct sockaddr *) xrealloc (addr, addrlen);
121 getsockname (s, addr, &addrlen); 121 getsockname (s, addr, &addrlen);
122 } 122 }
123 123
124 /* Create the socket */ 124 /* Create the socket */
125 nspr = xmalloc (sizeof (*nspr)); 125 nspr = (tls_state_t *) xmalloc (sizeof (*nspr));
126 nspr->tls_refcount = 2; 126 nspr->tls_refcount = 2;
127 nspr->tls_file_desc = 127 nspr->tls_file_desc =
128 SSL_ImportFD (nss_model, PR_OpenTCPSocket (addr->sa_family)); 128 SSL_ImportFD (nss_model, PR_OpenTCPSocket (addr->sa_family));
129 if (nspr->tls_file_desc == NULL) 129 if (nspr->tls_file_desc == NULL)
130 { 130 {
505 505
506 /* Disable Nagle's algorithm */ 506 /* Disable Nagle's algorithm */
507 setsockopt (s, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val)); 507 setsockopt (s, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val));
508 508
509 /* Create the state object */ 509 /* Create the state object */
510 gnutls = xmalloc (sizeof (*gnutls)); 510 gnutls = (tls_state_t *) xmalloc (sizeof (*gnutls));
511 gnutls->tls_refcount = 2; 511 gnutls->tls_refcount = 2;
512 512
513 /* Initialize the session object */ 513 /* Initialize the session object */
514 err = gnutls_init (&gnutls->tls_session, GNUTLS_CLIENT); 514 err = gnutls_init (&gnutls->tls_session, GNUTLS_CLIENT);
515 if (err != GNUTLS_E_SUCCESS) 515 if (err != GNUTLS_E_SUCCESS)
613 if (status != 0U) 613 if (status != 0U)
614 { 614 {
615 gnutls_datum_t msg; 615 gnutls_datum_t msg;
616 616
617 #ifdef HAVE_GNUTLS_CERTIFICATE_VERIFICATION_STATUS_PRINT 617 #ifdef HAVE_GNUTLS_CERTIFICATE_VERIFICATION_STATUS_PRINT
618 int type = gnutls_certificate_type_get (gnutls->tls_session); 618 gnutls_certificate_type_t type;
619
620 type = gnutls_certificate_type_get (gnutls->tls_session);
619 err = 621 err =
620 gnutls_certificate_verification_status_print (status, type, &msg, 0); 622 gnutls_certificate_verification_status_print (status, type, &msg, 0);
621 #else 623 #else
622 err = -1; 624 err = -1;
623 #endif /* HAVE_GNUTLS_CERTIFICATE_VERIFICATION_STATUS_PRINT */ 625 #endif /* HAVE_GNUTLS_CERTIFICATE_VERIFICATION_STATUS_PRINT */
964 966
965 /* Disable Nagle's algorithm */ 967 /* Disable Nagle's algorithm */
966 setsockopt (s, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val)); 968 setsockopt (s, IPPROTO_TCP, TCP_NODELAY, &val, sizeof(val));
967 969
968 /* Create the state object */ 970 /* Create the state object */
969 openssl = xmalloc (sizeof (*openssl)); 971 openssl = (tls_state_t *) xmalloc (sizeof (*openssl));
970 openssl->tls_refcount = 2; 972 openssl->tls_refcount = 2;
971 973
972 /* Create the connection object */ 974 /* Create the connection object */
973 openssl->tls_connection = SSL_new (ssl_ctx); 975 openssl->tls_connection = SSL_new (ssl_ctx);
974 if (openssl->tls_connection == NULL) 976 if (openssl->tls_connection == NULL)