diff options
author | Julian Blake Kongslie <jblake@omgwallhack.org> | 2011-05-23 22:13:32 -0700 |
---|---|---|
committer | Julian Blake Kongslie <jblake@omgwallhack.org> | 2011-05-23 22:13:32 -0700 |
commit | 4965b97b6dc3e4fac4c2a8271dfd91a3ea2ccde6 (patch) | |
tree | 1e87fb024a323bf9c7c2787a831d43b22e8b25c3 | |
parent | 8b7f289b40c899a3353ac4df35df021482d97a6c (diff) | |
download | piny-code-4965b97b6dc3e4fac4c2a8271dfd91a3ea2ccde6.tar.gz piny-code-4965b97b6dc3e4fac4c2a8271dfd91a3ea2ccde6.zip |
Call initgroups in the suid wrapper.
-rw-r--r-- | pinyweb/suid/piny-suid.c | 8 |
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 ) ); |