SecBSD's official ports repository

This commit is contained in:
purplerain 2023-08-16 22:26:55 +00:00
commit 2c0afcbbf3
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
64331 changed files with 5339189 additions and 0 deletions

View file

@ -0,0 +1,33 @@
Index: havp/helper.cpp
--- havp/helper.cpp.orig
+++ havp/helper.cpp
@@ -341,6 +341,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 ) )
{
@@ -356,12 +366,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 )
{