From f40489a572d2a3169c3090bee175fdf9dad3cdb9 Mon Sep 17 00:00:00 2001 From: danh Date: Wed, 26 Feb 2003 15:54:17 +0000 Subject: [PATCH] prefer geteuid() over getuid() if it is found during configure problem reported by jsyn@ --- net/ntp/devel/patches/patch-config_h_in | 22 +++++++++++++++------- net/ntp/devel/patches/patch-configure_in | 14 +++++++++++--- net/ntp/devel/patches/patch-ntpd_ntpd_c | 23 ++++++++++++++--------- net/ntp/stable/patches/patch-config_h_in | 14 +++++++++++--- net/ntp/stable/patches/patch-configure_in | 14 +++++++++++--- net/ntp/stable/patches/patch-ntpd_ntpd_c | 23 ++++++++++++++--------- 6 files changed, 76 insertions(+), 34 deletions(-) diff --git a/net/ntp/devel/patches/patch-config_h_in b/net/ntp/devel/patches/patch-config_h_in index 88cabfdfb45..4e3f5bb4d34 100644 --- a/net/ntp/devel/patches/patch-config_h_in +++ b/net/ntp/devel/patches/patch-config_h_in @@ -1,6 +1,6 @@ -$OpenBSD: patch-config_h_in,v 1.1.1.1 2003/02/23 21:27:28 danh Exp $ ---- config.h.in.orig Wed Feb 19 10:04:51 2003 -+++ config.h.in Wed Feb 19 10:05:59 2003 +$OpenBSD: patch-config_h_in,v 1.2 2003/02/26 15:54:17 danh Exp $ +--- config.h.in.orig Thu Feb 13 01:31:51 2003 ++++ config.h.in Tue Feb 25 23:35:24 2003 @@ -327,6 +327,9 @@ /* Define to 1 if you have the `finite' function. */ #undef HAVE_FINITE @@ -11,13 +11,21 @@ $OpenBSD: patch-config_h_in,v 1.1.1.1 2003/02/23 21:27:28 danh Exp $ /* Define to 1 if you have the `getbootfile' function. */ #undef HAVE_GETBOOTFILE -@@ -335,6 +338,9 @@ - +@@ -336,11 +339,17 @@ /* Define to 1 if you have the `getdtablesize' function. */ #undef HAVE_GETDTABLESIZE -+ + +/* Define if you have the `getifaddrs' function. */ +#undef HAVE_GETIFADDRS - ++ /* Define to 1 if you have the `getrusage' function. */ #undef HAVE_GETRUSAGE + + /* Define to 1 if you have the `getuid' function. */ + #undef HAVE_GETUID ++ ++/* Define to 1 if you have the `geteuid' function. */ ++#undef HAVE_GETEUID + + /* Define to 1 if you have the `hstrerror' function. */ + #undef HAVE_HSTRERROR diff --git a/net/ntp/devel/patches/patch-configure_in b/net/ntp/devel/patches/patch-configure_in index 6e8cd768ca1..76ab136de5c 100644 --- a/net/ntp/devel/patches/patch-configure_in +++ b/net/ntp/devel/patches/patch-configure_in @@ -1,6 +1,6 @@ -$OpenBSD: patch-configure_in,v 1.1.1.1 2003/02/23 21:27:28 danh Exp $ +$OpenBSD: patch-configure_in,v 1.2 2003/02/26 15:54:17 danh Exp $ --- configure.in.orig Thu Feb 13 01:28:32 2003 -+++ configure.in Sun Feb 23 14:43:02 2003 ++++ configure.in Tue Feb 25 23:34:59 2003 @@ -223,23 +223,17 @@ AC_CHECK_LIB(kvm, main) dnl We already AC_CHECK_LIB(ld, nlist) AC_CHECK_LIB(mld, nlist) @@ -33,7 +33,15 @@ $OpenBSD: patch-configure_in,v 1.1.1.1 2003/02/23 21:27:28 danh Exp $ dnl Digital UNIX V4.0 and Solaris 7 have POSIX.1c functions in -lrt dnl Solaris 2.6 only has -lposix4; in Solaris 7, this is a symlink to -lrt, -@@ -682,6 +676,8 @@ case "$host" in +@@ -665,6 +659,7 @@ case "$host" in + *-pc-cygwin*) + ;; + *) AC_CHECK_FUNCS(getuid) ++ AC_CHECK_FUNCS(geteuid) + ;; + esac + AC_CHECK_FUNCS(hstrerror K_open kvm_open memcpy memmove memset) +@@ -682,6 +677,8 @@ case "$host" in ;; *-*-irix[[45]]*) # Just a stub in "old" Irix. Idiots. diff --git a/net/ntp/devel/patches/patch-ntpd_ntpd_c b/net/ntp/devel/patches/patch-ntpd_ntpd_c index 9224fd7e05d..9c144029a0c 100644 --- a/net/ntp/devel/patches/patch-ntpd_ntpd_c +++ b/net/ntp/devel/patches/patch-ntpd_ntpd_c @@ -1,16 +1,21 @@ -$OpenBSD: patch-ntpd_ntpd_c,v 1.1.1.1 2003/02/23 21:27:28 danh Exp $ ---- ntpd/ntpd.c.orig Sun Feb 23 14:22:07 2003 -+++ ntpd/ntpd.c Sun Feb 23 14:23:32 2003 -@@ -392,7 +392,11 @@ ntpdmain( +$OpenBSD: patch-ntpd_ntpd_c,v 1.2 2003/02/26 15:54:17 danh Exp $ +--- ntpd/ntpd.c.orig Sat Feb 8 18:02:39 2003 ++++ ntpd/ntpd.c Tue Feb 25 23:36:19 2003 +@@ -392,11 +392,16 @@ ntpdmain( } #endif -#if defined(HAVE_GETUID) && !defined(MPE) /* MPE lacks the concept of root */ -+/* -+ * MPE lacks the concept of root; -+ * OpenBSD can use privilege escalation via systrace. -+ */ -+#if defined(HAVE_GETUID) && !defined(MPE) && !defined(__OpenBSD__) ++#if (defined(HAVE_GETUID) || defined(HAVE_GETEUID)) \ ++ && !defined(MPE) /* MPE lacks the concept of root */ { uid_t uid; ++#if defined(HAVE_GETEUID) ++ uid = geteuid(); ++#else + uid = getuid(); ++#endif + if (uid) + { + msyslog(LOG_ERR, "ntpd: must be run as root, not uid %ld", (long)uid); diff --git a/net/ntp/stable/patches/patch-config_h_in b/net/ntp/stable/patches/patch-config_h_in index 084e40d0527..95451df26b0 100644 --- a/net/ntp/stable/patches/patch-config_h_in +++ b/net/ntp/stable/patches/patch-config_h_in @@ -1,7 +1,7 @@ -$OpenBSD: patch-config_h_in,v 1.1.1.1 2003/02/23 21:27:33 danh Exp $ +$OpenBSD: patch-config_h_in,v 1.2 2003/02/26 15:54:17 danh Exp $ --- config.h.in.orig Tue Dec 31 00:02:35 2002 -+++ config.h.in Sun Feb 23 12:26:38 2003 -@@ -334,6 +334,9 @@ ++++ config.h.in Tue Feb 25 23:26:07 2003 +@@ -334,11 +334,17 @@ /* Define to 1 if you have the `getdtablesize' function. */ #undef HAVE_GETDTABLESIZE @@ -11,3 +11,11 @@ $OpenBSD: patch-config_h_in,v 1.1.1.1 2003/02/23 21:27:33 danh Exp $ /* Define to 1 if you have the `getrusage' function. */ #undef HAVE_GETRUSAGE + /* Define to 1 if you have the `getuid' function. */ + #undef HAVE_GETUID ++ ++/* Define to 1 if you have the `geteuid' function. */ ++#undef HAVE_GETEUID + + /* Define to 1 if you have the `hstrerror' function. */ + #undef HAVE_HSTRERROR diff --git a/net/ntp/stable/patches/patch-configure_in b/net/ntp/stable/patches/patch-configure_in index fa7cdf8bb32..c7ab29da02d 100644 --- a/net/ntp/stable/patches/patch-configure_in +++ b/net/ntp/stable/patches/patch-configure_in @@ -1,6 +1,6 @@ -$OpenBSD: patch-configure_in,v 1.1.1.1 2003/02/23 21:27:33 danh Exp $ +$OpenBSD: patch-configure_in,v 1.2 2003/02/26 15:54:17 danh Exp $ --- configure.in.orig Mon Dec 30 23:58:34 2002 -+++ configure.in Sun Feb 23 15:23:43 2003 ++++ configure.in Tue Feb 25 23:25:37 2003 @@ -199,23 +199,16 @@ AC_CHECK_LIB(kvm, main) dnl We already AC_CHECK_LIB(ld, nlist) AC_CHECK_LIB(mld, nlist) @@ -32,7 +32,15 @@ $OpenBSD: patch-configure_in,v 1.1.1.1 2003/02/23 21:27:33 danh Exp $ dnl Digital UNIX V4.0 and Solaris 7 have POSIX.1c functions in -lrt dnl Solaris 2.6 only has -lposix4; in Solaris 7, this is a symlink to -lrt, -@@ -620,6 +613,8 @@ case "$host" in +@@ -603,6 +596,7 @@ case "$host" in + *-pc-cygwin*) + ;; + *) AC_CHECK_FUNCS(getuid) ++ AC_CHECK_FUNCS(geteuid) + ;; + esac + AC_CHECK_FUNCS(hstrerror K_open kvm_open memcpy memmove memset) +@@ -620,6 +614,8 @@ case "$host" in ;; *-*-irix[[45]]*) # Just a stub in "old" Irix. Idiots. diff --git a/net/ntp/stable/patches/patch-ntpd_ntpd_c b/net/ntp/stable/patches/patch-ntpd_ntpd_c index f1c66e77195..8fea27bb00d 100644 --- a/net/ntp/stable/patches/patch-ntpd_ntpd_c +++ b/net/ntp/stable/patches/patch-ntpd_ntpd_c @@ -1,16 +1,21 @@ -$OpenBSD: patch-ntpd_ntpd_c,v 1.1.1.1 2003/02/23 21:27:33 danh Exp $ ---- ntpd/ntpd.c.orig Sun Feb 23 15:21:42 2003 -+++ ntpd/ntpd.c Sun Feb 23 15:22:48 2003 -@@ -361,7 +361,11 @@ ntpdmain( +$OpenBSD: patch-ntpd_ntpd_c,v 1.2 2003/02/26 15:54:17 danh Exp $ +--- ntpd/ntpd.c.orig Fri Jun 28 01:55:53 2002 ++++ ntpd/ntpd.c Tue Feb 25 23:29:29 2003 +@@ -361,11 +361,16 @@ ntpdmain( } #endif -#if defined(HAVE_GETUID) && !defined(MPE) /* MPE lacks the concept of root */ -+ /* -+ * MPE lacks the concept of root; -+ * OpenBSD can use privilege escalation via systrace. -+ */ -+#if defined(HAVE_GETUID) && !defined(MPE) && !defined(__OpenBSD__) ++#if (defined(HAVE_GETUID) || defined(HAVE_GETEUID)) \ ++ && !defined(MPE) /* MPE lacks the concept of root */ { uid_t uid; ++#if defined(HAVE_GETEUID) ++ uid = geteuid(); ++#else + uid = getuid(); ++#endif + if (uid) + { + msyslog(LOG_ERR, "ntpd: must be run as root, not uid %ld", (long)uid);