#!/opt/bin/perl -Tw use strict; use English; # long names for special variables use CGI qw(:standard); use CGI::Carp 'fatalsToBrowser'; $OUTPUT_AUTOFLUSH = 1; # flush output buffer after each output statement ... # ... slower but helpful for output over the network $OUTPUT_RECORD_SEPARATOR = "\n"; print header; # to generate document-type print XHTMLhead(); middle(); print XHTMLtail(); # -- subroutines follow -- # sub middle { my $real_ID = $REAL_USER_ID || -1; my $effect_ID = $EFFECTIVE_USER_ID || -1; my $real_name = ($real_ID != -1) ? ((getpwuid $real_ID)[0]) : "-- unknown --"; my $effect_name = ($effect_ID != -1) ? ((getpwuid $effect_ID)[0]) : "-- unknown --"; print "
"; print " This program is being run by the user with"; print " ID $real_ID (", $real_name,")"; printf "%s ", ($real_ID == $effect_ID) ?"and" :"but"; print "the effective user ID is $effect_ID (", $effect_name, ")."; print "
"; if ($real_ID != $effect_ID) { print "Therefore the program is running as suid."; } elsif ($real_name =~ /^httpd?/) { print "It looks like the program is being run by the server."; } else { print "It looks like the program is being run under suexec."; } print "
"; print "Name | Value |
---|---|
$name | $value |
%s | %s |
%s | %vd |