diff -Naur webmin-1.140.orig/proftpd/edit_aserv.cgi webmin-1.140/proftpd/edit_aserv.cgi --- webmin-1.140.orig/proftpd/edit_aserv.cgi 2004-04-05 20:25:07.000000000 -0300 +++ webmin-1.140/proftpd/edit_aserv.cgi 2004-04-23 18:51:50.895564888 -0300 @@ -2,6 +2,25 @@ # edit_aserv.cgi # Edit section details +sub opt_ftpinput +{ +local $default = 0; +local $text = ""; +if (defined($_[0]) && $_[0] ne "ftp") { + $default = 1; + $text = $_[0]; +} +else { + $default = 0; +} +sprintf " $_[2]\n". + "\n". + " %s\n", + ($default) ? "" : "checked", + ($default) ? "checked" : "", + $text, $_[4]; +} + require './proftpd-lib.pl'; &ReadParse(); ($conf, $v) = &get_virtual_config($in{'virt'}); @@ -19,9 +38,7 @@ print $text{'aserv_desc'},"
\n" if ($in{'init'}); $user = &find_directive("User", $anon->{'members'}); -$user ||= "ftp" if ($in{'init'}); $group = &find_directive("Group", $anon->{'members'}); -$group ||= "ftp" if ($in{'init'}); print "
\n"; print "\n"; @@ -35,11 +52,11 @@ $anon->{'value'}, &file_chooser_button("root", 1); print " $text{'aserv_user'}\n"; -print "",&opt_input($user, "User", $text{'default'}, 13), +print "",&opt_ftpinput($user, "User", $text{'default'}, 13), " \n"; print " $text{'aserv_group'}\n"; -print "",&opt_input($group, "Group", $text{'default'}, 13), +print "",&opt_ftpinput($group, "Group", $text{'default'}, 13), " \n"; print " \n"; diff -Naur webmin-1.140.orig/proftpd/save_aserv.cgi webmin-1.140/proftpd/save_aserv.cgi --- webmin-1.140.orig/proftpd/save_aserv.cgi 2004-04-05 20:25:07.000000000 -0300 +++ webmin-1.140/proftpd/save_aserv.cgi 2004-04-23 18:52:02.178849568 -0300 @@ -21,6 +21,9 @@ $in{'Group_def'} || scalar(getgrnam($in{'Group'})) || &error($text{'aserv_egroup'}); +$user = $in{'User_def'} ? "ftp" : $in{'User'}; +$group = $in{'Group_def'} ? "ftp" : $in{'Group'}; + if ($in{'init'}) { # Create a new directive $l = $vconf->[@$vconf - 1]; @@ -28,11 +31,12 @@ &before_changing(); $lref = &read_file_lines($l->{'file'}); local @l = ( "" ); - push(@l, "User $in{'User'}") if (!$in{'User_def'}); - push(@l, "UserAlias anonymous $in{'User'}") if (!$in{'User_def'}); - push(@l, "Group $in{'Group'}") if (!$in{'Group_def'}); + push(@l, "User $user"); + push(@l, "UserAlias anonymous $user"); + push(@l, "Group $group"); + push(@l, "RequireValidShell off"); push(@l, ""); - splice(@$lref, $l->{'line'}+1, 0, @l); + splice(@$lref, $l->{'eline'}+1, 0, @l); &after_changing(); &unlock_file($l->{'file'}); } @@ -43,9 +47,11 @@ &before_changing(); $lref = &read_file_lines($anon->{'file'}); $lref->[$anon->{'line'}] = ""; - &save_directive("User", $in{'User_def'} ? [ ] : [ $in{'User'} ], + &save_directive("User", [ $user ], + $anon->{'members'}, $vconf); + &save_directive("Group", [ $group ], $anon->{'members'}, $vconf); - &save_directive("Group", $in{'Group_def'} ? [ ] : [ $in{'Group'} ], + &save_directive("UserAlias", [ "anonymous $user" ], $anon->{'members'}, $vconf); &after_changing(); &unlock_file($anon->{'file'});