/ /var/lib/mysql/mysql.sock /tmp/mysql.sock unless (-e '') # Does file exist? { print("**** ERROR **** Missing \n"); } else # It exists, so look at the file metadata more closely. { my @s = stat(''); my $uid = $s[4]; my $mode = $s[2]; my $web_uid = getpwnam('www'); my $smode = sprintf("%04o",$mode & 07777); if ($uid ne $web_uid) # If file owned by someone else other than www. { print('**** ERROR **** should be owned by'. ' www.'."\n".'Try these commands to make things right:'."\n". 'chown www:www '."\n". 'chmod a-rwx,u+rwx '."\n"); } else # Check permissions on the file to make sure it is private to www. { $smode =~ /^.(.)..$/; my $wflag = $1; if ($wflag != 7) # Can www use this socket? (Hope so!) { print('**** ERROR **** '. ' should be user "rwx" (by'. ' www).'."\n".'Try these commands to make things right:'."\n". 'chown www:www '."\n". 'chmod a-rwx,u+rwx '."\n"); } $smode=~/^..(..)$/; $wflag=$1; if ($wflag ne "00") # Can others use this socket? (Hope not!) { print('**** ERROR **** '. ' should not be group or everybody accessible'. '.'."\n".'Try these commands to make things right:'."\n". 'chown www:www '."\n". 'chmod a-rwx,u+rwx '."\n"); } } } /etc/httpd/conf/loncapa.conf open IN, "<"; my $hbug=-1; my $dbug=-1; while (<IN>) { if (/PerlSetVar\s+lonHostID\s+(\S+)/) { my $v=$1; $hbug=0; $hbug=1 if $v=~/\W/; $hbug=1 if $v=~/\_/; } if (/PerlSetVar\s+lonDefDomain\s+(\S+)/) { my $v=$1; $dbug=0; $dbug=1 if $v=~/\W/; $dbug=1 if $v=~/\_/; # Avoid namespace conflicts under the web server's DocumentRoot. my @badnames=('raw','userfiles','priv','adm','uploaded'); foreach my $bad (@badnames) { $dbug=1 if $v eq $bad; } } } if ($hbug) { print "**** ERROR **** has invalid lonHostID\n"; } if ($dbug) { print "**** ERROR **** has invalid lonDefDomain\n"; } /home/httpd/lonTabs/hosts.tab open IN, "<"; my $rbug=0; my $dbug=0; my $sbug=0; my $fbug=0; while (<IN>) { next if (/^(\#|\s*$)/); if (/\S/) { $rbug=1 if /\r/; my @a=split(/\:/,$_); $dbug=1 if $a[0]=~/\W/; $dbug=1 if $a[0]=~/\_/; $dbug=1 if $a[1]=~/\_/; $dbug=1 if $a[1]=~/\W/; $fbug=1 if (@a<5 || @a>6); my $expr='\s.+$'; $sbug=1 if ($a[0] =~ /$expr/ || $a[1] =~ /$expr/ || $a[2] =~ /$expr/ || $a[3] =~ /$expr/ || $a[4] =~ /$expr/ ) ; } } close IN; if ($rbug) { print "**** ERROR **** is DOS-formatted\n"; } if ($dbug) { print "**** ERROR **** has invalid host id or domain id\n"; } if ($fbug) { print "**** ERROR **** is lacking 5 or 6 columns for every row\n"; } if ($sbug) { print "**** ERROR **** has illegal whitespace character\n"; } /home/httpd/lonTabs/spare.tab open IN, "<"; my $rbug=0; my $dbug=0; my $sbug=0; while (<IN>) { if (/\S/) { $rbug=1 if /\r/; $dbug=1 if $_=~/\W.*\n$/; $dbug=1 if $_=~/\_/; $sbug=1 if /\s.+$/; } } close IN; if ($rbug) { print "**** ERROR **** is DOS-formatted\n"; } if ($dbug) { print "**** ERROR **** has invalid host id\n"; } if ($sbug) { print "**** ERROR **** has illegal whitespace character\n"; }