Use HAVE_STRUCT_TIMESPEC and HAVE_STRUCT_IN6_ADDR instead of

HAVE_TIMESPEC and HAVE_IN6_ADDR respectively.
This commit is contained in:
Todd C. Miller
2011-12-01 11:07:17 -05:00
parent 3f4b68dd18
commit 51e45647ae
10 changed files with 33 additions and 35 deletions

View File

@@ -43,7 +43,7 @@
#if TIME_WITH_SYS_TIME #if TIME_WITH_SYS_TIME
# include <time.h> # include <time.h>
#endif #endif
#ifndef HAVE_TIMESPEC #ifndef HAVE_STRUCT_TIMESPEC
# include "compat/timespec.h" # include "compat/timespec.h"
#endif #endif

View File

@@ -24,7 +24,7 @@
#if TIME_WITH_SYS_TIME #if TIME_WITH_SYS_TIME
# include <time.h> # include <time.h>
#endif #endif
#ifndef HAVE_TIMESPEC #ifndef HAVE_STRUCT_TIMESPEC
# include "compat/timespec.h" # include "compat/timespec.h"
#endif #endif
#include <errno.h> #include <errno.h>

View File

@@ -218,9 +218,6 @@
/* Define to 1 if your Kerberos is Heimdal. */ /* Define to 1 if your Kerberos is Heimdal. */
#undef HAVE_HEIMDAL #undef HAVE_HEIMDAL
/* Define to 1 if <netinet/in.h> contains struct in6_addr. */
#undef HAVE_IN6_ADDR
/* Define to 1 if you have the `initprivs' function. */ /* Define to 1 if you have the `initprivs' function. */
#undef HAVE_INITPRIVS #undef HAVE_INITPRIVS
@@ -459,7 +456,7 @@
/* Define to 1 if you have the `sia_ses_init' function. */ /* Define to 1 if you have the `sia_ses_init' function. */
#undef HAVE_SIA_SES_INIT #undef HAVE_SIA_SES_INIT
/* Define to 1 if <signal.h> has the sigaction_t typedef. */ /* Define to 1 if the system has the type `sigaction_t'. */
#undef HAVE_SIGACTION_T #undef HAVE_SIGACTION_T
/* Define to 1 if you use S/Key. */ /* Define to 1 if you use S/Key. */
@@ -501,6 +498,9 @@
/* Define to 1 if the system has the type `struct in6_addr'. */ /* Define to 1 if the system has the type `struct in6_addr'. */
#undef HAVE_STRUCT_IN6_ADDR #undef HAVE_STRUCT_IN6_ADDR
/* Define to 1 if the system has the type `struct timespec'. */
#undef HAVE_STRUCT_TIMESPEC
/* Define to 1 if `ut_exit' is a member of `struct utmpx'. */ /* Define to 1 if `ut_exit' is a member of `struct utmpx'. */
#undef HAVE_STRUCT_UTMPX_UT_EXIT #undef HAVE_STRUCT_UTMPX_UT_EXIT

10
configure vendored
View File

@@ -15579,7 +15579,6 @@ cat >>confdefs.h <<_ACEOF
#define HAVE_SIGACTION_T 1 #define HAVE_SIGACTION_T 1
_ACEOF _ACEOF
$as_echo "#define HAVE_SIGACTION_T 1" >>confdefs.h
fi fi
@@ -15590,7 +15589,11 @@ ac_fn_c_check_type "$LINENO" "struct timespec" "ac_cv_type_struct_timespec" "#in
#include <time.h> #include <time.h>
" "
if test "x$ac_cv_type_struct_timespec" = xyes; then : if test "x$ac_cv_type_struct_timespec" = xyes; then :
$as_echo "#define HAVE_TIMESPEC 1" >>confdefs.h
cat >>confdefs.h <<_ACEOF
#define HAVE_STRUCT_TIMESPEC 1
_ACEOF
fi fi
@@ -15603,7 +15606,6 @@ cat >>confdefs.h <<_ACEOF
#define HAVE_STRUCT_IN6_ADDR 1 #define HAVE_STRUCT_IN6_ADDR 1
_ACEOF _ACEOF
$as_echo "#define HAVE_IN6_ADDR 1" >>confdefs.h
fi fi
@@ -22162,8 +22164,6 @@ fi

