3 # Display access control options
5 require './wuftpd-lib.pl';
6 &ui_print_header(undef, $text{'acl_title'}, "", "acl");
8 $conf = &get_ftpaccess();
9 @class = &find_value("class", $conf);
11 print "<form action=save_acl.cgi>\n";
12 print "<table border width=100%>\n";
13 print "<tr $tb> <td><b>$text{'acl_header'}</b></td> </tr>\n";
14 print "<tr $cb> <td><table width=100%>\n";
16 # Display addresses to deny from
17 @deny = ( &find_value("deny", $conf), [ ] );
18 print "<tr> <td valign=top><b>$text{'acl_deny'}</b></td>\n";
19 print "<td colspan=3><table border>\n";
20 print "<tr $tb> <td><b>$text{'acl_daddrs'}</b></td>\n",
21 "<td><b>$text{'acl_dmsg'}</b></td> </tr>\n";
25 print "<td><input name=daddrs_$i size=20 value='$d->[0]'></td>\n";
26 print "<td><input name=dmsg_$i size=35 value='$d->[1]'></td>\n";
30 print "</table></td> </tr>\n";
31 print "<tr> <td colspan=4><hr></td> </tr>\n";
33 # Display concurrent login limits
34 @limit = ( &find_value("limit", $conf), [ ] );
35 print "<tr> <td valign=top><b>$text{'acl_limit'}</b></td>\n";
36 print "<td colspan=3><table border>\n";
37 print "<tr $tb> <td><b>$text{'acl_class'}</b></td>\n",
38 "<td><b>$text{'acl_n'}</b></td>\n",
39 "<td><b>$text{'acl_times'}</b></td>\n",
40 "<td><b>$text{'acl_lmsg'}</b></td> </tr>\n";
44 print "<td><select name=lclass_$i>\n";
45 printf "<option value='' %s> \n", $l->[0] ? '' : 'checked';
47 printf "<option %s>%s\n",
48 $l->[0] eq $c->[0] ? 'selected' : '', $c->[0];
50 print "</select></td>\n";
52 printf "<td><input type=radio name=ln_def_$i value=1 %s> %s\n",
53 $l->[1] =~ /^\d+$/ ? '' : 'checked', $text{'acl_unlimited'};
54 printf "<input type=radio name=ln_def_$i value=0 %s>\n",
55 $l->[1] =~ /^\d+$/ ? 'checked' : '';
56 printf "<input name=ln_$i size=8 value='%s'></td>\n",
57 $l->[1] =~ /^\d+$/ ? $l->[1] : '';
59 printf "<td><input type=radio name=ltimes_def_$i value=1 %s> %s\n",
60 lc($l->[2]) eq 'any' ? 'checked' : '', $text{'acl_any'};
61 printf "<input type=radio name=ltimes_def_$i value=0 %s>\n",
62 lc($l->[2]) eq 'any' ? '' : 'checked';
63 printf "<input name=ltimes_$i size=10 value='%s'></td>\n",
64 lc($l->[2]) eq 'any' ? '' : $l->[2];
66 print "<td><input name=lmsg_$i size=20 value='$l->[3]'></td>\n";
70 print "</table></td> </tr>\n";
71 print "<tr> <td colspan=4><hr></td> </tr>\n";
73 # Display file and byte limits
74 @fblimit = sort { $a->{'line'} <=> $b->{'line'} }
75 ( &find("file-limit", $conf), &find("data-limit", $conf) );
77 print "<tr> <td valign=top><b>$text{'acl_file'}</b></td>\n";
78 print "<td colspan=3><table border>\n";
79 print "<tr $tb> <td><b>$text{'acl_fblimit'}</b></td>\n",
80 "<td><b>$text{'acl_inout'}</b></td>\n",
81 "<td><b>$text{'acl_raw'}</b></td>\n",
82 "<td><b>$text{'acl_count'}</b></td>\n",
83 "<td><b>$text{'acl_class'}</b></td> </tr>\n";
85 foreach $l (@fblimit) {
87 splice(@$f, 0, 0, '0') if ($f->[0] ne 'raw');
89 print "<td><select name=fblimit_$i>\n";
90 printf "<option value='' %s> \n",
91 $l->{'name'} ? '' : 'selected';
92 printf "<option value=file-limit %s>%s\n",
93 $l->{'name'} eq 'file-limit' ? 'selected' : '',
95 printf "<option value=byte-limit %s>%s\n",
96 $l->{'name'} eq 'byte-limit' ? 'selected' : '',
98 print "</select></td>\n";
100 print "<td><select name=fbinout_$i>\n";
101 printf "<option value=total %s>%s\n",
102 $f->[1] eq 'total' ? 'selected' : '', $text{'acl_total'};
103 printf "<option value=in %s>%s\n",
104 $f->[1] eq 'in' ? 'selected' : '', $text{'acl_in'};
105 printf "<option value=out %s>%s\n",
106 $f->[1] eq 'out' ? 'selected' : '', $text{'acl_out'};
107 print "</select></td>\n";
109 printf "<td><input type=radio name=fbraw_$i value=0 %s> %s\n",
110 $f->[0] eq 'raw' ? '' : 'checked', $text{'yes'};
111 printf "<input type=radio name=fbraw_$i value=1 %s> %s</td>\n",
112 $f->[0] eq 'raw' ? 'checked' : '', $text{'no'};
114 print "<td><input name=fbcount_$i size=10 value='$f->[2]'></td>\n";
116 print "<td><select name=fbclass_$i>\n";
117 printf "<option value='' %s> %s\n",
118 $f->[3] ? '' : 'selected', $text{'acl_all'};
119 foreach $c (@class) {
120 printf "<option %s>%s\n",
121 $f->[3] eq $c->[0] ? 'selected' : '', $c->[0];
123 print "</select></td>\n";
127 print "</table></td> </tr>\n";
128 print "<tr> <td colspan=4><hr></td> </tr>\n";
130 # File access controls
131 @noret = ( &find_value("noretrieve", $conf), [ ] );
132 print "<tr> <td valign=top><b>$text{'acl_noret'}</b></td>\n";
133 print "<td colspan=3><table border>\n";
134 print "<tr $tb> <td><b>$text{'acl_nfiles'}</b></td>\n",
135 "<td><b>$text{'acl_nrel'}</b></td>\n",
136 "<td><b>$text{'acl_nclass'}</b></td> </tr>\n";
138 foreach $n (@noret) {
141 if ($nn =~ /^class=(\S+)/) { $c{$1}++; }
142 elsif ($nn !~ /^(absolute|relative)$/) { push(@f, $nn); }
145 printf "<td><input name=nfiles_$i size=30 value='%s'></td>\n",
147 printf "<td><input type=radio name=nrel_$i value=1 %s> %s\n",
148 $n->[0] eq 'relative' ? 'checked' : '', $text{'yes'};
149 printf "<input type=radio name=nrel_$i value=0 %s> %s</td>\n",
150 $n->[0] eq 'relative' ? '' : 'checked', $text{'no'};
152 foreach $c (@class) {
153 printf "<input type=checkbox name=nclass_$i value=%s %s> %s\n",
154 $c->[0], !%c || $c{$c->[0]} ? 'checked' : '', $c->[0];
159 print "</table></td> </tr>\n";
161 @allowret = ( &find_value("allow-retrieve", $conf), [ ] );
162 print "<tr> <td valign=top><b>$text{'acl_allowret'}</b></td>\n";
163 print "<td colspan=3><table border>\n";
164 print "<tr $tb> <td><b>$text{'acl_afiles'}</b></td>\n",
165 "<td><b>$text{'acl_arel'}</b></td>\n",
166 "<td><b>$text{'acl_aclass'}</b></td> </tr>\n";
168 foreach $n (@allowret) {
171 if ($nn =~ /^class=(\S+)/) { $c{$1}++; }
172 elsif ($nn !~ /^(absolute|relative)$/) { push(@f, $nn); }
175 printf "<td><input name=afiles_$i size=30 value='%s'></td>\n",
177 printf "<td><input type=radio name=arel_$i value=1 %s> %s\n",
178 $n->[0] eq 'relative' ? 'checked' : '', $text{'yes'};
179 printf "<input type=radio name=arel_$i value=0 %s> %s</td>\n",
180 $n->[0] eq 'relative' ? '' : 'checked', $text{'no'};
182 foreach $c (@class) {
183 printf "<input type=checkbox name=aclass_$i value=%s %s> %s\n",
184 $c->[0], !%c || $c{$c->[0]} ? 'checked' : '', $c->[0];
189 print "</table></td> </tr>\n";
190 print "<tr> <td colspan=4><hr></td> </tr>\n";
192 # Display time-limit options
193 foreach $l (&find_value("limit-time", $conf)) {
194 if ($l->[0] eq '*') {
195 $limit{'anonymous'} = $limit{'guest'} = $l->[1];
198 $limit{$l->[0]} = $l->[1];
201 print "<tr> <td><b>$text{'acl_alimit'}</b></td>\n";
202 printf "<td><input type=radio name=alimit_def value=1 %s> %s\n",
203 $limit{'anonymous'} ? '' : 'checked', $text{'acl_unlimited'};
204 printf "<input type=radio name=alimit_def value=0 %s>\n",
205 $limit{'anonymous'} ? 'checked' : '';
206 printf "<input name=alimit size=6 value='%s'> %s</td>\n",
207 $limit{'anonymous'}, $text{'acl_mins'};
208 print "<td><b>$text{'acl_glimit'}</b></td>\n";
209 printf "<td><input type=radio name=glimit_def value=1 %s> %s\n",
210 $limit{'guest'} ? '' : 'checked', $text{'acl_unlimited'};
211 printf "<input type=radio name=glimit_def value=0 %s>\n",
212 $limit{'guest'} ? 'checked' : '';
213 printf "<input name=glimit size=6 value='%s'> %s</td> </tr>\n",
214 $limit{'guest'}, $text{'acl_mins'};
216 # Other security options
217 $lf = &find_value('loginfails', $conf);
218 print "<tr> <td><b>$text{'acl_fails'}</b></td>\n";
219 printf "<td><input type=radio name=fails_def value=1 %s> %s\n",
220 $lf ? '' : 'checked', $text{'default'};
221 printf "<input type=radio name=fails_def value=0 %s>\n",
222 $lf ? 'checked' : '';
223 print "<input name=fails size=6 value='$lf->[0]'></td>\n";
225 $pr = &find_value('private', $conf);
226 print "<td><b>$text{'acl_private'}</b></td>\n";
227 printf "<td><input type=radio name=private value=yes %s> %s\n",
228 $pr->[0] eq 'yes' ? 'checked' : '', $text{'yes'};
229 printf "<input type=radio name=private value=no %s> %s</td> </tr>\n",
230 $pr->[0] eq 'yes' ? '' : 'checked', $text{'no'};
232 print "</table></td></tr></table>\n";
233 print "<input type=submit value=\"$text{'save'}\"></form>\n";
235 &ui_print_footer("", $text{'index_return'});