You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ma...@apache.org on 2024/11/12 18:14:06 UTC

(trafficserver) branch master updated: Fix unchecked return value of initgroups() (#11855)

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

maskit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new ae638096e2 Fix unchecked return value of initgroups() (#11855)
ae638096e2 is described below

commit ae638096e259121d92d46a9f57026a5ff5bc328b
Author: Masakazu Kitajo <ma...@apache.org>
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 <je...@gmail.com>
    
    * clang-format
    
    ---------
    
    Signed-off-by: Jeffrey Bencteux <je...@gmail.com>
    Co-authored-by: Jeffrey Bencteux <je...@gmail.com>
---
 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: