diff options
author | Mike Buland <eichlan@xagasoft.com> | 2011-08-15 17:33:40 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2011-08-15 17:33:40 +0000 |
commit | bc6952f06b9d1cff7417d3f71ce5a65704ebbb02 (patch) | |
tree | 88c4e4527669b258015c076a02ad0c084cba015a | |
parent | bc9e6678f6b917f67317a2987866bf1787a3e076 (diff) | |
download | libbu++-bc6952f06b9d1cff7417d3f71ce5a65704ebbb02.tar.gz libbu++-bc6952f06b9d1cff7417d3f71ce5a65704ebbb02.tar.bz2 libbu++-bc6952f06b9d1cff7417d3f71ce5a65704ebbb02.tar.xz libbu++-bc6952f06b9d1cff7417d3f71ce5a65704ebbb02.zip |
You can setgid now too.
-rw-r--r-- | src/process.cpp | 4 | ||||
-rw-r--r-- | src/process.h | 4 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/process.cpp b/src/process.cpp index b3f2801..e6b9f3d 100644 --- a/src/process.cpp +++ b/src/process.cpp | |||
@@ -154,6 +154,10 @@ void Bu::Process::gexec( Flags eFlags, const char *sName, char *const argv[] ) | |||
154 | ::close( iaStdErr[0] ); | 154 | ::close( iaStdErr[0] ); |
155 | dup2( iaStdErr[1], 2 ); | 155 | dup2( iaStdErr[1], 2 ); |
156 | } | 156 | } |
157 | if( (opt.eFlags&Options::SetGid) ) | ||
158 | { | ||
159 | setgid( opt.iGid ); | ||
160 | } | ||
157 | if( (opt.eFlags&Options::SetUid) ) | 161 | if( (opt.eFlags&Options::SetUid) ) |
158 | { | 162 | { |
159 | setuid( opt.iUid ); | 163 | setuid( opt.iUid ); |
diff --git a/src/process.h b/src/process.h index f3d84b1..6295b49 100644 --- a/src/process.h +++ b/src/process.h | |||
@@ -40,12 +40,14 @@ namespace Bu | |||
40 | { | 40 | { |
41 | None = 0x00, | 41 | None = 0x00, |
42 | SetUid = 0x01, | 42 | SetUid = 0x01, |
43 | SetGid = 0x02, | ||
43 | }; | 44 | }; |
44 | 45 | ||
45 | Options() : eFlags( None ) {} | 46 | Options() : eFlags( None ) {} |
46 | 47 | ||
47 | OptFlags eFlags; | 48 | int eFlags; |
48 | int iUid; | 49 | int iUid; |
50 | int iGid; | ||
49 | }; | 51 | }; |
50 | 52 | ||
51 | Process( Flags eFlags, const char *sName, char *const argv[] ); | 53 | Process( Flags eFlags, const char *sName, char *const argv[] ); |