3 # Setup the CVS server in inetd or xinetd
5 require './pserver-lib.pl';
6 $inet = &check_inetd();
7 $restart = $inet->{'type'} if ($inet);
9 # Need to setup for the first time
11 # Just add an unlisted service
15 # Is there already a service on port 2401, or named cvspserver?
16 foreach $s (&inetd::list_services()) {
17 local @al = split(/\s+/, $s->[4]);
18 if ($s->[2] == $cvs_port ||
19 $s->[1] eq $cvs_inet_name ||
20 &indexof($cvs_inet_name, @al) >= 0) {
27 $sname = $cvs_inet_name;
28 &inetd::create_service($sname, $cvs_port, "tcp", undef);
30 &inetd::create_inet(1, $sname, "stream", "tcp", "nowait",
31 "root", $cvs_path, "cvs -f --allow-root '$config{'cvsroot'}' pserver");
37 elsif ($inet->{'active'}) {
39 if ($inet->{'type'} eq 'inetd') {
40 local @i = @{$inet->{'inetd'}};
41 &inetd::modify_inet($i[0], 0, $i[3], $i[4], $i[5],
42 $i[6], $i[7], $i[8], $i[9], $i[10]);
49 if ($inet->{'type'} eq 'inetd') {
50 local @i = @{$inet->{'inetd'}};
51 &inetd::modify_inet($i[0], 1, $i[3], $i[4], $i[5],
52 $i[6], $i[7], $i[8], $i[9], $i[10]);
58 # Restart inetd or xinetd
59 if ($restart eq "inetd") {
60 %iconfig = &foreign_config("inetd");
62 "$iconfig{'restart_command'} >/dev/null 2>&1 </dev/null");
65 %xconfig = &foreign_config("xinetd");
66 if (open(PID, $xconfig{'pid_file'})) {