diff --git a/xinetd/CHANGELOG b/xinetd/CHANGELOG index 9de3a2f0c..196a125f5 100644 --- a/xinetd/CHANGELOG +++ b/xinetd/CHANGELOG @@ -2,3 +2,5 @@ Added buttons to the module's main page for enabling or disabling multiple services at once. ---- Changes since 1.300 ---- Added support for IPv6 addresses. +---- Changes since 1.620 ---- +Re-wrote the UI to use Webmin's standard UI library. diff --git a/xinetd/edit_defaults.cgi b/xinetd/edit_defaults.cgi index 061bd5476..d3c7c5487 100755 --- a/xinetd/edit_defaults.cgi +++ b/xinetd/edit_defaults.cgi @@ -12,84 +12,70 @@ foreach $xi (&get_xinetd_config()) { } $q = $defs->{'quick'}; -print "
\n"; -print "\n"; -print "\n"; -print "\n"; -print "
$text{'defs_header'}
\n"; +print &ui_form_start("save_defaults.cgi", "post"); +print &ui_hidden("idx", $defs->{'index'}); +print &ui_table_start($text{'defs_header'}, "width=100%", 4); -print "\n"; -printf "\n"; +# Allow access from +print &ui_table_row($text{'serv_from'}, + &ui_radio("from_def", $q->{'only_from'} ? 0 : 1, + [ [ 1, $text{'serv_from_def'} ], + [ 0, $text{'serv_from_sel'} ] ])."
\n". + &ui_textarea("from", join("\n", @{$q->{'only_from'}}), 4, 20)); -print "\n"; -printf "\n"; +# Deny access from +print &ui_table_row($text{'serv_access'}, + &ui_radio("access_def", $q->{'no_access'} ? 0 : 1, + [ [ 1, $text{'serv_access_def'} ], + [ 0, $text{'serv_access_sel'} ] ])."
\n". + &ui_textarea("access", join("\n", @{$q->{'no_access'}}), 4, 20)); -print "\n"; +print &ui_table_hr(); +# Logging type $lt = $q->{'log_type'}->[0] eq 'SYSLOG' ? 1 : $q->{'log_type'}->[0] eq 'FILE' ? 2 : 0; -print "\n", - $text{'defs_hard'}, $lt == 2 ? $q->{'log_type'}->[3] : ''; +# Log to syslog +&foreign_require("syslog"); +push(@table, [ 1, $text{'defs_facility'}, + &ui_select("facility", $lt == 1 ? $q->{'log_type'}->[1] : "", + [ split(/\s+/, $syslog::config{'facilities'}) ]). + " ".$text{'defs_level'}." ". + &ui_select("level", $lt == 1 ? $q->{'log_type'}->[2] : "", + [ [ "", $text{'default'} ], + &syslog::list_priorities() ]) ]); -print "\n"; -print "\n"; +# Log to file +push(@table, [ 2, $text{'defs_file'}, + &ui_textbox("file", $lt == 2 ? $q->{'log_type'}->[1] : "", 60)." ". + &file_chooser_button("file")."
\n". + $text{'defs_soft'}." ". + &ui_bytesbox("soft", $lt == 2 ? $q->{'log_type'}->[2] : ""). + " ".$text{'defs_hard'}." ". + &ui_bytesbox("hard", $lt == 2 ? $q->{'log_type'}->[3] : "") ]); -print "\n"; -print "\n"; +print &ui_table_row($text{'defs_log'}, + &ui_radio_table("log_mode", $lt, \@table), 3); -print "
$text{'serv_from'} %s\n", - $q->{'only_from'} ? '' : 'checked', $text{'serv_from_def'}; -printf " %s
\n", - $q->{'only_from'} ? 'checked' : '', $text{'serv_from_sel'}; -print "
$text{'serv_access'} %s\n", - $q->{'no_access'} ? '' : 'checked', $text{'serv_access_def'}; -printf " %s
\n", - $q->{'no_access'} ? 'checked' : '', $text{'serv_access_sel'}; -print "

$text{'defs_log'} \n"; -printf " %s
\n", - $lt == 0 ? 'checked' : '', $text{'defs_log_def'}; -printf " %s\n", - $lt == 1 ? 'checked' : '', $text{'defs_facility'}; -%sconfig = &foreign_config("syslog"); -&foreign_require("syslog", "syslog-lib.pl"); -print " $text{'defs_level'}\n"; -print "
\n"; +# Default +@table = ( [ 0, $text{'defs_log_def'} ] ); -printf " %s\n", - $lt == 2 ? 'checked' : '', $text{'defs_file'}; -printf " %s
\n", - $lt == 2 ? $q->{'log_type'}->[1] : '', &file_chooser_button("file"); -printf "   %s \n", - $text{'defs_soft'}, $lt == 2 ? $q->{'log_type'}->[2] : ''; -printf "  %s
$text{'defs_success'}$text{'defs_failure'}
\n"; -print "
\n"; +# On success log +print &ui_table_row($text{'defs_success'}, + &ui_select("success", $q->{'log_on_success'}, + [ map { [ $_, $text{'defs_success_'.lc($_)} ] } + ('PID', 'HOST', 'USERID', 'EXIT', 'DURATION') ], + 5, 1)); + +# On failed connection log +print &ui_table_row($text{'defs_failure'}, + &ui_select("failure", $q->{'log_on_failure'}, + [ map { [ $_, $text{'defs_failure_'.lc($_)} ] } + ('HOST', 'USERID', 'ATTEMPT') ], 5, 1)); + +print &ui_table_end(); +print &ui_form_end([ [ undef, $text{'save'} ] ]); &ui_print_footer("", $text{'index_return'}); diff --git a/xinetd/save_defaults.cgi b/xinetd/save_defaults.cgi index c2172152e..d851cf60e 100755 --- a/xinetd/save_defaults.cgi +++ b/xinetd/save_defaults.cgi @@ -35,8 +35,8 @@ elsif ($in{'log_mode'} == 2) { $in{'soft'} =~ /^\d*$/ || &error($text{'defs_esoft'}); $in{'hard'} =~ /^\d*$/ || &error($text{'defs_ehard'}); &set_member_value($defs, 'log_type', 'FILE', $in{'file'}, - $in{'soft'} ? ( $in{'soft'} ) : ( ), - $in{'hard'} ? ( $in{'hard'} ) : ( ) ); + $in{'soft'} ? ( $in{'soft'}*$in{'soft_units'} ) : ( ), + $in{'hard'} ? ( $in{'hard'}*$in{'hard_units'} ) : ( ) ); } &set_member_value($defs, 'log_on_success', split(/\0/, $in{'success'})); &set_member_value($defs, 'log_on_failure', split(/\0/, $in{'failure'}));