aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--acinclude.m424
-rw-r--r--configure.ac2
-rw-r--r--lib/ftp.c7
3 files changed, 31 insertions, 2 deletions
diff --git a/acinclude.m4 b/acinclude.m4
index 73e8348e2..f086a37ee 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -122,6 +122,30 @@ dnl end of non-blocking try-compile test
fi
])
+dnl Check for struct sockaddr_storage. Most IPv6-enabled hosts have it, but
+dnl AIX 4.3 is one known exception.
+AC_DEFUN([TYPE_SOCKADDR_STORAGE],
+[
+ AC_CHECK_TYPE([struct sockaddr_storage],
+ AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
+ [if struct sockaddr_storage is defined]), ,
+ [
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+ ])
+
+])
+
dnl Check for socklen_t: historically on BSD it is an int, and in
dnl POSIX 1g it is a type of its own, but some platforms use different
dnl types for the argument to getsockopt, getpeername, etc. So we
diff --git a/configure.ac b/configure.ac
index f65f8fb20..dcb8067fb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1400,6 +1400,8 @@ AC_CHECK_TYPE(ssize_t, ,
TYPE_SOCKLEN_T
TYPE_IN_ADDR_T
+TYPE_SOCKADDR_STORAGE
+
AC_FUNC_SELECT_ARGTYPES
dnl Checks for library functions.
diff --git a/lib/ftp.c b/lib/ftp.c
index a01c3d8e7..70be8692b 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -777,9 +777,12 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
/******************************************************************
* IPv6-specific section
*/
-
- struct addrinfo *res, *ai;
+#ifdef HAVE_STRUCT_SOCKADDR_STORAGE
struct sockaddr_storage ss;
+#else
+ char ss[256]; /* this should be big enough to fit a lot */
+#endif
+ struct addrinfo *res, *ai;
socklen_t sslen;
char hbuf[NI_MAXHOST];
struct sockaddr *sa=(struct sockaddr *)&ss;