#37823 [Opn->Csd]: posix_setgid fails to logout of groups, or call initgroups()

From: Date: Mon, 19 Jun 2006 02:20:07 +0000
Subject: #37823 [Opn->Csd]: posix_setgid fails to logout of groups, or call initgroups()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-98458@lists.php.net to get a copy of this message
ID: 37823 Updated by: iliaa@php.net Reported By: james-php at bytehosting dot com -Status: Open +Status: Closed Bug Type: POSIX related Operating System: mandriva2006.0 - linux 2.6.12-22 PHP Version: 5.1.4 New Comment: This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. The posix_initgroups() was added in CVS. Previous Comments: ------------------------------------------------------------------------ [2006-06-16 01:07:42] james-php at bytehosting dot com Description: ------------ When calling posix_get[e]gid() to drop root privledges, it does NOT logout of group=0(root). Please look VERY closely at the 'id' output from the script, you will see that the third section "groups=" shows that i am effectively still logged into group "0". It indeed sets the current process group id to 0, however, it does NOT completely DROP all group memeberships, as well PHP provides no "posix_initgroups()" so there is no way to call initgroups() on linux to re-init the group memeberships from /etc/group, which would effectively, or should, drop the group=0(root) membership. Reproduce code: --------------- <? system("id"); posix_setgid(500); posix_setegid(500); posix_setuid(500); posix_seteuid(500); system("id"); ?> Expected result: ---------------- [root@admin cluster]# php test.php uid=0(root) gid=0(root) groups=0(root) uid=500(cluster) gid=500(cluster) groups=500(cluster) [root@admin cluster]# Actual result: -------------- [root@admin cluster]# php test.php uid=0(root) gid=0(root) groups=0(root) uid=500(cluster) gid=500(cluster) groups=0(root) [root@admin cluster]# ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=37823&edit=1

« previous php.bugs (#98458) next »