group list and havp will get the gid of the last entry in groups(5). ok giovanni@ (maintainer) robert@ jasper@
34 lines
918 B
Plaintext
34 lines
918 B
Plaintext
$OpenBSD: patch-havp_helper_cpp,v 1.1 2012/05/17 09:10:44 ajacoutot Exp $
|
|
--- havp/helper.cpp.orig Wed May 16 19:42:02 2012
|
|
+++ havp/helper.cpp Wed May 16 19:42:43 2012
|
|
@@ -325,6 +325,16 @@ bool ChangeUserAndGroup( string usr, string grp )
|
|
return false;
|
|
}
|
|
|
|
+ /*
|
|
+ * Set the GID before initgroups(), since on some platforms
|
|
+ * setgid() is known to zap the group list.
|
|
+ */
|
|
+ if ( setgid( my_group->gr_gid ) < 0 )
|
|
+ {
|
|
+ cout << "Could not change group to: " << grp << endl;
|
|
+ return false;
|
|
+ }
|
|
+
|
|
#ifdef HAVE_INITGROUPS
|
|
if ( initgroups( usr.c_str(), user->pw_gid ) )
|
|
{
|
|
@@ -340,12 +350,6 @@ bool ChangeUserAndGroup( string usr, string grp )
|
|
}
|
|
#endif
|
|
#endif
|
|
-
|
|
- if ( setgid( my_group->gr_gid ) < 0 )
|
|
- {
|
|
- cout << "Could not change group to: " << grp << endl;
|
|
- return false;
|
|
- }
|
|
|
|
if ( setuid( user->pw_uid ) < 0 )
|
|
{
|