Mercurial > dropbear
changeset 335:e17f0333c21e
Another stab at getting ss_family happy on older glibc
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Mon, 12 Jun 2006 15:57:14 +0000 |
parents | 8f3ec7c104d9 |
children | 2dd116db1956 |
files | configure.in dbutil.c includes.h |
diffstat | 3 files changed, 10 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.in Mon Jun 12 14:41:32 2006 +0000 +++ b/configure.in Mon Jun 12 15:57:14 2006 +0000 @@ -342,7 +342,7 @@ #endif ]) -AC_CHECK_MEMBERS([struct utmpx.ut_host, struct utmpx.ut_syslen, struct utmpx.ut_type, struct utmpx.ut_id, struct utmpx.ut_addr, struct utmpx.ut_addr_v6, struct utmpx.ut_time, struct utmpx.ut_tv, struct sockaddr_storage.ss_family, struct sockadd_storage.__family],,,[ +AC_CHECK_MEMBERS([struct utmpx.ut_host, struct utmpx.ut_syslen, struct utmpx.ut_type, struct utmpx.ut_id, struct utmpx.ut_addr, struct utmpx.ut_addr_v6, struct utmpx.ut_time, struct utmpx.ut_tv],,,[ #include <sys/types.h> #include <sys/socket.h> #if HAVE_UTMPX_H @@ -350,6 +350,8 @@ #endif ]) +AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family],,,[]) + AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent) AC_CHECK_FUNCS(utmpname) AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
--- a/dbutil.c Mon Jun 12 14:41:32 2006 +0000 +++ b/dbutil.c Mon Jun 12 15:57:14 2006 +0000 @@ -400,7 +400,10 @@ len = sizeof(struct sockaddr_storage); /* Some platforms such as Solaris 8 require that len is the length - * of the specific structure. */ + * of the specific structure. Some older linux systems (glibc 2.1.3 + * such as debian potato) have sockaddr_storage.__ss_family instead + * but we'll ignore them */ +#ifdef HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY if (addr->ss_family == AF_INET) { len = sizeof(struct sockaddr_in); } @@ -409,6 +412,7 @@ len = sizeof(struct sockaddr_in6); } #endif +#endif ret = getnameinfo((struct sockaddr*)addr, len, hbuf, sizeof(hbuf), sbuf, sizeof(sbuf), NI_NUMERICSERV | NI_NUMERICHOST); @@ -448,6 +452,7 @@ len = sizeof(struct sockaddr_storage); /* Some platforms such as Solaris 8 require that len is the length * of the specific structure. */ +#ifdef HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY if (addr->ss_family == AF_INET) { len = sizeof(struct sockaddr_in); } @@ -456,6 +461,7 @@ len = sizeof(struct sockaddr_in6); } #endif +#endif ret = getnameinfo((struct sockaddr*)addr, len, hbuf, sizeof(hbuf),
--- a/includes.h Mon Jun 12 14:41:32 2006 +0000 +++ b/includes.h Mon Jun 12 15:57:14 2006 +0000 @@ -135,13 +135,6 @@ #define LOG_AUTHPRIV LOG_AUTH #endif -/* glibc 2.1.3 systems have sockaddr_storage.__ss_family rather than - * sockaddr_storage.ss_family */ -#if !defined(HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY) \ - && defined(HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY) -#define ss_family __ss_family -#endif - /* so we can avoid warnings about unused params (ie in signal handlers etc) */ #ifdef UNUSED #elif defined(__GNUC__)