Index: xc/programs/Xserver/Xprint/attributes.c =================================================================== RCS file: /cvs/xprint/xprint/src/xprint_main/xc/programs/Xserver/Xprint/attributes.c,v retrieving revision 1.5 diff -u -2 -0 -r1.5 attributes.c --- a/xc/programs/Xserver/Xprint/attributes.c 16 Sep 2003 00:26:25 -0000 1.5 +++ b/xc/programs/Xserver/Xprint/attributes.c 17 May 2004 01:46:18 -0000 @@ -1155,41 +1155,48 @@ close(0); dup(pipefd[0]); close(pipefd[0]); /* * If a user name is specified, try to set our uid to match that * user name. This is to allow e.g. a banner page to show the * name of the printing user rather than the user who started * the print server. */ if(userName) { uid_t myUid; if((myUid = geteuid()) == (uid_t)0) { struct passwd *pPasswd; if((pPasswd = getpwnam(userName))) { - setuid((uid_t)pPasswd->pw_uid); + if (setgid((gid_t)pPasswd->pw_gid) != 0) + perror("SendFileToCommand: setgid() failure."); + + if (initgroups(userName, (gid_t)pPasswd->pw_gid) != 0) + perror("SendFileToCommand: initgroups() failure."); + + if (setuid((uid_t)pPasswd->pw_uid) != 0) + perror("SendFileToCommand: setuid() failure."); } } } /* return BadAlloc? */ if (execv(pCommand, argVector) == -1) { FatalError("unable to exec '%s'", pCommand); } } else { int res; (void) close(pipefd[0]); outPipe = fdopen(pipefd[1], "w"); (void) TransferBytes(fp, outPipe, (int)statBuf.st_size); (void) fclose(outPipe); (void) fclose(fp);