-#endif
-#endif /* NET_SECURITY */
-
- freeaddrinfo(ai0);
-
- return i;
-}
-#else /* INET6_ENABLE */
-#ifndef HAVE_INET_ATON
-#ifndef INADDR_NONE
-#ifdef INADDR_BROADCAST
-#define INADDR_NONE INADDR_BROADCAST
-#else
-#define INADDR_NONE -1
-#endif
-#endif
-#endif /* HAVE_INET_ATON */
-
-int SockOpen(const char *host, int clientPort, const char *options,
- const char *plugin)
-{
- int sock = -1; /* pacify -Wall */
-#ifndef HAVE_INET_ATON
- unsigned long inaddr;
-#endif /* HAVE_INET_ATON */
- struct sockaddr_in ad, **pptr;
- struct hostent *hp;
-
-#ifdef HAVE_SOCKETPAIR
- if (plugin) {
- char buf[10];
-#ifdef HAVE_SNPRINTF
- snprintf(buf, sizeof(buf), /* Yeah, paranoic. So what? :P */
-#else
- sprintf(buf,
-#endif /* HAVE_SNPRINTF */
- "%d",clientPort);
- return handle_plugin(host,buf,plugin);
- }
-#endif /* HAVE_SOCKETPAIR */
-
- memset(&ad, 0, sizeof(ad));
- ad.sin_family = AF_INET;
-
- /* we'll accept a quad address */
-#ifndef HAVE_INET_ATON
- inaddr = inet_addr((char*)host);
- if (inaddr != INADDR_NONE)
- {
- memcpy(&ad.sin_addr, &inaddr, sizeof(inaddr));
-#else
- if (inet_aton(host, &ad.sin_addr))
- {
-#endif /* HAVE_INET_ATON */
- ad.sin_port = htons(clientPort);
-
- sock = socket(AF_INET, SOCK_STREAM, 0);
- if (sock < 0)
- {
- h_errno = 0;
- return -1;
- }
-
- /* Socket opened saved. Usefull if connect timeout because
- * it can be closed
- */
- mailserver_socket_temp = sock;
-
- if (connect(sock, (struct sockaddr *) &ad, sizeof(ad)) < 0)
- {
- int olderr = errno;
- fm_close(sock); /* don't use SockClose, no traffic yet */
- h_errno = 0;
- errno = olderr;
- return -1;
- }
-
- /* No connect timeout, then no need to set mailserver_socket_temp */
- mailserver_socket_temp = -1;
-
-#ifndef HAVE_INET_ATON
- }
-#else