From bd57c85d9a2cc1e95e0ae16168b764204755e143 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Mon, 16 Feb 1998 06:28:50 +0000 Subject: Alll of Craig Metz's changes for IPv6 and IPSEC except the POP3 stuff. svn path=/trunk/; revision=1630 --- socket.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'socket.c') diff --git a/socket.c b/socket.c index 58ca8cfd..d2545123 100644 --- a/socket.c +++ b/socket.c @@ -28,6 +28,40 @@ #endif #include "socket.h" +#if NETSEC +#if MAIN +void *request = NULL; +int requestlen = 0; +#else /* MAIN */ +extern void *request; +extern int requestlen; +#endif /* MAIN */ +#endif /* NETSEC */ + +#if INET6 +int SockOpen(const char *host, const char *service) +{ + int i; + struct addrinfo *ai, req; + + memset(&req, 0, sizeof(struct addrinfo)); + req.ai_socktype = SOCK_STREAM; + + if (i = getaddrinfo(host, service, &req, &ai)) { + fprintf(stderr, "fetchmail: getaddrinfo(%s.%s): %s(%d)\n", host, service, gai_strerror(i), i); + return -1; + }; + +#if NETSEC + i = inner_connect(ai, request, requestlen, NULL, NULL, "fetchmail", NULL); +#else /* NETSEC */ + i = inner_connect(ai, NULL, 0, NULL, NULL, "fetchmail", NULL); +#endif /* NETSEC */ + freeaddrinfo(ai); + + return i; +}; +#else /* INET6 */ #ifndef INET_ATON #ifndef INADDR_NONE #ifdef INADDR_BROADCAST @@ -84,6 +118,7 @@ int SockOpen(const char *host, int clientPort) return(sock); } +#endif /* INET6 */ #if defined(HAVE_STDARG_H) -- cgit v1.2.3