--- doc/loncapafiles/sanitycheck.piml 2003/02/03 18:03:51 1.13
+++ doc/loncapafiles/sanitycheck.piml 2012/10/05 15:36:21 1.38
@@ -2,7 +2,7 @@
"http://lpml.sourceforge.net/DTD/piml.dtd">
-
+
/etc/httpd/conf/loncapa.conf
+/etc/apache2/loncapa.conf
open IN, "<";
my $hbug=-1;
@@ -117,14 +122,14 @@ while (<IN>) {
if (/PerlSetVar\s+lonHostID\s+(\S+)/) {
my $v=$1;
$hbug=0;
- $hbug=1 if $v=~/\W/;
- $hbug=1 if $v=~/\_/;
+ $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=~/\_/;
+ $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) {
@@ -147,37 +152,47 @@ 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 %line;
+my $line=0;
+while (my $l = <IN>) {
+ $line++;
+ next if ($l=~/^(\#|\s*$)/);
+ if ($l=~/^\^/) {
+ if ($l !~ /^\^[\w.\-]/) {
+ $dns_bug = 1;
+ push(@{$line{'dns'}},$line);
+ }
+ } elsif ($l=~/\S/) {
+ if ($l=~/\r/) { $rbug=1; push(@{$line{'r'}},$line); }
+ my @a=split(/:/,$l);
+ if ($a[0]=~/[^\w\-.]/ ||
+ $a[1]=~/[^\w\-.]/ ||
+ $a[0]=~/\_/ ||
+ $a[1]=~/\_/ ) { $dbug=1; push(@{$line{'d'}},$line); }
+ if (@a<6 || @a>6) { $fbug=1; push(@{$line{'f'}},$line); }
my $expr='\s.+$';
- $sbug=1 if ($a[0] =~ /$expr/ ||
- $a[1] =~ /$expr/ ||
- $a[2] =~ /$expr/ ||
- $a[3] =~ /$expr/ ||
- $a[4] =~ /$expr/ )
+ if ($a[0] =~ /$expr/ ||
+ $a[1] =~ /$expr/ ||
+ $a[2] =~ /$expr/ ||
+ $a[3] =~ /$expr/ ) { $sbug=1; push(@{$line{'s'}},$line); }
;
}
}
close IN;
if ($rbug) {
- print "**** ERROR **** is DOS-formatted\n";
+ print "**** ERROR **** is DOS-formatted (lines ".join(', ',@{$line{'r'}}).")\n";
}
if ($dbug) {
- print "**** ERROR **** has invalid host id or domain id\n";
+ print "**** ERROR **** has invalid host id or domain id (lines ".join(', ',@{$line{'d'}}).")\n";
}
if ($fbug) {
- print "**** ERROR **** is lacking 5 or 6 columns for every row\n";
+ print "**** ERROR **** is lacking 6 columns for every row (lines ".join(', ',@{$line{'f'}}).")\n";
}
if ($sbug) {
- print "**** ERROR **** has illegal whitespace character\n";
+ print "**** ERROR **** has illegal whitespace character (lines ".join(', ',@{$line{'s'}}).")\n";
+}
+if ($dns_bug) {
+ print "**** ERROR **** host.tab server entry has characters (lines ".join(', ',@{$line{'dns'}}).")\n";
}
@@ -186,12 +201,14 @@ 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.+$/;
+while (my $line = <IN>) {
+ if ($line =~ /\S/) {
+ $rbug=1 if $line=~/\r/;
+ if ($line =~ /\W.*\n/) {
+ $dbug=$line if ($line !~/\w:(?:primary|default)$/);
+ }
+ $dbug=$line if $line=~/\_/;
+ $sbug=1 if $line=~/\s.+$/;
}
}
close IN;
@@ -199,7 +216,7 @@ if ($rbug) {
print "**** ERROR **** is DOS-formatted\n";
}
if ($dbug) {
- print "**** ERROR **** has invalid host id\n";
+ print "**** ERROR **** has invalid host id ($dbug)\n";
}
if ($sbug) {
print "**** ERROR **** has illegal whitespace character\n";