aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1997-09-04 02:13:14 +0000
committerEric S. Raymond <esr@thyrsus.com>1997-09-04 02:13:14 +0000
commitb5de78b6bb3e35f019b6745aacc33612db160afc (patch)
treeabc98933159782a2574571ca359cd73617961e2c
parent0fb53c7bb00e0057f0b5df5843a840ffcabd289a (diff)
downloadfetchmail-b5de78b6bb3e35f019b6745aacc33612db160afc.tar.gz
fetchmail-b5de78b6bb3e35f019b6745aacc33612db160afc.tar.bz2
fetchmail-b5de78b6bb3e35f019b6745aacc33612db160afc.zip
inet_aton.
svn path=/trunk/; revision=1295
-rw-r--r--NEWS3
-rw-r--r--configure.in3
-rw-r--r--socket.c23
3 files changed, 27 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 51306ed8..fb6d856c 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,9 @@
Release Notes:
------------------------------------------------------------------------------
+fetchmail-4.1.3 ()
+* Autoconfigure cortrectly for systems that lack inet_aton().
+
fetchmail-4.1.2 (Wed Sep 3 18:44:58 EDT 1997)
* Fixed a bonehead bug in RCPT TO name generation introduced in 4.1.1.
* Added James Steven's ip-up wrapper to the contrib directory.
diff --git a/configure.in b/configure.in
index 562f4fa9..949e68c2 100644
--- a/configure.in
+++ b/configure.in
@@ -75,7 +75,8 @@ AC_SUBST(EXTRASRC)
AC_SUBST(EXTRAOBJ)
AC_CHECK_FUNCS(tcsetattr stty setsid seteuid gethostbyname res_search herror \
- strrchr strerror setlinebuf syslog snprintf vsnprintf vsyslog atexit)
+ strrchr strerror setlinebuf syslog snprintf vsnprintf vsyslog atexit \
+ inet_aton)
# Under Red Hat 4.0 (and many other Linuxes) -lresolv is seriously flaky
# and breaks gethostbyname(2). It's better to use the bind stuff in the C
diff --git a/socket.c b/socket.c
index 260d7cf2..ca4f0e16 100644
--- a/socket.c
+++ b/socket.c
@@ -25,6 +25,16 @@
#endif
#include "socket.h"
+#ifndef INET_ATON
+#ifndef INADDR_NONE
+#ifdef INADDR_BROADCAST
+#define INADDR_NONE INADDR_BROADCAST
+#else
+#define INADDR_NONE -1
+#endif
+#endif
+#endif /* INET_ATON */
+
#ifdef SUNOS
#include <memory.h>
#endif
@@ -32,13 +42,24 @@
int SockOpen(char *host, int clientPort)
{
int sock;
+#ifndef INET_ATON
+ unsigned long inaddr;
+#endif /* INET_ATON */
struct sockaddr_in ad;
struct hostent *hp;
memset(&ad, 0, sizeof(ad));
ad.sin_family = AF_INET;
- if (!inet_aton(host, &ad.sin_addr)) /* accept a quad address */
+ /* we'll accept a quad address */
+#ifndef INET_ATON
+ inaddr = inet_addr(host);
+ if (inaddr != INADDR_NONE)
+ memcpy(&ad.sin_addr, &inaddr, sizeof(inaddr));
+ else
+#else
+ if (!inet_aton(host, &ad.sin_addr))
+#endif /* INET_ATON */
{
hp = gethostbyname(host);