Files
webmin/pserver/pserver-lib.pl.bak
2007-04-12 20:24:50 +00:00

49 lines
1.0 KiB
Perl

# pserver-lib.pl
do '../web-lib.pl';
&init_config();
$cvs_path = &has_command($config{'cvs'});
$cvs_port = 2401;
$cvs_inet_name = "cvspserver";
$has_xinetd = &foreign_check("xinetd");
$has_inetd = &foreign_check("inetd");
# check_inetd()
# Find out if cvs is being run from inetd or xinetd
sub check_inetd
{
if ($has_xinetd) {
&foreign_require("xinetd", "xinetd-lib.pl");
local @xic = &xinetd::get_xinetd_config();
foreach $x (@xic) {
# XXX not done yet
}
}
if ($has_inetd) {
local (%portmap, $s, $a, $i);
&foreign_require("inetd", "inetd-lib.pl");
foreach $s (&inetd::list_services()) {
$portmap{$s->[1]} = $s;
foreach $a (split(/\s+/, $s->[4])) {
$portmap{$a} = $s;
}
}
foreach $i (&inetd::list_inets()) {
if (($i->[8] eq $cvs_path || $i->[8] eq $config{'cvs'}) &&
$portmap{$i->[3]}->[2] == $cvs_port) {
# Found the entry
return { 'type' => 'inetd',
'command' => $i->[8],
'args' => $i->[9],
'active' => $i->[7],
'inetd' => $i };
}
}
}
return undef;
}
1;