Index: cache_cf.c =================================================================== RCS file: /cvsroot/squid/squid/src/cache_cf.c,v retrieving revision 1.13 diff -u -r1.13 cache_cf.c --- cache_cf.c 2001/01/12 08:20:32 1.13 +++ cache_cf.c 2001/01/25 15:07:55 @@ -386,9 +386,10 @@ } if (aclPurgeMethodInUse(Config.accessList.http)) Config2.onoff.enable_purge = 1; - if (NULL != Config.effectiveUser) { - struct passwd *pwd = getpwnam(Config.effectiveUser); - if (NULL == pwd) + if (geteuid() == 0) { + if (NULL != Config.effectiveUser) { + struct passwd *pwd = getpwnam(Config.effectiveUser); + if (NULL == pwd) /* * Andres Kroonmaa : * Some getpwnam() implementations (Solaris?) require @@ -398,18 +399,22 @@ * This should be safe at startup, but might still fail * during reconfigure. */ - fatalf("getpwnam failed to find userid for effective user '%s'", - Config.effectiveUser, - xstrerror()); - Config2.effectiveUserID = pwd->pw_uid; - } - if (NULL != Config.effectiveGroup) { - struct group *grp = getgrnam(Config.effectiveGroup); - if (NULL == grp) - fatalf("getgrnam failed to find groupid for effective group '%s'", - Config.effectiveGroup, - xstrerror()); - Config2.effectiveGroupID = grp->gr_gid; + fatalf("getpwnam failed to find userid for effective user '%s'", + Config.effectiveUser, + xstrerror()); + Config2.effectiveUserID = pwd->pw_uid; + } + if (NULL != Config.effectiveGroup) { + struct group *grp = getgrnam(Config.effectiveGroup); + if (NULL == grp) + fatalf("getgrnam failed to find groupid for effective group '%s'", + Config.effectiveGroup, + xstrerror()); + Config2.effectiveGroupID = grp->gr_gid; + } + } else { + Config2.effectiveUserID = geteuid(); + Config2.effectiveGroupID = getegid(); } urlExtMethodConfigure(); }