aboutsummaryrefslogtreecommitdiffstats
path: root/socket.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1998-02-21 03:45:49 +0000
committerEric S. Raymond <esr@thyrsus.com>1998-02-21 03:45:49 +0000
commit4005acb9924f35b7c51328c44b4b3986d3be2bee (patch)
treefa56e11169895af72b5bff9f61bf2a182f88ecd6 /socket.c
parent18121bbdd9912ff5a7d3a8714c50b1608b96ae4a (diff)
downloadfetchmail-4005acb9924f35b7c51328c44b4b3986d3be2bee.tar.gz
fetchmail-4005acb9924f35b7c51328c44b4b3986d3be2bee.tar.bz2
fetchmail-4005acb9924f35b7c51328c44b4b3986d3be2bee.zip
Craig's patches in response to cmetz3.
svn path=/trunk/; revision=1664
Diffstat (limited to 'socket.c')
-rw-r--r--socket.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/socket.c b/socket.c
index 9fd04024..bb68833c 100644
--- a/socket.c
+++ b/socket.c
@@ -37,13 +37,13 @@ int SockOpen(const char *host, const char *service, const char *options)
{
int i;
struct addrinfo *ai, req;
+#if NET_SECURITY
+ struct net_security_operation request[NET_SECURITY_OPERATION_MAX];
+ int requestlen;
+#endif /* NET_SECURITY */
memset(&req, 0, sizeof(struct addrinfo));
req.ai_socktype = SOCK_STREAM;
-#if NET_SECURITY
- net_security_operation request[NET_SECURITY_OPERATION_MAX];
- int requestlen = NET_SECURITY_OPERATION_MAX;
-#endif /* NET_SECURITY */
if (i = getaddrinfo(host, service, &req, &ai)) {
fprintf(stderr, "fetchmail: getaddrinfo(%s.%s): %s(%d)\n", host, service, gai_strerror(i), i);
@@ -51,13 +51,19 @@ int SockOpen(const char *host, const char *service, const char *options)
};
#if NET_SECURITY
- if (net_security_strtorequest(options, request, &requestlen))
- i = -1;
+ if (!options)
+ requestlen = 0;
else
- i = inner_connect(ai, request, requestlen, NULL,NULL, "fetchmail", NULL);
+ if (net_security_strtorequest((char *)options, request, &requestlen))
+ goto ret;
+
+ i = inner_connect(ai, request, requestlen, NULL,NULL, "fetchmail", NULL);
+
+ret:
#else /* NET_SECURITY */
i = inner_connect(ai, NULL, 0, NULL, NULL, "fetchmail", NULL);
#endif /* NET_SECURITY */
+
freeaddrinfo(ai);
return i;