summarylogtreecommitdiffstats
path: root/guid.patch
diff options
context:
space:
mode:
authorPlaton Ryzhikov2019-10-24 20:36:14 +0300
committerPlaton Ryzhikov2019-10-24 20:36:14 +0300
commitb078f757fa5ebc9137c603e0c0a6e6b8649a343c (patch)
tree576bc5f71a0c3c1481ec7969e42b53ddf2a2b5e4 /guid.patch
downloadaur-b078f757fa5ebc9137c603e0c0a6e6b8649a343c.tar.gz
Initial commit
Diffstat (limited to 'guid.patch')
-rw-r--r--guid.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/guid.patch b/guid.patch
new file mode 100644
index 000000000000..ce28e024f3fd
--- /dev/null
+++ b/guid.patch
@@ -0,0 +1,42 @@
+diff --git a/scheduler/cups-exec.c b/scheduler/cups-exec.c
+index aab43a797..46c549075 100644
+--- a/scheduler/cups-exec.c
++++ b/scheduler/cups-exec.c
+@@ -133,8 +133,13 @@ main(int argc, /* I - Number of command-line args */
+ if (setgid(gid))
+ exit(errno + 100);
+
+- if (setgroups(1, &gid))
++#include <pwd.h>
++ struct passwd * pwd = getpwuid(uid);
++ if(initgroups(pwd->pw_name,pwd->pw_gid))
++ {
++ fprintf(stderr, "DEBUG: initgroups failed\n");
+ exit(errno + 100);
++ }
+
+ if (uid && setuid(uid))
+ exit(errno + 100);
+diff --git a/scheduler/util.c b/scheduler/util.c
+index 19ebf069b..4638562bd 100644
+--- a/scheduler/util.c
++++ b/scheduler/util.c
+@@ -300,7 +300,16 @@ cupsdPipeCommand(int *pid, /* O - Process ID or 0 on error */
+ */
+
+ if (!getuid() && user)
+- setuid(user); /* Run as restricted user */
++ {
++#include <pwd.h>
++ struct passwd * pwd = getpwuid(user);
++ if(initgroups(pwd->pw_name,pwd->pw_gid))
++ {
++ fprintf(stderr, "DEBUG: initgroups failed\n");
++ exit(errno + 100);
++ }
++ setuid(user); /* Run as restricted user */
++ }
+
+ if ((fd = open("/dev/null", O_RDONLY)) > 0)
+ {
+