diff options
author | Dave Brolley <brolley@redhat.com> | 2009-05-22 15:42:11 -0400 |
---|---|---|
committer | Dave Brolley <brolley@redhat.com> | 2009-05-22 15:42:11 -0400 |
commit | 5131240c3f9c9c3a2c714ac873fdcdd11f10f617 (patch) | |
tree | b19f660c1497fb2f93de7a36589f7538b74282be /runtime/staprun | |
parent | c5e0f4ba999fac089cbec076549cb9cd14cd58ed (diff) | |
parent | 9e501962301f8c76b17a8eafc83fc2505c5457c0 (diff) | |
download | systemtap-steved-5131240c3f9c9c3a2c714ac873fdcdd11f10f617.tar.gz systemtap-steved-5131240c3f9c9c3a2c714ac873fdcdd11f10f617.tar.xz systemtap-steved-5131240c3f9c9c3a2c714ac873fdcdd11f10f617.zip |
Merge branch 'master' of git://sources.redhat.com/git/systemtap
Diffstat (limited to 'runtime/staprun')
-rw-r--r-- | runtime/staprun/staprun_funcs.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/runtime/staprun/staprun_funcs.c b/runtime/staprun/staprun_funcs.c index 46271146..1ebd124e 100644 --- a/runtime/staprun/staprun_funcs.c +++ b/runtime/staprun/staprun_funcs.c @@ -460,8 +460,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 (); |