This is an automated email from the ASF dual-hosted git repository.

cmcfarlen pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 8ebd48133befac4eef080f8ecdf9c3b71ecbbee6
Author: Masakazu Kitajo <[email protected]>
AuthorDate: Tue Nov 12 11:13:59 2024 -0700

    Fix unchecked return value of initgroups() (#11855)
    
    * Fix unchecked return value of initgroups()
    
    Signed-off-by: Jeffrey Bencteux <[email protected]>
    
    * clang-format
    
    ---------
    
    Signed-off-by: Jeffrey Bencteux <[email protected]>
    Co-authored-by: Jeffrey Bencteux <[email protected]>
    (cherry picked from commit ae638096e259121d92d46a9f57026a5ff5bc328b)
---
 src/tscore/ink_cap.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/tscore/ink_cap.cc b/src/tscore/ink_cap.cc
index 11197a7539..0f0d6f869e 100644
--- a/src/tscore/ink_cap.cc
+++ b/src/tscore/ink_cap.cc
@@ -156,7 +156,9 @@ impersonate(const struct passwd *pwd, ImpersonationLevel 
level)
 #endif
 
   // Always repopulate the supplementary group list for the new user.
-  initgroups(pwd->pw_name, pwd->pw_gid);
+  if (initgroups(pwd->pw_name, pwd->pw_gid) != 0) {
+    Fatal("switching to user %s, failed to initialize supplementary groups ID 
%ld", pwd->pw_name, (long)pwd->pw_gid);
+  }
 
   switch (level) {
   case IMPERSONATE_PERMANENT:

Reply via email to