Debian Codegraph @

debian/patches/hardening-server

raw symbols SCIP
1 Description: pass CPPFLAGS to compile flags for server
2 And then the build fails with an unused-return-value error.
3 So let's handle setgid/setuid results.
4 Origin: vendor
5 Forwarded: no
6 Author: gregor herrmann <[email protected]>
7 Last-Update: 2014-06-24
8
9 --- a/inc/My/Builder.pm
10 +++ b/inc/My/Builder.pm
11 @@ -127,6 +127,7 @@
12 '-I' . $server_directory, # does not seem to be necessary
13 $cbuilder->split_like_shell(`pkg-config glib-2.0 --cflags`),
14 $cbuilder->split_like_shell(`pkg-config glib-2.0 --libs`),
15 + $cbuilder->split_like_shell($ENV{CPPFLAGS}),
16 ],
17 );
18 }
19 --- a/server/tools.c
20 +++ b/server/tools.c
21 @@ -261,8 +261,12 @@
22 if (user_to_switch != NULL) {
23 struct passwd* user = getpwnam(user_to_switch);
24 if (user) {
25 - setgid(user->pw_gid);
26 - setuid(user->pw_uid);
27 + if (setgid(user->pw_gid) < 0) {
28 + l3(OUTPUT_TYPE_ERROR, "Cannot set gid to %u for user %s: %s", (unsigned)user->pw_gid, user_to_switch, strerror(errno));
29 + }
30 + if (setuid(user->pw_uid) < 0) {
31 + l3(OUTPUT_TYPE_ERROR, "Cannot set uid to %u for user %s: %s", (unsigned)user->pw_uid, user_to_switch, strerror(errno));
32 + }
33 } else {
34 l2(OUTPUT_TYPE_ERROR, "Cannot switch user to %s: %s", user_to_switch, strerror(errno));
35 }