diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1998-02-16 06:28:50 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1998-02-16 06:28:50 +0000 |
commit | bd57c85d9a2cc1e95e0ae16168b764204755e143 (patch) | |
tree | 61136f88ae3f61465fef9f5a224a35364cadfae7 /socket.c | |
parent | 9e96c6bc3494dfe34655a02df8f735bce71d86a6 (diff) | |
download | fetchmail-bd57c85d9a2cc1e95e0ae16168b764204755e143.tar.gz fetchmail-bd57c85d9a2cc1e95e0ae16168b764204755e143.tar.bz2 fetchmail-bd57c85d9a2cc1e95e0ae16168b764204755e143.zip |
Alll of Craig Metz's changes for IPv6 and IPSEC except the POP3 stuff.
svn path=/trunk/; revision=1630
Diffstat (limited to 'socket.c')
-rw-r--r-- | socket.c | 35 |
1 files changed, 35 insertions, 0 deletions
@@ -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) |