From 0498d818fe40cb4eb03983e27a980791bbadf6db Mon Sep 17 00:00:00 2001 From: Roland Mainz Date: Sat, 8 May 2004 02:06:46 +0000 Subject: [PATCH] Fix for http://pdx.freedesktop.org/cgi-bin/bugzilla/show_bug.cgi?id=608 ("Can not print on Debian/CUPS due to error |Xprt_64:lpr: unable to print file: server-error-not-accepting-jobs|"): Xprt did not setup the list of supplementary group ids, causing print failure when the the calling user must be a member in a specific group to be allowed to print. --- Xprint/attributes.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Xprint/attributes.c b/Xprint/attributes.c index d02c54e37..3ad9ceca0 100644 --- a/Xprint/attributes.c +++ b/Xprint/attributes.c @@ -1170,7 +1170,14 @@ SendFileToCommand( 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."); } } }