pagsh: do not call set[ug]id()
authorBenjamin Kaduk <kaduk@mit.edu>
Mon, 9 Feb 2015 17:09:32 +0000 (12:09 -0500)
committerJeffrey Altman <jaltman@your-file-system.com>
Fri, 12 Jun 2015 13:43:29 +0000 (09:43 -0400)
Supposedly calling setuid(getuid()) and setgid(getgid()) would
help pick up a new group list on some systems, in the depths
of history.  In the absence of reason to believe this is still
the case, drop the calls to avoid scary warnings about unchecked
return values.

Change-Id: I39e87a27fb52f5a6868b867c9325d4a5fa93ef58
Reviewed-on: http://gerrit.openafs.org/11759
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams <3chas3@gmail.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

src/log/pagsh.c

index 7bbdcfb..773d6a2 100644 (file)
@@ -32,7 +32,7 @@ int
 main(int argc, char *argv[])
 {
     struct passwd *pwe;
-    int uid, gid;
+    int uid;
     char *shell = "/bin/sh";
 
 #ifdef AFS_AIX32_ENV
@@ -49,7 +49,6 @@ main(int argc, char *argv[])
     nsa.sa_flags = SA_FULLDUMP;
     sigaction(SIGSEGV, &nsa, NULL);
 #endif
-    gid = getgid();
     uid = getuid();
     pwe = getpwuid(uid);
     if (pwe == 0) {
@@ -63,8 +62,6 @@ main(int argc, char *argv[])
 #ifdef AFS_KERBEROS_ENV
     ktc_newpag();
 #endif
-    (void)setuid(uid);
-    (void)setgid(gid);
     argv[0] = shell;
     execvp(shell, argv);
     perror(shell);