From bc6952f06b9d1cff7417d3f71ce5a65704ebbb02 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 15 Aug 2011 17:33:40 +0000 Subject: You can setgid now too. --- src/process.cpp | 4 ++++ src/process.h | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'src') 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[] ) ::close( iaStdErr[0] ); dup2( iaStdErr[1], 2 ); } + if( (opt.eFlags&Options::SetGid) ) + { + setgid( opt.iGid ); + } if( (opt.eFlags&Options::SetUid) ) { 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 { None = 0x00, SetUid = 0x01, + SetGid = 0x02, }; Options() : eFlags( None ) {} - OptFlags eFlags; + int eFlags; int iUid; + int iGid; }; Process( Flags eFlags, const char *sName, char *const argv[] ); -- cgit v1.2.3