This is an automated email from the ASF dual-hosted git repository.
eze pushed a commit to branch 9.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/9.2.x by this push:
new 27f5048835 Fix unchecked return value of initgroups() (#11855)
27f5048835 is described below
commit 27f504883547502b1f5e4e389edd7f26e3ab246f
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 b4f0ecace5..8a95d4b132 100644
--- a/src/tscore/ink_cap.cc
+++ b/src/tscore/ink_cap.cc
@@ -160,7 +160,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: