diff options
author | Josh Stone <jistone@redhat.com> | 2009-04-02 18:59:03 -0700 |
---|---|---|
committer | Josh Stone <jistone@redhat.com> | 2009-04-02 19:00:00 -0700 |
commit | b516e13ac098181536ae7281a8263e8f5b3553eb (patch) | |
tree | 47f4bcb56a70daee58b59b77a2043782e8612558 /runtime/staprun/staprun_funcs.c | |
parent | b9e80fe13706ae1c820e565e9b26f00b5f5a8dca (diff) | |
download | systemtap-steved-b516e13ac098181536ae7281a8263e8f5b3553eb.tar.gz systemtap-steved-b516e13ac098181536ae7281a8263e8f5b3553eb.tar.xz systemtap-steved-b516e13ac098181536ae7281a8263e8f5b3553eb.zip |
Really fix run-stap this time, I promise!
Diffstat (limited to 'runtime/staprun/staprun_funcs.c')
-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 e94e5d13..49b37988 100644 --- a/runtime/staprun/staprun_funcs.c +++ b/runtime/staprun/staprun_funcs.c @@ -316,8 +316,21 @@ int check_permissions(void) int path_check = 0; /* 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; + } /* Lookup the gid for group "stapdev" */ errno = 0; |