archrelease: copy trunk to extra-x86_64
[arch-packages.git] / cups / repos / extra-x86_64 / guid.patch
blobb1bd19232e72d4c1177ed951873689e522272e39
1 --- cups-2.4.0/scheduler/cups-exec.c 2021-11-29 16:19:34.235186064 +0100
2 +++ cups-2.4.0/scheduler/cups-exec.c.new 2021-11-29 16:25:30.764049649 +0100
3 @@ -134,9 +134,14 @@ main(int argc, /* I - Number of command-line args */
4 # if CUPS_SNAP
5 if (setgroups(0, NULL))
6 # else
7 - if (setgroups(1, &gid))
8 -# endif /* CUPS_SNAP */
9 +#include <pwd.h>
10 + struct passwd * pwd = getpwuid(uid);
11 + if(initgroups(pwd->pw_name,pwd->pw_gid))
12 + {
13 + fprintf(stderr, "DEBUG: initgroups failed\n");
14 exit(errno + 100);
15 + }
16 +# endif /* CUPS_SNAP */
18 if (uid && setuid(uid))
19 exit(errno + 100);
20 --- cups-2.4.0/scheduler/util.c 2021-11-29 15:27:31.000000000 +0100
21 +++ cups-2.4.0/scheduler/util.c.new 2021-11-29 16:29:58.810719066 +0100
22 @@ -296,7 +296,16 @@
25 if (!getuid() && user)
26 - setuid(user); /* Run as restricted user */
27 + {
28 +#include <pwd.h>
29 + struct passwd * pwd = getpwuid(user);
30 + if(initgroups(pwd->pw_name,pwd->pw_gid))
31 + {
32 + fprintf(stderr, "DEBUG: initgroups failed\n");
33 + exit(errno + 100);
34 + }
35 + setuid(user); /* Run as restricted user */
36 + }
38 if ((fd = open("/dev/null", O_RDONLY)) > 0)