From: Todd C. Miller Date: Thu, 12 Jan 2012 18:27:37 +0000 (-0500) Subject: Use HAVE_STRUCT_TIMESPEC and HAVE_STRUCT_IN6_ADDR instead of X-Git-Tag: SUDO_1_7_9~45 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=11cb9efdf7eb6764602ba042cb85f763a4f5966a;p=sudo Use HAVE_STRUCT_TIMESPEC and HAVE_STRUCT_IN6_ADDR instead of HAVE_TIMESPEC and HAVE_IN6_ADDR respectively. --HG-- branch : 1.7 --- diff --git a/config.h.in b/config.h.in index 8d1e22e53..f6882e50f 100644 --- a/config.h.in +++ b/config.h.in @@ -212,9 +212,6 @@ /* Define to 1 if your Kerberos is Heimdal. */ #undef HAVE_HEIMDAL -/* Define to 1 if contains struct in6_addr. */ -#undef HAVE_IN6_ADDR - /* Define to 1 if you have the `initgroups' function. */ #undef HAVE_INITGROUPS @@ -468,7 +465,7 @@ /* Define to 1 if you have the `sigaction' function. */ #undef HAVE_SIGACTION -/* Define to 1 if has the sigaction_t typedef. */ +/* Define to 1 if the system has the type `sigaction_t'. */ #undef HAVE_SIGACTION_T /* Define to 1 if you use S/Key. */ @@ -519,6 +516,9 @@ /* Define to 1 if the system has the type `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 your struct stat has an st_mtim member */ #undef HAVE_ST_MTIM @@ -573,9 +573,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_TERMIO_H -/* Define to 1 if you have struct timespec in sys/time.h */ -#undef HAVE_TIMESPEC - /* Define to 1 if you have the `tzset' function. */ #undef HAVE_TZSET diff --git a/configure b/configure index 16e8f3c55..1e8c8ae60 100755 --- a/configure +++ b/configure @@ -15564,7 +15564,6 @@ cat >>confdefs.h <<_ACEOF #define HAVE_SIGACTION_T 1 _ACEOF -$as_echo "#define HAVE_SIGACTION_T 1" >>confdefs.h fi @@ -15575,7 +15574,11 @@ ac_fn_c_check_type "$LINENO" "struct timespec" "ac_cv_type_struct_timespec" "#in #include " 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 @@ -15588,7 +15591,6 @@ cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_IN6_ADDR 1 _ACEOF -$as_echo "#define HAVE_IN6_ADDR 1" >>confdefs.h fi @@ -22286,9 +22288,6 @@ fi - - - diff --git a/configure.in b/configure.in index 36dafc067..f37d4a44d 100644 --- a/configure.in +++ b/configure.in @@ -1981,14 +1981,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([sig_atomic_t], [], [AC_DEFINE(sig_atomic_t, int)], [#include #include ]) -AC_CHECK_TYPES([sigaction_t], [AC_DEFINE(HAVE_SIGACTION_T)], [], [#include +AC_CHECK_TYPES([sigaction_t], [], [], [#include #include ]) -AC_CHECK_TYPE([struct timespec], [AC_DEFINE(HAVE_TIMESPEC)], [], [#include +AC_CHECK_TYPES([struct timespec], [], [], [#include #if TIME_WITH_SYS_TIME # include #endif #include ]) -AC_CHECK_TYPES([struct in6_addr], [AC_DEFINE(HAVE_IN6_ADDR)], [], [#include +AC_CHECK_TYPES([struct in6_addr], [], [], [#include #include ]) AC_TYPE_LONG_LONG_INT AC_CHECK_SIZEOF([long int]) @@ -3017,7 +3017,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_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_IN6_ADDR, [Define to 1 if 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_ISSECURE, [Define to 1 if you have the `issecure' function. (SunOS 4.x check for shadow enabled)]) AH_TEMPLATE(HAVE_KERB4, [Define to 1 if you use Kerberos IV.]) @@ -3036,7 +3035,6 @@ AH_TEMPLATE(HAVE_PROJECT_H, [Define to 1 if you have the header file 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_SETKEYCREATECON, [Define to 1 if you have the `setkeycreatecon' function.]) -AH_TEMPLATE(HAVE_SIGACTION_T, [Define to 1 if has the sigaction_t typedef.]) 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_RFC1938_SKEYCHALLENGE, [Define to 1 if the skeychallenge() function is RFC1938-compliant and takes 4 arguments]) @@ -3044,7 +3042,6 @@ AH_TEMPLATE(HAVE_ST__TIM, [Define to 1 if your struct stat uses an st__tim union AH_TEMPLATE(HAVE_ST_MTIM, [Define to 1 if your struct stat has an st_mtim member]) AH_TEMPLATE(HAVE_ST_MTIMESPEC, [Define to 1 if your struct stat has an st_mtimespec member]) AH_TEMPLATE(HAVE_TERMIOS_H, [Define to 1 if you have the header file and the `tcgetattr' function.]) -AH_TEMPLATE(HAVE_TIMESPEC, [Define to 1 if you have struct timespec in sys/time.h]) AH_TEMPLATE(HAVE___PROGNAME, [Define to 1 if your crt0.o defines the __progname symbol for you.]) AH_TEMPLATE(HOST_IN_LOG, [Define to 1 if you want the hostname to be entered into the log file.]) AH_TEMPLATE(IGNORE_DOT_PATH, [Define to 1 if you want to ignore '.' and empty PATH elements]) diff --git a/fileops.c b/fileops.c index ae9a7df13..e20f99f5b 100644 --- a/fileops.c +++ b/fileops.c @@ -43,7 +43,7 @@ #if TIME_WITH_SYS_TIME # include #endif -#ifndef HAVE_TIMESPEC +#ifndef HAVE_STRUCT_TIMESPEC # include "emul/timespec.h" #endif diff --git a/interfaces.c b/interfaces.c index 502cb94ae..dd66af3e5 100644 --- a/interfaces.c +++ b/interfaces.c @@ -99,7 +99,7 @@ load_interfaces() { struct ifaddrs *ifa, *ifaddrs; struct sockaddr_in *sin; -#ifdef HAVE_IN6_ADDR +#ifdef HAVE_STRUCT_IN6_ADDR struct sockaddr_in6 *sin6; #endif int i; @@ -116,7 +116,7 @@ load_interfaces() switch(ifa->ifa_addr->sa_family) { case AF_INET: -#ifdef HAVE_IN6_ADDR +#ifdef HAVE_STRUCT_IN6_ADDR case AF_INET6: #endif num_interfaces++; @@ -150,7 +150,7 @@ load_interfaces() interfaces[i].family = AF_INET; i++; break; -#ifdef HAVE_IN6_ADDR +#ifdef HAVE_STRUCT_IN6_ADDR case AF_INET6: sin6 = (struct sockaddr_in6 *)ifa->ifa_addr; if (sin6 == NULL) @@ -165,7 +165,7 @@ load_interfaces() interfaces[i].family = AF_INET6; i++; break; -#endif /* HAVE_IN6_ADDR */ +#endif /* HAVE_STRUCT_IN6_ADDR */ } } #ifdef HAVE_FREEIFADDRS @@ -328,7 +328,7 @@ void dump_interfaces() { int i; -#ifdef HAVE_IN6_ADDR +#ifdef HAVE_STRUCT_IN6_ADDR char addrbuf[INET6_ADDRSTRLEN], maskbuf[INET6_ADDRSTRLEN]; #endif @@ -339,7 +339,7 @@ dump_interfaces() printf("\t%s / ", inet_ntoa(interfaces[i].addr.ip4)); puts(inet_ntoa(interfaces[i].netmask.ip4)); break; -#ifdef HAVE_IN6_ADDR +#ifdef HAVE_STRUCT_IN6_ADDR case AF_INET6: inet_ntop(AF_INET6, &interfaces[i].addr.ip6, addrbuf, sizeof(addrbuf)); @@ -347,7 +347,7 @@ dump_interfaces() maskbuf, sizeof(maskbuf)); printf("\t%s / %s\n", addrbuf, maskbuf); break; -#endif /* HAVE_IN6_ADDR */ +#endif /* HAVE_STRUCT_IN6_ADDR */ } } } diff --git a/interfaces.h b/interfaces.h index 06b0b8571..dc22f4f63 100644 --- a/interfaces.h +++ b/interfaces.h @@ -27,7 +27,7 @@ */ union sudo_in_addr_un { struct in_addr ip4; -#ifdef HAVE_IN6_ADDR +#ifdef HAVE_STRUCT_IN6_ADDR struct in6_addr ip6; #endif }; diff --git a/match.c b/match.c index 184616e2b..7568c83fb 100644 --- a/match.c +++ b/match.c @@ -630,12 +630,12 @@ addr_matches_if(n) int i; union sudo_in_addr_un addr; struct interface *ifp; -#ifdef HAVE_IN6_ADDR +#ifdef HAVE_STRUCT_IN6_ADDR int j; #endif int family; -#ifdef HAVE_IN6_ADDR +#ifdef HAVE_STRUCT_IN6_ADDR if (inet_pton(AF_INET6, n, &addr.ip6) > 0) { family = AF_INET6; } else @@ -656,7 +656,7 @@ addr_matches_if(n) == addr.ip4.s_addr) return TRUE; break; -#ifdef HAVE_IN6_ADDR +#ifdef HAVE_STRUCT_IN6_ADDR case AF_INET6: if (memcmp(ifp->addr.ip6.s6_addr, addr.ip6.s6_addr, sizeof(addr.ip6.s6_addr)) == 0) @@ -682,12 +682,12 @@ addr_matches_if_netmask(n, m) int i; union sudo_in_addr_un addr, mask; struct interface *ifp; -#ifdef HAVE_IN6_ADDR +#ifdef HAVE_STRUCT_IN6_ADDR int j; #endif int family; -#ifdef HAVE_IN6_ADDR +#ifdef HAVE_STRUCT_IN6_ADDR if (inet_pton(AF_INET6, n, &addr.ip6) > 0) family = AF_INET6; else @@ -712,7 +712,7 @@ addr_matches_if_netmask(n, m) } addr.ip4.s_addr &= mask.ip4.s_addr; } -#ifdef HAVE_IN6_ADDR +#ifdef HAVE_STRUCT_IN6_ADDR else { if (inet_pton(AF_INET6, m, &mask.ip6) <= 0) { j = atoi(m); @@ -727,7 +727,7 @@ addr_matches_if_netmask(n, m) } } } -#endif /* HAVE_IN6_ADDR */ +#endif /* HAVE_STRUCT_IN6_ADDR */ for (i = 0; i < num_interfaces; i++) { ifp = &interfaces[i]; @@ -737,7 +737,7 @@ addr_matches_if_netmask(n, m) case AF_INET: if ((ifp->addr.ip4.s_addr & mask.ip4.s_addr) == addr.ip4.s_addr) return TRUE; -#ifdef HAVE_IN6_ADDR +#ifdef HAVE_STRUCT_IN6_ADDR case AF_INET6: 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]) @@ -745,7 +745,7 @@ addr_matches_if_netmask(n, m) } if (j == sizeof(addr.ip6.s6_addr)) return TRUE; -#endif /* HAVE_IN6_ADDR */ +#endif /* HAVE_STRUCT_IN6_ADDR */ } } diff --git a/nanosleep.c b/nanosleep.c index 1849eb2cd..ca0463a79 100644 --- a/nanosleep.c +++ b/nanosleep.c @@ -24,7 +24,7 @@ #if TIME_WITH_SYS_TIME # include #endif -#ifndef HAVE_TIMESPEC +#ifndef HAVE_STRUCT_TIMESPEC # include "emul/timespec.h" #endif #include diff --git a/sudo_noexec.c b/sudo_noexec.c index 127fcbed4..1e5cad79f 100644 --- a/sudo_noexec.c +++ b/sudo_noexec.c @@ -19,7 +19,7 @@ #include #include -#ifndef HAVE_TIMESPEC +#ifndef HAVE_STRUCT_TIMESPEC # include #endif #ifdef __STDC__ diff --git a/sudoreplay.c b/sudoreplay.c index 9fdb5bbc5..191a672b9 100644 --- a/sudoreplay.c +++ b/sudoreplay.c @@ -52,7 +52,7 @@ #if TIME_WITH_SYS_TIME # include #endif -#ifndef HAVE_TIMESPEC +#ifndef HAVE_STRUCT_TIMESPEC # include "emul/timespec.h" #endif #include