3 # Save limit section options
5 require './proftpd-lib.pl';
6 &error_setup($text{'lserv_err'});
9 $conf = &get_ftpaccess_config($in{'file'});
13 $conf = &get_config();
14 $conf = &get_or_create_global($conf);
17 ($conf, $v) = &get_virtual_config($in{'virt'});
20 $anon = &find_directive_struct("Anonymous", $conf);
21 $conf = $anon->{'members'};
23 if ($in{'idx'} ne '') {
24 $conf = $conf->[$in{'idx'}]->{'members'};
27 $l = $conf->[$in{'limit'}];
31 # Delete the directory
32 &lock_file($l->{'file'});
34 $lref = &read_file_lines($l->{'file'});
35 splice(@$lref, $l->{'line'}, $l->{'eline'} - $l->{'line'} + 1);
38 &unlock_file($l->{'file'});
40 &redirect("ftpaccess_index.cgi?file=$in{'file'}");
42 elsif ($in{'idx'} eq '') {
47 &redirect("anon_index.cgi?virt=$in{'virt'}");
50 &redirect("virt_index.cgi?virt=$in{'virt'}");
54 &redirect("dir_index.cgi?virt=$in{'virt'}&idx=$in{'idx'}&anon=$in{'anon'}&global=$in{'global'}");
56 &webmin_log("limit", "delete", $l->{'value'});
60 local @c = split(/\0/, $in{'cmd'});
61 @c || &error($text{'lserv_ecmd'});
62 &lock_file($l->{'file'});
64 $lref = &read_file_lines($l->{'file'});
65 $lref->[$l->{'line'}] = "<Limit ".join(" ", @c).">";
68 &unlock_file($l->{'file'});
69 &redirect("limit_index.cgi?virt=$in{'virt'}&idx=$in{'idx'}&limit=$in{'limit'}&anon=$in{'anon'}&file=$in{'file'}&global=$in{'global'}");
70 &webmin_log("limit", "save", $l->{'value'}, \%in);