File:
[LON-CAPA] /
doc /
loncapafiles /
sanitycheck.piml
Revision
1.5:
download - view:
text,
annotated -
select for diffs
Sat Aug 17 18:59:48 2002 UTC (21 years, 11 months ago) by
harris41
Branches:
MAIN
CVS tags:
HEAD
BUG 649; stringently check lonDefDomain against invalid entries of
"priv", "uploaded", "adm", "raw", or "userfiles"; this process will
run whenever a filesystem upgrade is performed (and wherever else
sanitycheck.piml is invoked inside loncom/build/Makefile). The namespace
underneath DocumentRoot (currently /home/httpd/html) must be protected
for emergent LON-CAPA functionality.
1: <!DOCTYPE piml PUBLIC "-//TUX/DTD piml 1.0 Final//EN"
2: "http://lpml.sourceforge.net/DTD/piml.dtd">
3: <!-- sanitycheck.piml -->
4: <!-- Scott Harrison -->
5:
6: <!-- $Id: sanitycheck.piml,v 1.5 2002/08/17 18:59:48 harris41 Exp $ -->
7:
8: <!--
9:
10: This file is part of the LearningOnline Network with CAPA (LON-CAPA).
11:
12: LON-CAPA is free software; you can redistribute it and/or modify
13: it under the terms of the GNU General Public License as published by
14: the Free Software Foundation; either version 2 of the License, or
15: (at your option) any later version.
16:
17: LON-CAPA is distributed in the hope that it will be useful,
18: but WITHOUT ANY WARRANTY; without even the implied warranty of
19: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20: GNU General Public License for more details.
21:
22: You should have received a copy of the GNU General Public License
23: along with LON-CAPA; if not, write to the Free Software
24: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25:
26: /home/httpd/html/adm/gpl.txt
27:
28: http://www.lon-capa.org/
29:
30: -->
31:
32: <piml>
33: <targetroot>/</targetroot>
34: <files>
35: <file>
36: <target dist='default'>/etc/httpd/conf/loncapa.conf</target>
37: <perlscript mode='fg'>
38: open IN, "<<TARGET />";
39: my $hbug=-1;
40: my $dbug=-1;
41: while (<IN>) {
42: if (/PerlSetVar\s+lonHostID\s+(\S+)/) {
43: my $v=$1;
44: $hbug=0;
45: $hbug=1 if $v=~/\W/;
46: $hbug=1 if $v=~/\_/;
47: }
48: if (/PerlSetVar\s+lonDefDomain\s+(\S+)/) {
49: my $v=$1;
50: $dbug=0;
51: $dbug=1 if $v=~/\W/;
52: $dbug=1 if $v=~/\_/;
53: # Avoid namespace conflicts under the web server's DocumentRoot.
54: my @badnames=('raw','userfiles','priv','adm','uploaded');
55: foreach my $bad (@badnames) {
56: $dbug=1 if $v eq $bad;
57: }
58: }
59: }
60: if ($hbug) {
61: print "**** ERROR **** <TARGET /> has invalid lonHostID\n";
62: }
63: if ($dbug) {
64: print "**** ERROR **** <TARGET /> has invalid lonDefDomain\n";
65: }
66: </perlscript>
67: </file>
68: <file>
69: <target dist='default'>/home/httpd/lonTabs/hosts.tab</target>
70: open IN, "<<TARGET />";
71: my $rbug=0;
72: my $dbug=0;
73: my $sbug=0;
74: my $fbug=0;
75: while (<IN>) {
76: if (/\S/) {
77: $rbug=1 if /\r/;
78: my @a=split(/\:/,$_);
79: $dbug=1 if $a[0]=~/\W/;
80: $dbug=1 if $a[0]=~/\_/;
81: $dbug=1 if $a[1]=~/\_/;
82: $dbug=1 if $a[1]=~/\W/;
83: $fbug=1 if (@a<5 || @a>6);
84: my $expr='\s.+$';
85: $sbug=1 if ($a[0] =~ /$expr/ ||
86: $a[1] =~ /$expr/ ||
87: $a[2] =~ /$expr/ ||
88: $a[3] =~ /$expr/ ||
89: $a[4] =~ /$expr/ )
90: ;
91: }
92: }
93: close IN;
94: if ($rbug) {
95: print "**** ERROR **** <TARGET /> is DOS-formatted\n";
96: }
97: if ($dbug) {
98: print "**** ERROR **** <TARGET /> has invalid host id or domain id\n";
99: }
100: if ($fbug) {
101: print "**** ERROR **** <TARGET /> is lacking 5 or 6 columns for every row\n";
102: }
103: if ($sbug) {
104: print "**** ERROR **** <TARGET /> has illegal whitespace character\n";
105: }
106: </file>
107: <file>
108: <target dist='default'>/home/httpd/lonTabs/spare.tab</target>
109: open IN, "<<TARGET />";
110: my $rbug=0;
111: my $dbug=0;
112: my $sbug=0;
113: while (<IN>) {
114: if (/\S/) {
115: $rbug=1 if /\r/;
116: $dbug=1 if $_=~/\W.*\n$/;
117: $dbug=1 if $_=~/\_/;
118: $sbug=1 if /\s.+$/;
119: }
120: }
121: close IN;
122: if ($rbug) {
123: print "**** ERROR **** <TARGET /> is DOS-formatted\n";
124: }
125: if ($dbug) {
126: print "**** ERROR **** <TARGET /> has invalid host id\n";
127: }
128: if ($sbug) {
129: print "**** ERROR **** <TARGET /> has illegal whitespace character\n";
130: }
131: </file>
132: </files>
133: </piml>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>