midchildan commented on code in PR #11872:
URL: https://github.com/apache/trafficserver/pull/11872#discussion_r1847729165


##########
src/tscore/ink_cap.cc:
##########
@@ -156,8 +156,10 @@ impersonate(const struct passwd *pwd, ImpersonationLevel 
level)
 #endif
 
   // Always repopulate the supplementary group list for the new user.
-  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);
+  if (geteuid() == 0) { // check that we have enough rights to call 
initgroups()
+    if (initgroups(pwd->pw_name, pwd->pw_gid) != 0) {

Review Comment:
   I think `initgroups()` should be called at the end of `impersonate()` too so 
that the supplementary groups would be repopulated when elevating privileges 
instead of dropping them.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to