diff -rup fetchmail-5.9.13.orig/fetchmail.c fetchmail-5.9.13-1/fetchmail.c --- fetchmail-5.9.13.orig/fetchmail.c 2002-06-22 16:03:11.000000000 -0400 +++ fetchmail-5.9.13-1/fetchmail.c 2002-08-13 09:15:45.000000000 -0400 @@ -487,7 +487,7 @@ int main(int argc, char **argv) * but ignore them otherwise so as not to interrupt a poll. */ signal(SIGUSR1, SIG_IGN); - if (run.poll_interval && !getuid()) + if (run.poll_interval && getuid() == ROOT_UID) signal(SIGHUP, SIG_IGN); } else @@ -1171,7 +1171,7 @@ static int load_params(int argc, char ** */ if (!run.postmaster) { - if (getuid()) /* ordinary user */ + if (getuid() != ROOT_UID) /* ordinary user */ run.postmaster = user; else /* root */ run.postmaster = "postmaster"; diff -rup fetchmail-5.9.13.orig/fetchmail.h fetchmail-5.9.13-1/fetchmail.h --- fetchmail-5.9.13.orig/fetchmail.h 2002-06-22 16:03:13.000000000 -0400 +++ fetchmail-5.9.13-1/fetchmail.h 2002-08-13 08:21:18.000000000 -0400 @@ -647,4 +647,10 @@ char *strerror (); } while(0) #endif /* FETCHMAIL_DEBUG */ +#ifdef __CYGWIN__ +#define ROOT_UID 18 +#else /* !__CYGWIN__ */ +#define ROOT_UID 0 +#endif /* __CYGWIN__ */ + /* fetchmail.h ends here */ diff -rup fetchmail-5.9.13.orig/idle.c fetchmail-5.9.13-1/idle.c --- fetchmail-5.9.13.orig/idle.c 2001-09-26 13:20:15.000000000 -0400 +++ fetchmail-5.9.13-1/idle.c 2002-08-19 12:34:23.000000000 -0400 @@ -78,7 +78,7 @@ int interruptible_idle(int seconds) * for people who think all system daemons wake up on SIGHUP. */ signal(SIGUSR1, donothing); - if (!getuid()) + if (getuid() == ROOT_UID) signal(SIGHUP, donothing); #ifndef __EMX__ @@ -163,12 +163,13 @@ int interruptible_idle(int seconds) pause(); signal(SIGALRM, SIG_IGN); #endif /* ! EMX */ - if (lastsig == SIGUSR1 || ((seconds && !getuid()) && lastsig == SIGHUP)) + if (lastsig == SIGUSR1 || ((seconds && getuid() == ROOT_UID) + && lastsig == SIGHUP)) awoken = TRUE; /* now lock out interrupts again */ signal(SIGUSR1, SIG_IGN); - if (!getuid()) + if (getuid() == ROOT_UID) signal(SIGHUP, SIG_IGN); return(awoken ? lastsig : 0); diff -rup fetchmail-5.9.13.orig/lock.c fetchmail-5.9.13-1/lock.c --- fetchmail-5.9.13.orig/lock.c 2001-09-24 13:56:31.000000000 -0400 +++ fetchmail-5.9.13-1/lock.c 2002-08-13 09:18:40.000000000 -0400 @@ -29,7 +29,7 @@ void lock_setup(void) { /* set up to do lock protocol */ #define FETCHMAIL_PIDFILE "fetchmail.pid" - if (!getuid()) { + if (getuid() == ROOT_UID) { lockfile = (char *)xmalloc( sizeof(PID_DIR) + sizeof(FETCHMAIL_PIDFILE) + 1); sprintf(lockfile, "%s/%s", PID_DIR, FETCHMAIL_PIDFILE); diff -rup fetchmail-5.9.13.orig/sink.c fetchmail-5.9.13-1/sink.c --- fetchmail-5.9.13.orig/sink.c 2002-06-22 16:53:58.000000000 -0400 +++ fetchmail-5.9.13-1/sink.c 2002-08-19 11:14:54.000000000 -0400 @@ -937,6 +937,9 @@ static int open_mda_sink(struct query *c #ifdef HAVE_SIGACTION struct sigaction sa_new; #endif /* HAVE_SIGACTION */ +#ifdef HAVE_SETEUID + uid_t orig_uid; +#endif /* HAVE_SETEUID */ struct idlist *idp; int length = 0, fromlen = 0, nameslen = 0; char *names = NULL, *before, *after, *from = NULL; @@ -1062,6 +1065,7 @@ static int open_mda_sink(struct query *c * MDA creates properly. (The seteuid call is available * under all BSDs and Linux) */ + orig_uid = getuid(); seteuid(ctl->uid); #endif /* HAVE_SETEUID */ @@ -1071,7 +1075,7 @@ static int open_mda_sink(struct query *c #ifdef HAVE_SETEUID /* this will fail quietly if we didn't start as root */ - seteuid(0); + seteuid(orig_uid); #endif /* HAVE_SETEUID */ if (!sinkfp)