Handle hostnames with upper-case letters
[webmin.git] / pserver / pserver-lib.pl.bak
1 # pserver-lib.pl
2
3 do '../web-lib.pl';
4 &init_config();
5
6 $cvs_path = &has_command($config{'cvs'});
7 $cvs_port = 2401;
8 $cvs_inet_name = "cvspserver";
9 $has_xinetd = &foreign_check("xinetd");
10 $has_inetd = &foreign_check("inetd");
11
12 # check_inetd()
13 # Find out if cvs is being run from inetd or xinetd
14 sub check_inetd
15 {
16 if ($has_xinetd) {
17         &foreign_require("xinetd", "xinetd-lib.pl");
18         local @xic = &xinetd::get_xinetd_config();
19         foreach $x (@xic) {
20                 # XXX not done yet
21                 }
22         }
23 if ($has_inetd) {
24         local (%portmap, $s, $a, $i);
25         &foreign_require("inetd", "inetd-lib.pl");
26         foreach $s (&inetd::list_services()) {
27                 $portmap{$s->[1]} = $s;
28                 foreach $a (split(/\s+/, $s->[4])) {
29                         $portmap{$a} = $s;
30                         }
31                 }
32         foreach $i (&inetd::list_inets()) {
33                 if (($i->[8] eq $cvs_path || $i->[8] eq $config{'cvs'}) &&
34                     $portmap{$i->[3]}->[2] == $cvs_port) {
35                         # Found the entry
36                         return { 'type' => 'inetd',
37                                  'command' => $i->[8],
38                                  'args' => $i->[9],
39                                  'active' => $i->[7],
40                                  'inetd' => $i };
41                         }
42                 }
43         }
44 return undef;
45 }
46
47 1;
48