View File

@@ -2008,14 +2008,14 @@ AC_TYPE_UID_T
AC_CHECK_TYPE([__signed char], [], [AC_CHECK_TYPE([signed char], [AC_DEFINE(__signed, signed)], [AC_DEFINE(__signed, [])])]) AC_CHECK_TYPE([__signed char], [], [AC_CHECK_TYPE([signed char], [AC_DEFINE(__signed, signed)], [AC_DEFINE(__signed, [])])])
AC_CHECK_TYPE([sig_atomic_t], [], [AC_DEFINE(sig_atomic_t, int)], [#include <sys/types.h> AC_CHECK_TYPE([sig_atomic_t], [], [AC_DEFINE(sig_atomic_t, int)], [#include <sys/types.h>
#include <signal.h>]) #include <signal.h>])
AC_CHECK_TYPES([sigaction_t], [AC_DEFINE(HAVE_SIGACTION_T)], [], [#include <sys/types.h> AC_CHECK_TYPES([sigaction_t], [], [], [#include <sys/types.h>
#include <signal.h>]) #include <signal.h>])
AC_CHECK_TYPE([struct timespec], [AC_DEFINE(HAVE_TIMESPEC)], [], [#include <sys/types.h> AC_CHECK_TYPES([struct timespec], [], [], [#include <sys/types.h>
#if TIME_WITH_SYS_TIME #if TIME_WITH_SYS_TIME
# include <sys/time.h> # include <sys/time.h>
#endif #endif
#include <time.h>]) #include <time.h>])
AC_CHECK_TYPES([struct in6_addr], [AC_DEFINE(HAVE_IN6_ADDR)], [], [#include <sys/types.h> AC_CHECK_TYPES([struct in6_addr], [], [], [#include <sys/types.h>
#include <netinet/in.h>]) #include <netinet/in.h>])
AC_TYPE_LONG_LONG_INT AC_TYPE_LONG_LONG_INT
AC_CHECK_SIZEOF([long int]) AC_CHECK_SIZEOF([long int])
@@ -3093,7 +3093,6 @@ AH_TEMPLATE(HAVE_GETSPNAM, [Define to 1 if you have the `getspnam' function (SVR
AH_TEMPLATE(HAVE_GETSPWUID, [Define to 1 if you have the `getspwuid' function. (HP-UX <= 9.X shadow passwords)]) AH_TEMPLATE(HAVE_GETSPWUID, [Define to 1 if you have the `getspwuid' function. (HP-UX <= 9.X shadow passwords)])
AH_TEMPLATE(HAVE_GSS_KRB5_CCACHE_NAME, [Define to 1 if you have the `gss_krb5_ccache_name' function.]) AH_TEMPLATE(HAVE_GSS_KRB5_CCACHE_NAME, [Define to 1 if you have the `gss_krb5_ccache_name' function.])
AH_TEMPLATE(HAVE_HEIMDAL, [Define to 1 if your Kerberos is Heimdal.]) AH_TEMPLATE(HAVE_HEIMDAL, [Define to 1 if your Kerberos is Heimdal.])
AH_TEMPLATE(HAVE_IN6_ADDR, [Define to 1 if <netinet/in.h> contains struct in6_addr.])
AH_TEMPLATE(HAVE_ISCOMSEC, [Define to 1 if you have the `iscomsec' function. (HP-UX >= 10.x check for shadow enabled)]) AH_TEMPLATE(HAVE_ISCOMSEC, [Define to 1 if you have the `iscomsec' function. (HP-UX >= 10.x check for shadow enabled)])
AH_TEMPLATE(HAVE_ISSECURE, [Define to 1 if you have the `issecure' function. (SunOS 4.x check for shadow enabled)]) AH_TEMPLATE(HAVE_ISSECURE, [Define to 1 if you have the `issecure' function. (SunOS 4.x check for shadow enabled)])
AH_TEMPLATE(HAVE_KERB5, [Define to 1 if you use Kerberos V.]) AH_TEMPLATE(HAVE_KERB5, [Define to 1 if you use Kerberos V.])
@@ -3113,7 +3112,6 @@ AH_TEMPLATE(HAVE_SECURID, [Define to 1 if you use SecurID for authentication.])
AH_TEMPLATE(HAVE_SELINUX, [Define to 1 to enable SELinux RBAC support.]) AH_TEMPLATE(HAVE_SELINUX, [Define to 1 to enable SELinux RBAC support.])
AH_TEMPLATE(HAVE_SETKEYCREATECON, [Define to 1 if you have the `setkeycreatecon' function.]) AH_TEMPLATE(HAVE_SETKEYCREATECON, [Define to 1 if you have the `setkeycreatecon' function.])
AH_TEMPLATE(HAVE_SHL_LOAD, [Define to 1 if you have the `shl_load' function.]) AH_TEMPLATE(HAVE_SHL_LOAD, [Define to 1 if you have the `shl_load' function.])
AH_TEMPLATE(HAVE_SIGACTION_T, [Define to 1 if <signal.h> has the sigaction_t typedef.])
AH_TEMPLATE(HAVE_SKEY, [Define to 1 if you use S/Key.]) AH_TEMPLATE(HAVE_SKEY, [Define to 1 if you use S/Key.])
AH_TEMPLATE(HAVE_SKEYACCESS, [Define to 1 if your S/Key library has skeyaccess().]) AH_TEMPLATE(HAVE_SKEYACCESS, [Define to 1 if your S/Key library has skeyaccess().])
AH_TEMPLATE(HAVE_RFC1938_SKEYCHALLENGE, [Define to 1 if the skeychallenge() function is RFC1938-compliant and takes 4 arguments]) AH_TEMPLATE(HAVE_RFC1938_SKEYCHALLENGE, [Define to 1 if the skeychallenge() function is RFC1938-compliant and takes 4 arguments])

View File

@@ -74,7 +74,7 @@ set_interfaces(const char *ai)
ifp = emalloc(sizeof(*ifp)); ifp = emalloc(sizeof(*ifp));
if (strchr(addr, ':')) { if (strchr(addr, ':')) {
/* IPv6 */ /* IPv6 */
#ifdef HAVE_IN6_ADDR #ifdef HAVE_STRUCT_IN6_ADDR
ifp->family = AF_INET6; ifp->family = AF_INET6;
if (inet_pton(AF_INET6, addr, &ifp->addr.ip6) != 1 || if (inet_pton(AF_INET6, addr, &ifp->addr.ip6) != 1 ||
inet_pton(AF_INET6, mask, &ifp->netmask.ip6) != 1) inet_pton(AF_INET6, mask, &ifp->netmask.ip6) != 1)

View File

@@ -27,7 +27,7 @@
*/ */
union sudo_in_addr_un { union sudo_in_addr_un {
struct in_addr ip4; struct in_addr ip4;
#ifdef HAVE_IN6_ADDR #ifdef HAVE_STRUCT_IN6_ADDR
struct in6_addr ip6; struct in6_addr ip6;
#endif #endif
}; };

View File

@@ -55,17 +55,17 @@ addr_matches_if(char *n)
{ {
union sudo_in_addr_un addr; union sudo_in_addr_un addr;
struct interface *ifp; struct interface *ifp;
#ifdef HAVE_IN6_ADDR #ifdef HAVE_STRUCT_IN6_ADDR
int j; int j;
#endif #endif
int family; int family;
debug_decl(addr_matches_if, SUDO_DEBUG_MATCH) debug_decl(addr_matches_if, SUDO_DEBUG_MATCH)
#ifdef HAVE_IN6_ADDR #ifdef HAVE_STRUCT_IN6_ADDR
if (inet_pton(AF_INET6, n, &addr.ip6) > 0) { if (inet_pton(AF_INET6, n, &addr.ip6) > 0) {
family = AF_INET6; family = AF_INET6;
} else } else
#endif #endif /* HAVE_STRUCT_IN6_ADDR */
{ {
family = AF_INET; family = AF_INET;
addr.ip4.s_addr = inet_addr(n); addr.ip4.s_addr = inet_addr(n);
@@ -81,7 +81,7 @@ addr_matches_if(char *n)
== addr.ip4.s_addr) == addr.ip4.s_addr)
debug_return_bool(TRUE); debug_return_bool(TRUE);
break; break;
#ifdef HAVE_IN6_ADDR #ifdef HAVE_STRUCT_IN6_ADDR
case AF_INET6: case AF_INET6:
if (memcmp(ifp->addr.ip6.s6_addr, addr.ip6.s6_addr, if (memcmp(ifp->addr.ip6.s6_addr, addr.ip6.s6_addr,
sizeof(addr.ip6.s6_addr)) == 0) sizeof(addr.ip6.s6_addr)) == 0)
@@ -92,7 +92,7 @@ addr_matches_if(char *n)
} }
if (j == sizeof(addr.ip6.s6_addr)) if (j == sizeof(addr.ip6.s6_addr))
debug_return_bool(TRUE); debug_return_bool(TRUE);
#endif #endif /* HAVE_STRUCT_IN6_ADDR */
} }
} }
@@ -105,17 +105,17 @@ addr_matches_if_netmask(char *n, char *m)
int i; int i;
union sudo_in_addr_un addr, mask; union sudo_in_addr_un addr, mask;
struct interface *ifp; struct interface *ifp;
#ifdef HAVE_IN6_ADDR #ifdef HAVE_STRUCT_IN6_ADDR
int j; int j;
#endif #endif
int family; int family;
debug_decl(addr_matches_if, SUDO_DEBUG_MATCH) debug_decl(addr_matches_if, SUDO_DEBUG_MATCH)
#ifdef HAVE_IN6_ADDR #ifdef HAVE_STRUCT_IN6_ADDR
if (inet_pton(AF_INET6, n, &addr.ip6) > 0) if (inet_pton(AF_INET6, n, &addr.ip6) > 0)
family = AF_INET6; family = AF_INET6;
else else
#endif #endif /* HAVE_STRUCT_IN6_ADDR */
{ {
family = AF_INET; family = AF_INET;
addr.ip4.s_addr = inet_addr(n); addr.ip4.s_addr = inet_addr(n);
@@ -136,7 +136,7 @@ addr_matches_if_netmask(char *n, char *m)
} }
addr.ip4.s_addr &= mask.ip4.s_addr; addr.ip4.s_addr &= mask.ip4.s_addr;
} }
#ifdef HAVE_IN6_ADDR #ifdef HAVE_STRUCT_IN6_ADDR
else { else {
if (inet_pton(AF_INET6, m, &mask.ip6) <= 0) { if (inet_pton(AF_INET6, m, &mask.ip6) <= 0) {
j = atoi(m); j = atoi(m);
@@ -151,7 +151,7 @@ addr_matches_if_netmask(char *n, char *m)
} }
} }
} }
#endif /* HAVE_IN6_ADDR */ #endif /* HAVE_STRUCT_IN6_ADDR */
for (ifp = interfaces; ifp != NULL; ifp = ifp->next) { for (ifp = interfaces; ifp != NULL; ifp = ifp->next) {
if (ifp->family != family) if (ifp->family != family)
@@ -160,7 +160,7 @@ addr_matches_if_netmask(char *n, char *m)
case AF_INET: case AF_INET:
if ((ifp->addr.ip4.s_addr & mask.ip4.s_addr) == addr.ip4.s_addr) if ((ifp->addr.ip4.s_addr & mask.ip4.s_addr) == addr.ip4.s_addr)
debug_return_bool(TRUE); debug_return_bool(TRUE);
#ifdef HAVE_IN6_ADDR #ifdef HAVE_STRUCT_IN6_ADDR
case AF_INET6: case AF_INET6:
for (j = 0; j < sizeof(addr.ip6.s6_addr); j++) { for (j = 0; j < sizeof(addr.ip6.s6_addr); j++) {
if ((ifp->addr.ip6.s6_addr[j] & mask.ip6.s6_addr[j]) != addr.ip6.s6_addr[j]) if ((ifp->addr.ip6.s6_addr[j] & mask.ip6.s6_addr[j]) != addr.ip6.s6_addr[j])
@@ -168,7 +168,7 @@ addr_matches_if_netmask(char *n, char *m)
} }
if (j == sizeof(addr.ip6.s6_addr)) if (j == sizeof(addr.ip6.s6_addr))
debug_return_bool(TRUE); debug_return_bool(TRUE);
#endif /* HAVE_IN6_ADDR */ #endif /* HAVE_STRUCT_IN6_ADDR */
} }
} }

View File

@@ -52,7 +52,7 @@
#if TIME_WITH_SYS_TIME #if TIME_WITH_SYS_TIME
# include <time.h> # include <time.h>
#endif #endif
#ifndef HAVE_TIMESPEC #ifndef HAVE_STRUCT_TIMESPEC
# include "compat/timespec.h" # include "compat/timespec.h"
#endif #endif
#include <ctype.h> #include <ctype.h>

View File

@@ -108,7 +108,7 @@ get_net_ifs(char **addrinfo)
{ {
struct ifaddrs *ifa, *ifaddrs; struct ifaddrs *ifa, *ifaddrs;
struct sockaddr_in *sin; struct sockaddr_in *sin;
#ifdef HAVE_IN6_ADDR #ifdef HAVE_STRUCT_IN6_ADDR
struct sockaddr_in6 *sin6; struct sockaddr_in6 *sin6;
char addrbuf[INET6_ADDRSTRLEN]; char addrbuf[INET6_ADDRSTRLEN];
#endif #endif
@@ -128,7 +128,7 @@ get_net_ifs(char **addrinfo)
switch (ifa->ifa_addr->sa_family) { switch (ifa->ifa_addr->sa_family) {
case AF_INET: case AF_INET:
#ifdef HAVE_IN6_ADDR #ifdef HAVE_STRUCT_IN6_ADDR
case AF_INET6: case AF_INET6:
#endif #endif
num_interfaces++; num_interfaces++;
@@ -168,7 +168,7 @@ get_net_ifs(char **addrinfo)
} }
cp += len; cp += len;
break; break;
#ifdef HAVE_IN6_ADDR #ifdef HAVE_STRUCT_IN6_ADDR
case AF_INET6: case AF_INET6:
sin6 = (struct sockaddr_in6 *)ifa->ifa_addr; sin6 = (struct sockaddr_in6 *)ifa->ifa_addr;
inet_ntop(AF_INET6, &sin6->sin6_addr, addrbuf, sizeof(addrbuf)); inet_ntop(AF_INET6, &sin6->sin6_addr, addrbuf, sizeof(addrbuf));
@@ -189,7 +189,7 @@ get_net_ifs(char **addrinfo)
} }
cp += len; cp += len;
break; break;
#endif /* HAVE_IN6_ADDR */ #endif /* HAVE_STRUCT_IN6_ADDR */
} }
} }