#!/usr/local/bin/perl # index.cgi # Display all xinetd services require './xinetd-lib.pl'; &ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1, 0, &help_search_link("xinetd", "man", "doc", "google")); # Check for config file if (!-r $config{'xinetd_conf'}) { print "

",&text('index_econf', "$config{'xinetd_conf'}", "$gconfig{'webprefix'}/config.cgi?$module_name"),"

\n"; &ui_print_footer("/", $text{'index'}); exit; } @conf = &get_xinetd_config(); ($defs) = grep { $_->{'name'} eq 'defaults' } @conf; foreach $m (@{$defs->{'members'}}) { $ddisable{$m->{'value'}}++ if ($m->{'name'} eq 'disabled'); } # Show table header print "

\n"; print &select_all_link("serv"),"\n"; print &select_invert_link("serv"),"\n"; print "$text{'index_add_inet'}
\n"; @tds = ( "width=5" ); print &ui_columns_start([ "", $text{'index_name'}, $text{'index_type'}, $text{'index_port'}, $text{'index_proto'}, $text{'index_user'}, $text{'index_server'}, $text{'index_enabled'} ], 100, 0, \@tds); # Show one row for each service foreach $x (@conf) { next if ($x->{'name'} ne 'service'); local $q = $x->{'quick'}; local @s; if ($q->{'type'}->[0] eq 'UNLISTED') { # Port and protocol specified @s = ( $x->{'name'}, undef, $q->{'port'}->[0], $q->{'protocol'}->[0] ); } elsif ($q->{'protocol'}) { # Protocol specified, find port from service if ($config{'lookup_servs'}) { @s = getservbyname($x->{'value'}, $q->{'protocol'}->[0]); } if (!@s) { @s = ( $x->{'name'}, undef, $q->{'port'}->[0], $q->{'protocol'}->[0] ); } } else { # Only service specified, check all protocols if ($config{'lookup_servs'}) { foreach $p (&list_protocols()) { @s = getservbyname($x->{'value'}, $p); last if (@s); } } } local @cols; local @mytds = @tds; push(@cols, "". &html_escape($x->{'value'}).""); push(@cols, &indexof('RPC', @{$q->{'type'}}) < 0 ? $text{'index_inet'} : $text{'index_rpc'}); if (@s) { push(@cols, &html_escape($s[2]) || "$text{'index_noport'}"); push(@cols, &html_escape(uc($s[3]))); } else { push(@cols, "$text{'index_noport'}"); push(@mytds, "", "", "colspan=2"); } push(@cols, $q->{'user'} ? &html_escape($q->{'user'}->[0]) : ""); push(@cols, &indexof('INTERNAL', @{$q->{'type'}}) >= 0 ? $text{'index_internal'} : $q->{'redirect'} ? &text('index_redirect', "".&html_escape($q->{'redirect'}->[0])."") : &html_escape($q->{'server'}->[0])); $id = $q->{'id'}->[0] || $x->{'value'}; push(@cols, $q->{'disable'}->[0] eq 'yes' || $ddisable{$id} ? "$text{'no'}" : $text{'yes'}); print &ui_checked_columns_row(\@cols, \@tds, "serv", $x->{'index'}); } print &ui_columns_end(); print &select_all_link("serv"),"\n"; print &select_invert_link("serv"),"\n"; print "$text{'index_add_inet'}

\n"; print "\n"; print "\n"; print "

\n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; if ($pid = &is_xinetd_running()) { print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } else { print "\n"; print "\n"; print "\n"; print "\n"; } print "
$text{'index_defaultsmsg'} \n"; print "
$text{'index_applymsg'} \n"; print "
$text{'index_startmsg'} \n"; print "
\n"; &ui_print_footer("/", $text{'index'});