summaryrefslogtreecommitdiffstats
path: root/runtime/staprun/staprun_funcs.c
diff options
context:
space:
mode:
authorDavid Smith <dsmith@redhat.com>2009-06-11 16:29:13 -0500
committerDavid Smith <dsmith@redhat.com>2009-06-11 16:29:13 -0500
commit5dce84d4fe74644ef76004ff0402510b289a2778 (patch)
tree613deb4149bdfee88f48cc28d7a4b124946e5777 /runtime/staprun/staprun_funcs.c
parent43229357282fd51eb1a3c7742932068873c27270 (diff)
parent749269040630f0f250f431a258e7967f54dc9a5c (diff)
downloadsystemtap-steved-5dce84d4fe74644ef76004ff0402510b289a2778.tar.gz
systemtap-steved-5dce84d4fe74644ef76004ff0402510b289a2778.tar.xz
systemtap-steved-5dce84d4fe74644ef76004ff0402510b289a2778.zip
Merge commit 'origin/master' into pr7043
Diffstat (limited to 'runtime/staprun/staprun_funcs.c')
-rw-r--r--runtime/staprun/staprun_funcs.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/runtime/staprun/staprun_funcs.c b/runtime/staprun/staprun_funcs.c
index 8da7e7e8..781bb999 100644
--- a/runtime/staprun/staprun_funcs.c
+++ b/runtime/staprun/staprun_funcs.c
@@ -459,8 +459,21 @@ int check_permissions(void)
#endif
/* If we're root, we can do anything. */
- if (getuid() == 0)
+ if (getuid() == 0) {
+ /* ... like overriding the real UID */
+ const char *env_id = getenv("SYSTEMTAP_REAL_UID");
+ if (env_id && setreuid(atoi(env_id), -1))
+ err("WARNING: couldn't set staprun UID to '%s': %s",
+ env_id, strerror(errno));
+
+ /* ... or overriding the real GID */
+ env_id = getenv("SYSTEMTAP_REAL_GID");
+ if (env_id && setregid(atoi(env_id), -1))
+ err("WARNING: couldn't set staprun GID to '%s': %s",
+ env_id, strerror(errno));
+
return 1;
+ }
/* Check permissions for group membership. */
check_groups_rc = check_groups ();