3 # Add a new <Directory> section to a virtual server
5 require './proftpd-lib.pl';
9 $conf = &get_or_create_global($conf);
12 ($conf, $v) = &get_virtual_config($in{'virt'});
15 $anon = &find_directive_struct("Anonymous", $conf);
16 $conf = $anon->{'members'};
18 &error_setup($text{'dserv_err'});
21 $in{'dir'} =~ /^\S+$/ || &error($text{'dserv_edir'});
22 !$anon || $in{'dir'} !~ /^\// || $anon->{'value'} =~ /^\~/ ||
23 &is_under_directory($anon->{'value'}, $in{'dir'}) ||
24 &error($text{'dserv_eanondir'});
27 $l = $conf->[@$conf - 1];
28 &lock_file($l->{'file'});
30 $lref = &read_file_lines($l->{'file'});
31 @lines = ( "<Directory $in{'dir'}>", "</Directory>" );
32 splice(@$lref, $l->{'eline'}+1, 0, @lines);
35 &unlock_file($l->{'file'});
36 &webmin_log("dir", "create", "$v->{'value'}:$in{'dir'}", \%in);
37 &redirect("dir_index.cgi?virt=$in{'virt'}&anon=$in{'anon'}&global=$in{'global'}&idx=".scalar(@$conf));