Re: discarding root privileges in suid perl
On Mon, Oct 16, 2000 at 01:52:51PM +1100, Brian May wrote:
>>>>>> "Ben" == Ben Gertzfield <che@debian.org> writes:
>
>>>>>> "Brian" == Brian May <bam@debian.org> writes:
> Brian> die "Can't drop privileges" unless $UID == $EUID && $GID eq
> Brian> $EGID;
>
>If you are on a machine that supports membership in multiple groups
>simultaneously, [$GID] gives a space separated list of groups you are
>in.
>
>which would imply that it is a string, and eq should be used.
Using == forces numeric context, converting the string to a numeric:
$ perl -le 'print "string equal" if "42 1 2 3" eq "42 4 5 6"'
$ perl -le 'print "numerically equal" if "42 1 2 3" == "42 4 5 6"'
numerically equal
Regards,
--
Brendan O'Dea bod@compusol.com.au
Compusol Pty. Limited (NSW, Australia) +61 2 9810 3633
Reply to: