I've been reading that. And the example of dropping setuid permissions has utterly baffled me (my comments added):
my @temp = ($EUID, $EGID); # Store EUID and EGID
my $orig_uid = $UID; # Store UID and GID
my $orig_gid = $GID;
$EUID = $UID; # Set EUID and EGID to
+ UID and GID
$EGID = $GID;
# Drop privileges
$UID = $orig_uid; # Set UID and GID to..
+. themselves?
$GID = $orig_gid;
# Make sure privs are really gone
($EUID, $EGID) = @temp; # Set effective UID an
+d GID what
# they were before? He
+lp!
die "Can't drop privileges"
unless $UID == $EUID && $GID eq $EGID; # Test UID
+and GID
I don't get that. |