summaryrefslogtreecommitdiff
path: root/pinyweb/suid/piny-suid.c
diff options
context:
space:
mode:
Diffstat (limited to 'pinyweb/suid/piny-suid.c')
-rw-r--r--pinyweb/suid/piny-suid.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/pinyweb/suid/piny-suid.c b/pinyweb/suid/piny-suid.c
index badc580..8df0046 100644
--- a/pinyweb/suid/piny-suid.c
+++ b/pinyweb/suid/piny-suid.c
@@ -1,6 +1,7 @@
#define _GNU_SOURCE
#include <errno.h>
+#include <grp.h>
#include <pwd.h>
#include <regex.h>
#include <stdio.h>
@@ -92,6 +93,13 @@ int main( int argc, char *argv[] ) {
return 1;
};
+ if ( initgroups( argv[1], pwd->pw_gid ) != 0 ) {
+ err = errno;
+ syslog( LOG_ERR, "Unable to initgroups: %s, %s", argv[1], strerror( err ) );
+ fprintf( stderr, "Unable to initgroups: %s\n", strerror( err ) );
+ return 1;
+ };
+
if ( setregid( pwd->pw_gid, pwd->pw_gid ) != 0 ) {
err = errno;
syslog( LOG_ERR, "Unable to change GID: %s, %s", argv[1], strerror( err ) );