Fix GNU TLS backend under Windows.

This commit is contained in:
Giuseppe Scrivano 2010-06-15 13:03:13 +02:00
parent b7814f7cf3
commit 5af14a7589
3 changed files with 16 additions and 2 deletions

View File

@ -1,3 +1,10 @@
2010-06-15 Giuseppe Scrivano <gscrivano@gnu.org>
* gnutls.c [WIN32]: Include "w32sock.h".
(FD_TO_SOCKET): Add definition.
(ssl_connect_wget): Get the real socket handle by FD_TO_SOCKET.
Define FD_TO_SOCKET if it is not yet defined.
2010-06-14 Giuseppe Scrivano <gscrivano@gnu.org>
* gnutls.c: Include <stdlib.h>.

View File

@ -47,6 +47,10 @@ as that of the covered work. */
#include "url.h"
#include "ssl.h"
#ifdef WIN32
# include "w32sock.h"
#endif
/* Note: some of the functions private to this file have names that
begin with "wgnutls_" (e.g. wgnutls_read) so that they wouldn't be
confused with actual gnutls functions -- such as the gnutls_read
@ -196,7 +200,10 @@ ssl_connect_wget (int fd)
gnutls_set_default_priority (session);
gnutls_certificate_type_set_priority (session, cert_type_priority);
gnutls_credentials_set (session, GNUTLS_CRD_CERTIFICATE, credentials);
gnutls_transport_set_ptr (session, (gnutls_transport_ptr) fd);
#ifndef FD_TO_SOCKET
# define FD_TO_SOCKET(X) (X)
#endif
gnutls_transport_set_ptr (session, (gnutls_transport_ptr) FD_TO_SOCKET (fd));
err = gnutls_handshake (session);
if (err < 0)
{

View File

@ -398,7 +398,7 @@ ssl_connect_wget (int fd)
if (!conn)
goto error;
#ifndef FD_TO_SOCKET
# define FD_TO_SOCKET(x) (x)
# define FD_TO_SOCKET(X) (X)
#endif
if (!SSL_set_fd (conn, FD_TO_SOCKET (fd)))
goto error;