3 # Display a form for editing a RPC service
5 require './inetd-lib.pl';
9 &ui_print_header(undef, $text{'editrpc_title1'}, "");
12 &ui_print_header(undef, $text{'editrpc_title2'}, "");
13 @rpc = @{(&list_rpcs())[$in{'rpos'}]};
14 if ($in{'ipos'} =~ /\d/) {
15 @inet = @{(&list_inets())[$in{'ipos'}]};
19 print "<form action=\"save_rpc.cgi\" method=post>\n";
21 print "<input type=hidden name=rpos value=$in{'rpos'}>\n";
22 print "<input type=hidden name=ipos value=$in{'ipos'}>\n";
24 print "<table border width=100%>\n";
25 print "<tr $tb> <td><b>$text{'editrpc_detail'}</b></td> </tr>\n";
26 print "<tr $cb> <td><table width=100%>\n";
28 print "<tr> <td nowrap><b>$text{'editrpc_prgname'}</b></td>\n";
29 print "<td><input size=10 name=name value=\"$rpc[1]\"></td>\n";
31 print "<td><b>$text{'editrpc_prgnum'}</b></td>\n";
32 print "<td><input size=7 name=number value=\"$rpc[2]\"></td> </tr>\n";
34 print "<tr> <td><b>$text{'editrpc_aliase'}</b></td> <td colspan=3>\n";
35 print "<input size=40 name=aliases value=\"$rpc[3]\"></td> </tr>\n";
37 print "</table></td></tr></table><p>\n";
39 if ($config{'rpc_inetd'}) {
40 print "<table border width=100%>\n";
41 print "<tr $tb> <td><b>$text{'editrpc_server'}</b></td> </tr>\n";
42 print "<tr $cb> <td><table width=100%>\n";
44 print "<tr> <td colspan=4>\n";
45 printf "<input type=radio name=act value=0 %s> $text{'editrpc_noassigned'}\n",
46 @inet ? "" : "checked";
47 printf "<input type=radio name=act value=1 %s> $text{'editrpc_disable'}\n",
48 @inet && !$inet[1] ? "checked" : "";
49 printf "<input type=radio name=act value=2 %s> $text{'editrpc_enable'}\n",
50 $inet[1] ? "checked" : "";
51 print "</td> </tr>\n";
53 print "<td><b>$text{'editrpc_version'}</b></td>\n";
54 if ($inet[3] =~ /^[^\/]+\/([0-9]+)\-([0-9]+)$/) {
55 $vfrom = $1; $vto = $2;
57 elsif ($inet[3] =~ /^[^\/]+\/([0-9]+)$/) {
58 $vfrom = $1; $vto = $1;
60 else { $vfrom = $vto = ""; }
61 print "<td><input size=1 name=vfrom value=\"$vfrom\"> -\n";
62 print "<input size=1 name=vto value=\"$vto\"></td>\n";
64 print "<td><b>$text{'editrpc_socket'}</b></td>\n";
65 print "<td><select name=type>\n";
66 printf "<option value=stream %s>Stream\n",
67 $inet[4] eq "stream" || !@inet ? "selected" : "";
68 printf "<option value=dgram %s>Datagram\n",
69 $inet[4] eq "dgram" ? "selected" : "";
70 printf "<option value=tli %s>TLI\n",
71 $inet[4] eq "tli" ? "selected" : "";
72 print "</select></td> </tr>\n";
74 print "<tr> <td><b>$text{'editrpc_protocol'}</b></td>\n";
75 $inet[5] =~ /^[^\/]+\/(.*)$/;
76 if ($1 eq "*") { @usedpr = split(/\s+/, $config{'rpc_protocols'}); }
77 else { @usedpr = split(/,/, $1); }
78 print "<td colspan=3>\n";
79 foreach $upr (split(/\s+/, $config{rpc_protocols})) {
80 printf "<input name=protocols type=checkbox value=\"$upr\" %s>".
81 " $upr\n", &indexof($upr,@usedpr)<0?"":"checked";
83 print "</td> </tr>\n";
85 $qm = ($inet[8] =~ s/^\?//);
86 print "<tr> <td nowrap><b>$text{'editrpc_server'}</b></td>\n";
87 if (!$config{'no_internal'}) {
88 printf "<td colspan=3><input type=radio name=internal value=1 %s> $text{'editrpc_internal'}\n",
89 $inet[8] eq "internal" ? "checked" : "";
90 printf "<input type=radio name=internal value=0 %s>\n",
91 $inet[8] ne "internal" || !@inet ? "checked" : "";
92 printf "<input name=program size=40 value=\"%s\">\n",
93 $inet[8] ne "internal" || !@inet ? $inet[8] : "";
95 printf "<td colspan=3>\n";
96 printf "<input name=program size=40 value=\"%s\">\n",
97 @inet ? $inet[8] : "";
99 print &file_chooser_button("program", 0);
100 if ($config{'qm_mode'}) {
101 print "<br>"," " x 5;
102 printf "<input type=checkbox name=qm value=1 %s> %s\n",
103 $qm ? "checked" : "", $text{'editserv_qm'};
105 print "</td> </tr>\n";
107 print "<tr> <td nowrap><b>$text{'editrpc_command'}</b></td> <td colspan=3>\n";
108 if (!$config{'no_internal'}) {
109 printf "<input name=args size=40 value=\"%s\"></td> </tr>\n",
110 $inet[8] eq "internal" ? "" : $inet[9];
112 printf "<input name=args size=40 value=\"%s\"></td> </tr>\n",
115 if ($inet[6] =~ /^(\S+)\.(\d+)$/) { $waitmode = $1; $permin = $2; }
116 else { $waitmode = $inet[6]; $permin = -1; }
117 if ($inet[7] =~ /^(\S+)\.(\S+)$/) { $user = $1; $group = $2; }
118 else { $user = $inet[7]; undef($group); }
120 print "<tr> <td nowrap><b>$text{'editrpc_waitmode'}</b></td>\n";
121 printf "<td nowrap><input type=radio name=wait value=wait %s> $text{'editrpc_wait'}\n",
122 $waitmode eq "wait" || !@inet ? "checked" : "";
123 printf "<input type=radio name=wait value=nowait %s> $text{'editrpc_nowait'}</td>\n",
124 $waitmode eq "nowait" ? "checked" : "";
126 print "<td nowrap><b>$text{'editrpc_execasuser'}</b></td>\n";
127 print "<td nowrap><input name=user size=8 value=\"$user\"> ",
128 &user_chooser_button("user", 0),"</td> </tr>\n";
130 if ($config{extended_inetd}) {
131 print "<tr> <td nowrap><b>$text{'editrpc_max'}</b></td> <td nowrap>\n";
132 printf "<input type=radio name=permin_def value=1 %s> $text{'editrpc_default'}\n",
133 $permin<0 ? "checked" : "";
134 printf " <input type=radio name=permin_def value=0 %s>\n",
135 $permin<0 ? "" : "checked";
136 printf "<input name=permin size=5 value=\"%s\"></td>\n",
137 $permin<0 ? "" : $permin;
139 print "<td nowrap><b>$text{'editrpc_execasgrp'}</b></td>\n";
140 print "<td nowrap><select name=group>\n";
141 printf "<option value=\"\" %s> $text{'editrpc_default'}",
142 $group ? "" : "selected";
144 while(@ginfo = getgrent()) {
145 printf "<option value=\"$ginfo[0]\" %s>$ginfo[0]\n",
146 $ginfo[0] eq $group ? "selected" : "";
148 print "</select></td> </tr>\n";
149 endgrent() if ($gconfig{'os_type'} ne 'hpux');
152 print "</table></td></tr></table><p>\n";
156 print "<table width=100%>\n";
157 print "<tr> <td><input type=submit value=$text{'index_save'}></td>\n";
158 print "</form><form action=\"delete_rpc.cgi\">\n";
159 print "<input type=hidden name=rpos value=\"$in{'rpos'}\">\n";
160 print "<input type=hidden name=ipos value=\"$in{'ipos'}\">\n";
161 print "<td align=right><input type=submit value=$text{'index_delete'}></td> </tr>\n";
162 print "</form></table><p>\n";
165 print "<input type=submit value=$text{'index_create'}></form><p>\n";
168 &ui_print_footer("", $text{'index_list'});