Re: iterating over /etc/group
| From: | Arcady Genkin | Date: | Wed, 04 Jul 2001 23:52:31 +0000 |
| Subject: | Re: iterating over /etc/group | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-56247@lists.php.net to get a copy of this message | ||
teo@gecadsoftware.com writes:
> On Wed, 04 Jul 2001, Arcady Genkin wrote:
>
> > Does PHP provide no high-level means of iterating over the UNIX
> > /etc/group file, a la getgrent() C function? The task is to figure
> > out all groups that a user is in on a system with PHP in _safe mode_
> > (hence, cannot read from /etc/group directly).
> > Am I overlooking something?
> >
> system ("/usr/bin/id $user -G");
Thanks, but this would not work in safe mode.
I solved the problem by having a cron job making a local copy of
/etc/group once in a while; my script then goes through it line by
line to extract the groups. But this is a hack...
I could, of course, install `id' in the safe_mode_exec_dir, but the
sys admin is rather reluctant to have too many executables in there,
and I understand him. I just wish that PHP had a posix_getgrent()
function. Maybe I should file a feature request... I'll go do that
now.
--
Arcady Genkin
i=1; while 1, hilb(i); i=i+1; end