# procedure to check if the setuid bit is on
sub checkSUID {
return( -u $_[0] );
}
Some file test operators
-r readable
-x executable
-e exists
-d is a directory
-t is a tty
-T text file
Example
################################################################
# Check Security
################################################################
# Users who wish to use this program must
# put the file ".allowmailform" in their home directory on the
# machine running this script. We don't want people creating
# forms that are abused to send "anonymous" mail.
$homedir = (getpwnam($recipient))[7];
if (! -e "$homedir/.allowmailform") {
# this user does not permit the server to send mail to him. Quit.
&error("The recipient of the form has not enabled access for this form"); exit(0);
}
