mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-17 14:07:03 +01:00
dirmngr,w32: Remove gethostbyname hack and make it build again.
* dirmngr/http.c (connect_server) [W32]: Remove gethostbyname hack; we require getaddrinfo anyway. * dirmngr/dns-stuff.c (AI_ADDRCONFIG): Add replacement if not defined. (map_eai_to_gpg_error) [W32]: Take care of unsupported codes. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
c18fb0d99b
commit
7735bbe539
@ -59,6 +59,11 @@
|
||||
# error AF_UNSPEC does not have the value 0
|
||||
#endif
|
||||
|
||||
/* Windows does not support tge AI_ADDRCONFIG flag - use zero instead. */
|
||||
#ifndef AI_ADDRCONFIG
|
||||
# define AI_ADDRCONFIG 0
|
||||
#endif
|
||||
|
||||
/* Not every installation has gotten around to supporting SRVs or
|
||||
CERTs yet... */
|
||||
#ifndef T_SRV
|
||||
@ -115,10 +120,12 @@ map_eai_to_gpg_error (int ec)
|
||||
case EAI_NODATA: err = gpg_error (GPG_ERR_NO_DATA); break;
|
||||
case EAI_NONAME: err = gpg_error (GPG_ERR_NO_NAME); break;
|
||||
case EAI_SERVICE: err = gpg_error (GPG_ERR_NOT_SUPPORTED); break;
|
||||
case EAI_ADDRFAMILY:err = gpg_error (GPG_ERR_EADDRNOTAVAIL); break;
|
||||
case EAI_FAMILY: err = gpg_error (GPG_ERR_EAFNOSUPPORT); break;
|
||||
case EAI_SOCKTYPE: err = gpg_error (GPG_ERR_ESOCKTNOSUPPORT); break;
|
||||
#ifndef HAVE_W32_SYSTEM
|
||||
case EAI_ADDRFAMILY:err = gpg_error (GPG_ERR_EADDRNOTAVAIL); break;
|
||||
case EAI_SYSTEM: err = gpg_error_from_syserror (); break;
|
||||
#endif
|
||||
default: err = gpg_error (GPG_ERR_UNKNOWN_ERRNO); break;
|
||||
}
|
||||
return err;
|
||||
|
@ -2205,46 +2205,12 @@ connect_server (const char *server, unsigned short port,
|
||||
int srv, connected;
|
||||
int last_errno = 0;
|
||||
struct srventry *serverlist = NULL;
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
unsigned long inaddr;
|
||||
#endif
|
||||
int ret;
|
||||
|
||||
*r_host_not_found = 0;
|
||||
#ifdef HAVE_W32_SYSTEM
|
||||
|
||||
#ifndef HTTP_NO_WSASTARTUP
|
||||
#if defined(HAVE_W32_SYSTEM) && !defined(HTTP_NO_WSASTARTUP)
|
||||
init_sockets ();
|
||||
#endif
|
||||
/* Win32 gethostbyname doesn't handle IP addresses internally, so we
|
||||
try inet_addr first on that platform only. */
|
||||
inaddr = inet_addr(server);
|
||||
if ( inaddr != INADDR_NONE )
|
||||
{
|
||||
struct sockaddr_in addr;
|
||||
|
||||
memset(&addr,0,sizeof(addr));
|
||||
|
||||
sock = assuan_sock_new (AF_INET, SOCK_STREAM, 0);
|
||||
if (sock == ASSUAN_INVALID_FD)
|
||||
{
|
||||
log_error ("error creating socket: %s\n", strerror (errno));
|
||||
return ASSUAN_INVALID_FD;
|
||||
}
|
||||
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons(port);
|
||||
memcpy (&addr.sin_addr,&inaddr,sizeof(inaddr));
|
||||
|
||||
my_unprotect ();
|
||||
ret = assuan_sock_connect (sock,(struct sockaddr *)&addr,sizeof(addr));
|
||||
my_protect ();
|
||||
if (!ret)
|
||||
return sock;
|
||||
assuan_sock_close (sock);
|
||||
return ASSUAN_INVALID_FD;
|
||||
}
|
||||
#endif /*HAVE_W32_SYSTEM*/
|
||||
#endif /*Windows*/
|
||||
|
||||
#ifdef USE_DNS_SRV
|
||||
/* Do the SRV thing */
|
||||
|
Loading…
x
Reference in New Issue
Block a user