···
static char * sourceProg = SOURCE_PROG;
static char * wrapperDir = WRAPPER_DIR;
29
+
// Wrapper debug variable name
30
+
static char * wrapperDebug = "WRAPPER_DEBUG";
// Update the capabilities of the running process to include the given
// capability in the Ambient set.
static void set_ambient_cap(cap_value_t cap)
···
if (capng_update(CAPNG_ADD, CAPNG_INHERITABLE, (unsigned long) cap))
37
-
printf("cannot raise the capability into the Inheritable set\n");
40
+
perror("cannot raise the capability into the Inheritable set\n");
···
59
-
fprintf(stderr, "no caps set or could not retrieve the caps for this file, not doing anything...\n");
62
+
if(getenv(wrapperDebug))
63
+
fprintf(stderr, "no caps set or could not retrieve the caps for this file, not doing anything...");
···
if (cap_from_name(tok, &capnum))
130
-
fprintf(stderr, "cap_from_name failed, skipping: %s\n", tok);
135
+
if(getenv(wrapperDebug))
136
+
fprintf(stderr, "cap_from_name failed, skipping: %s", tok);
else if (capnum == CAP_SETPCAP)
134
-
// Check for the cap_setpcap capability, we set this on the
135
-
// wrapper so it can elevate the capabilities to the Ambient
136
-
// set but we do not want to propagate it down into the
137
-
// wrapped program.
139
-
// TODO: what happens if that's the behavior you want
140
-
// though???? I'm preferring a strict vs. loose policy here.
141
-
fprintf(stderr, "cap_setpcap in set, skipping it\n");
140
+
// Check for the cap_setpcap capability, we set this on the
141
+
// wrapper so it can elevate the capabilities to the Ambient
142
+
// set but we do not want to propagate it down into the
143
+
// wrapped program.
145
+
// TODO: what happens if that's the behavior you want
146
+
// though???? I'm preferring a strict vs. loose policy here.
147
+
if(getenv(wrapperDebug))
148
+
fprintf(stderr, "cap_setpcap in set, skipping it\n");
145
-
set_ambient_cap(capnum);
146
-
printf("raised %s into the Ambient capability set\n", tok);
152
+
set_ambient_cap(capnum);
154
+
if(getenv(wrapperDebug))
155
+
fprintf(stderr, "raised %s into the Ambient capability set\n", tok);