18b76430e6
Fix remote exploit if autokey is enabled (CVE-2009-1252).
22 lines
584 B
Plaintext
22 lines
584 B
Plaintext
$OpenBSD: patch-ntpd_ntpd_c,v 1.4 2009/05/23 16:32:29 naddy Exp $
|
|
--- ntpd/ntpd.c.orig Mon May 18 10:22:36 2009
|
|
+++ ntpd/ntpd.c Sat May 23 17:02:24 2009
|
|
@@ -484,11 +484,16 @@ ntpdmain(
|
|
}
|
|
#endif
|
|
|
|
-#if defined(HAVE_GETUID) && !defined(MPE) /* MPE lacks the concept of root */
|
|
+#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);
|