From 4acf011e3556517bf6c73fefab0073abefc05df0 Mon Sep 17 00:00:00 2001
From: "Eric S. Raymond" <esr@thyrsus.com>
Date: Sun, 7 Mar 1999 17:36:33 +0000
Subject: GETEUID check.

svn path=/trunk/; revision=2398
---
 NEWS         | 4 +++-
 configure.in | 5 +++--
 rcfile_y.y   | 4 ++++
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/NEWS b/NEWS
index 9dcc80bd..1234f18e 100644
--- a/NEWS
+++ b/NEWS
@@ -11,8 +11,10 @@ fetchmail-5.0.0 ():
 * Fix lexical-analyzer bug that rejected `set nobouncemail',
 * Prevent send_bouncemail from stepping on SMTP antispam response.
 * Added French internationalization (LC_ALL=fr) from Guy Brand.
+* Added Hugo Rabson's script for fetching from Hotmail.
+* Test for .fetchmailrc ownership using geteuid() when possible.
 
-There are 262 people on fetchmail-friends and 356 on fetchmail-announce.
+There are 262 people on fetchmail-friends and 359 on fetchmail-announce.
 
 fetchmail-4.7.8 (Mon Feb 22 10:06:04 EST 1999):
 * FreeBSD support for interface and monitor options by Andy Doran <ad@psn.ie>.
diff --git a/configure.in b/configure.in
index 79c7ddc3..53b07e56 100644
--- a/configure.in
+++ b/configure.in
@@ -126,8 +126,9 @@ AC_SUBST(EXTRADEFS)
 AC_SUBST(EXTRASRC)
 AC_SUBST(EXTRAOBJ)
 
-AC_CHECK_FUNCS(tcsetattr stty setsid seteuid gethostbyname res_search herror \
-  strrchr strerror setlinebuf syslog snprintf vprintf vsnprintf vsyslog \
+AC_CHECK_FUNCS(tcsetattr stty setsid geteuid seteuid gethostbyname \
+  res_search herror strrchr strerror setlinebuf syslog \
+  snprintf vprintf vsnprintf vsyslog \
   atexit inet_aton strftime setrlimit socketpair sigprocmask)
 
 # Under Red Hat 4.0 (and many other Linuxes) -lresolv is seriously flaky
diff --git a/rcfile_y.y b/rcfile_y.y
index 7935ba17..793426fc 100644
--- a/rcfile_y.y
+++ b/rcfile_y.y
@@ -397,7 +397,11 @@ int prc_filecheck(const char *pathname, const flag securecheck)
 	return(PS_AUTHFAIL);
     }
 
+#ifdef HAVE_GETEUID
+    if (statbuf.st_uid != geteuid())
+#else
     if (statbuf.st_uid != getuid())
+#endif /* HAVE_GETEUID */
     {
 	fprintf(stderr, "File %s must be owned by you.\n", pathname);
 	return(PS_AUTHFAIL);
-- 
cgit v1.2.3