From 67183d74f4acea6ce7bb434994f343c490918a1a Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Wed, 9 Sep 2015 11:13:22 -0600 Subject: [PATCH] Remove include/compat/timespec.h. Systems old enough to lack struct timespec are too old to build a modern sudo. --- MANIFEST | 1 - config.h.in | 3 --- configure | 21 ++--------------- configure.ac | 13 +++-------- include/compat/timespec.h | 25 -------------------- lib/util/Makefile.in | 10 ++++---- lib/util/gettime.c | 3 --- lib/util/utimens.c | 3 --- plugins/sudoers/Makefile.in | 45 ++++++++++++++++++------------------ plugins/sudoers/sudoreplay.c | 3 --- plugins/sudoers/timestamp.c | 3 --- plugins/sudoers/visudo.c | 3 --- src/Makefile.in | 11 ++++----- src/sudo_edit.c | 3 --- 14 files changed, 37 insertions(+), 110 deletions(-) delete mode 100644 include/compat/timespec.h diff --git a/MANIFEST b/MANIFEST index fc890a8a2..84fe484f2 100644 --- a/MANIFEST +++ b/MANIFEST @@ -60,7 +60,6 @@ include/compat/glob.h include/compat/nss_dbdefs.h include/compat/sha2.h include/compat/stdbool.h -include/compat/timespec.h include/sudo_compat.h include/sudo_conf.h include/sudo_debug.h diff --git a/config.h.in b/config.h.in index 2635a0ffc..29e922eb8 100644 --- a/config.h.in +++ b/config.h.in @@ -700,9 +700,6 @@ /* Define if your struct sockaddr has an sa_len field. */ #undef HAVE_STRUCT_SOCKADDR_SA_LEN -/* 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'. */ #undef HAVE_STRUCT_UTMPX_UT_EXIT diff --git a/configure b/configure index 147df4317..b82135518 100755 --- a/configure +++ b/configure @@ -17318,21 +17318,6 @@ cat >>confdefs.h <<_ACEOF _ACEOF -fi - -ac_fn_c_check_type "$LINENO" "struct timespec" "ac_cv_type_struct_timespec" "#include -#ifdef TIME_WITH_SYS_TIME -# include -#endif -#include -" -if test "x$ac_cv_type_struct_timespec" = xyes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_STRUCT_TIMESPEC 1 -_ACEOF - - fi ac_fn_c_check_type "$LINENO" "struct in6_addr" "ac_cv_type_struct_in6_addr" "#include @@ -19728,12 +19713,11 @@ esac " done -if test X"$ac_cv_type_struct_timespec" != X"no"; then - ac_fn_c_check_member "$LINENO" "struct stat" "st_mtim" "ac_cv_member_struct_stat_st_mtim" "$ac_includes_default" +ac_fn_c_check_member "$LINENO" "struct stat" "st_mtim" "ac_cv_member_struct_stat_st_mtim" "$ac_includes_default" if test "x$ac_cv_member_struct_stat_st_mtim" = xyes; then : $as_echo "#define HAVE_ST_MTIM 1" >>confdefs.h - ac_fn_c_check_member "$LINENO" "struct stat" "st_mtim.st__tim" "ac_cv_member_struct_stat_st_mtim_st__tim" "$ac_includes_default" + ac_fn_c_check_member "$LINENO" "struct stat" "st_mtim.st__tim" "ac_cv_member_struct_stat_st_mtim_st__tim" "$ac_includes_default" if test "x$ac_cv_member_struct_stat_st_mtim_st__tim" = xyes; then : $as_echo "#define HAVE_ST__TIM 1" >>confdefs.h @@ -19748,7 +19732,6 @@ fi fi -fi FOUND_SHA2=no ac_fn_c_check_header_mongrel "$LINENO" "sha2.h" "ac_cv_header_sha2_h" "$ac_includes_default" if test "x$ac_cv_header_sha2_h" = xyes; then : diff --git a/configure.ac b/configure.ac index a287d948a..39f615ff3 100644 --- a/configure.ac +++ b/configure.ac @@ -2314,11 +2314,6 @@ AC_CHECK_TYPE([sig_atomic_t], [], [AC_DEFINE(sig_atomic_t, int)], [#include ]) AC_CHECK_TYPES([sigaction_t], [], [], [#include #include ]) -AC_CHECK_TYPES([struct timespec], [], [], [#include -#ifdef TIME_WITH_SYS_TIME -# include -#endif -#include ]) AC_CHECK_TYPES([struct in6_addr], [], [], [#include #include ]) AC_TYPE_LONG_LONG_INT @@ -2653,11 +2648,9 @@ fi AC_CHECK_FUNCS([strtonum]) AC_LIBOBJ(strtonum) SUDO_APPEND_COMPAT_EXP(sudo_strtonum) -if test X"$ac_cv_type_struct_timespec" != X"no"; then - AC_CHECK_MEMBER([struct stat.st_mtim], [AC_DEFINE(HAVE_ST_MTIM)] - [AC_CHECK_MEMBER([struct stat.st_mtim.st__tim], AC_DEFINE(HAVE_ST__TIM))], - [AC_CHECK_MEMBER([struct stat.st_mtimespec], AC_DEFINE([HAVE_ST_MTIMESPEC]))]) -fi +AC_CHECK_MEMBER([struct stat.st_mtim], [AC_DEFINE(HAVE_ST_MTIM)] + [AC_CHECK_MEMBER([struct stat.st_mtim.st__tim], AC_DEFINE(HAVE_ST__TIM))], + [AC_CHECK_MEMBER([struct stat.st_mtimespec], AC_DEFINE([HAVE_ST_MTIMESPEC]))]) FOUND_SHA2=no AC_CHECK_HEADER([sha2.h], [ FOUND_SHA2=yes diff --git a/include/compat/timespec.h b/include/compat/timespec.h deleted file mode 100644 index e1378f7ec..000000000 --- a/include/compat/timespec.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2005, 2010 Todd C. Miller - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef COMPAT_TIMESPEC_H -#define COMPAT_TIMESPEC_H - -struct timespec { - time_t tv_sec; - long tv_nsec; -}; - -#endif /* COMPAT_TIMESPEC_H */ diff --git a/lib/util/Makefile.in b/lib/util/Makefile.in index 105eaa665..ab8faf091 100644 --- a/lib/util/Makefile.in +++ b/lib/util/Makefile.in @@ -396,9 +396,9 @@ getopt_long.lo: $(srcdir)/getopt_long.c $(incdir)/compat/getopt.h \ $(incdir)/sudo_fatal.h $(top_builddir)/config.h $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(srcdir)/getopt_long.c gettime.lo: $(srcdir)/gettime.c $(incdir)/compat/stdbool.h \ - $(incdir)/compat/timespec.h $(incdir)/sudo_compat.h \ - $(incdir)/sudo_debug.h $(incdir)/sudo_queue.h \ - $(incdir)/sudo_util.h $(top_builddir)/config.h + $(incdir)/sudo_compat.h $(incdir)/sudo_debug.h \ + $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \ + $(top_builddir)/config.h $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(srcdir)/gettime.c gidlist.lo: $(srcdir)/gidlist.c $(incdir)/compat/stdbool.h \ $(incdir)/sudo_compat.h $(incdir)/sudo_debug.h \ @@ -569,6 +569,6 @@ ttysize.lo: $(srcdir)/ttysize.c $(incdir)/compat/stdbool.h \ $(top_builddir)/config.h $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(srcdir)/ttysize.c utimens.lo: $(srcdir)/utimens.c $(incdir)/compat/stdbool.h \ - $(incdir)/compat/timespec.h $(incdir)/sudo_compat.h \ - $(incdir)/sudo_util.h $(top_builddir)/config.h + $(incdir)/sudo_compat.h $(incdir)/sudo_util.h \ + $(top_builddir)/config.h $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(srcdir)/utimens.c diff --git a/lib/util/gettime.c b/lib/util/gettime.c index 22191d0dc..5fa4dac0c 100644 --- a/lib/util/gettime.c +++ b/lib/util/gettime.c @@ -24,9 +24,6 @@ #ifdef TIME_WITH_SYS_TIME # include #endif -#ifndef HAVE_STRUCT_TIMESPEC -# include "compat/timespec.h" -#endif #include #if defined(__MACH__) && !defined(HAVE_CLOCK_GETTIME) diff --git a/lib/util/utimens.c b/lib/util/utimens.c index 165c82918..34feeaec9 100644 --- a/lib/util/utimens.c +++ b/lib/util/utimens.c @@ -26,9 +26,6 @@ #ifdef TIME_WITH_SYS_TIME # include #endif -#ifndef HAVE_STRUCT_TIMESPEC -# include "compat/timespec.h" -#endif #if !defined(HAVE_UTIMES) || defined(HAVE_FUTIME) # include #endif diff --git a/plugins/sudoers/Makefile.in b/plugins/sudoers/Makefile.in index e70044519..04aba2e1d 100644 --- a/plugins/sudoers/Makefile.in +++ b/plugins/sudoers/Makefile.in @@ -1021,13 +1021,13 @@ sudoers_debug.lo: $(srcdir)/sudoers_debug.c $(devdir)/def_data.h \ $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(srcdir)/sudoers_debug.c sudoers_debug.o: sudoers_debug.lo sudoreplay.o: $(srcdir)/sudoreplay.c $(incdir)/compat/getopt.h \ - $(incdir)/compat/stdbool.h $(incdir)/compat/timespec.h \ - $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \ - $(incdir)/sudo_debug.h $(incdir)/sudo_event.h \ - $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \ - $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \ - $(incdir)/sudo_util.h $(srcdir)/iolog.h $(srcdir)/logging.h \ - $(top_builddir)/config.h $(top_builddir)/pathnames.h + $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \ + $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ + $(incdir)/sudo_event.h $(incdir)/sudo_fatal.h \ + $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \ + $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/iolog.h \ + $(srcdir)/logging.h $(top_builddir)/config.h \ + $(top_builddir)/pathnames.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(srcdir)/sudoreplay.c testsudoers.o: $(srcdir)/testsudoers.c $(devdir)/def_data.h $(devdir)/gram.h \ $(incdir)/compat/fnmatch.h $(incdir)/compat/stdbool.h \ @@ -1041,14 +1041,14 @@ testsudoers.o: $(srcdir)/testsudoers.c $(devdir)/def_data.h $(devdir)/gram.h \ $(top_builddir)/config.h $(top_builddir)/pathnames.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(srcdir)/testsudoers.c timestamp.lo: $(srcdir)/timestamp.c $(devdir)/def_data.h \ - $(incdir)/compat/stdbool.h $(incdir)/compat/timespec.h \ - $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \ - $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \ - $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \ - $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/check.h \ - $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/sudo_nss.h \ - $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.h \ - $(top_builddir)/config.h $(top_builddir)/pathnames.h + $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \ + $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ + $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \ + $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h \ + $(incdir)/sudo_util.h $(srcdir)/check.h $(srcdir)/defaults.h \ + $(srcdir)/logging.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ + $(srcdir)/sudoers_debug.h $(top_builddir)/config.h \ + $(top_builddir)/pathnames.h $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(srcdir)/timestamp.c timestr.lo: $(srcdir)/timestr.c $(incdir)/sudo_compat.h $(top_builddir)/config.h $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(srcdir)/timestr.c @@ -1084,14 +1084,13 @@ tsgetgrpw.o: $(srcdir)/tsgetgrpw.c $(devdir)/def_data.h \ $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(srcdir)/tsgetgrpw.c visudo.o: $(srcdir)/visudo.c $(devdir)/def_data.h $(devdir)/gram.h \ $(incdir)/compat/getopt.h $(incdir)/compat/stdbool.h \ - $(incdir)/compat/timespec.h $(incdir)/sudo_compat.h \ - $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \ - $(incdir)/sudo_gettext.h $(incdir)/sudo_plugin.h \ - $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/defaults.h \ - $(srcdir)/logging.h $(srcdir)/parse.h $(srcdir)/redblack.h \ - $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h $(srcdir)/sudoers_debug.h \ - $(srcdir)/sudoers_version.h $(top_builddir)/config.h \ - $(top_builddir)/pathnames.h + $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ + $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \ + $(incdir)/sudo_plugin.h $(incdir)/sudo_queue.h $(incdir)/sudo_util.h \ + $(srcdir)/defaults.h $(srcdir)/logging.h $(srcdir)/parse.h \ + $(srcdir)/redblack.h $(srcdir)/sudo_nss.h $(srcdir)/sudoers.h \ + $(srcdir)/sudoers_debug.h $(srcdir)/sudoers_version.h \ + $(top_builddir)/config.h $(top_builddir)/pathnames.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(srcdir)/visudo.c visudo_json.o: $(srcdir)/visudo_json.c $(devdir)/def_data.h $(devdir)/gram.h \ $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \ diff --git a/plugins/sudoers/sudoreplay.c b/plugins/sudoers/sudoreplay.c index 3db09c299..d11f81606 100644 --- a/plugins/sudoers/sudoreplay.c +++ b/plugins/sudoers/sudoreplay.c @@ -34,9 +34,6 @@ #ifdef TIME_WITH_SYS_TIME # include #endif -#ifndef HAVE_STRUCT_TIMESPEC -# include "compat/timespec.h" -#endif #include #include #include diff --git a/plugins/sudoers/timestamp.c b/plugins/sudoers/timestamp.c index 5da3c3ab3..c4cbb77dc 100644 --- a/plugins/sudoers/timestamp.c +++ b/plugins/sudoers/timestamp.c @@ -36,9 +36,6 @@ #ifdef TIME_WITH_SYS_TIME # include #endif -#ifndef HAVE_STRUCT_TIMESPEC -# include "compat/timespec.h" -#endif #include #include #include diff --git a/plugins/sudoers/visudo.c b/plugins/sudoers/visudo.c index b209fe00e..5bde49aa2 100644 --- a/plugins/sudoers/visudo.c +++ b/plugins/sudoers/visudo.c @@ -59,9 +59,6 @@ #ifdef TIME_WITH_SYS_TIME # include #endif -#ifndef HAVE_STRUCT_TIMESPEC -# include "compat/timespec.h" -#endif #include "sudoers.h" #include "parse.h" diff --git a/src/Makefile.in b/src/Makefile.in index 7acfb2dc0..fcd501937 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -361,12 +361,11 @@ sudo.o: $(srcdir)/sudo.c $(incdir)/compat/stdbool.h $(incdir)/sudo_compat.h \ $(top_builddir)/pathnames.h ./sudo_usage.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(srcdir)/sudo.c sudo_edit.o: $(srcdir)/sudo_edit.c $(incdir)/compat/stdbool.h \ - $(incdir)/compat/timespec.h $(incdir)/sudo_compat.h \ - $(incdir)/sudo_conf.h $(incdir)/sudo_debug.h \ - $(incdir)/sudo_fatal.h $(incdir)/sudo_gettext.h \ - $(incdir)/sudo_queue.h $(incdir)/sudo_util.h $(srcdir)/sudo.h \ - $(srcdir)/sudo_exec.h $(top_builddir)/config.h \ - $(top_builddir)/pathnames.h + $(incdir)/sudo_compat.h $(incdir)/sudo_conf.h \ + $(incdir)/sudo_debug.h $(incdir)/sudo_fatal.h \ + $(incdir)/sudo_gettext.h $(incdir)/sudo_queue.h \ + $(incdir)/sudo_util.h $(srcdir)/sudo.h $(srcdir)/sudo_exec.h \ + $(top_builddir)/config.h $(top_builddir)/pathnames.h $(CC) -c $(CPPFLAGS) $(CFLAGS) $(PIE_CFLAGS) $(SSP_CFLAGS) $(srcdir)/sudo_edit.c sudo_noexec.lo: $(srcdir)/sudo_noexec.c $(incdir)/sudo_compat.h \ $(top_builddir)/config.h diff --git a/src/sudo_edit.c b/src/sudo_edit.c index 6be29c20d..95bf8aa0a 100644 --- a/src/sudo_edit.c +++ b/src/sudo_edit.c @@ -39,9 +39,6 @@ #ifdef TIME_WITH_SYS_TIME # include #endif -#ifndef HAVE_STRUCT_TIMESPEC -# include "compat/timespec.h" -#endif #ifdef HAVE_SELINUX # include #endif -- 2.40.0