3 # Display Unix networking options
5 require './samba-lib.pl';
9 &error_setup("<blink><font color=red>$text{'eacl_aviol'}</font></blink>");
10 &error("$text{'eacl_np'} $text{'eacl_pcn'}") unless $access{'conf_net'};
12 &ui_print_header(undef, $text{'net_title'}, "");
16 print "<form action=save_net.cgi>\n";
17 print "<table border width=100%>\n";
18 print "<tr $tb> <td><b>$text{'net_title'}</b></td> </tr>\n";
19 print "<tr $cb> <td><table width=100%>\n";
20 print "<tr> <td><b>$text{'net_idle'}</b></td>\n";
21 printf "<td><input type=radio name=dead_time_def value=1 %s> $text{'config_never'}\n",
22 &getval("deadtime") eq "" ? "checked" : "";
23 printf "<input type=radio name=dead_time_def value=0 %s>\n",
24 &getval("deadtime") eq "" ? "" : "checked";
25 printf "<input name=dead_time size=5 value=\"%s\"> $text{'config_mins'}</td> </tr>\n",
28 print "<tr> <td><b>$text{'net_trustlist'}</b></td>\n";
29 printf "<td><input type=radio name=hosts_equiv_def value=1 %s> $text{'config_none'}\n",
30 &getval("hosts equiv") eq "" ? "checked" : "";
31 printf "<input type=radio name=hosts_equiv_def value=0 %s>",
32 &getval("hosts equiv") eq "" ? "" : "checked";
33 printf "<input name=hosts_equiv size=20 value=\"%s\">\n",
34 &getval("hosts equiv");
35 print &file_chooser_button("hosts_equiv", 0);
36 print "</td> </tr>\n";
38 print "<tr> <td valign=top><b>$text{'net_netinterface'}</b></td>\n";
40 printf "<input type=radio name=interfaces_def value=1 %s> $text{'net_auto'} \n",
41 &getval("interfaces") ? "" : "checked";
42 printf "<input type=radio name=interfaces_def value=0 %s> $text{'net_uselist'}<br>\n",
43 &getval("interfaces") ? "checked" : "";
44 print "<table border>\n";
45 print "<tr> <td><b>$text{'net_interface'}</b></td> <td><b>$text{'net_netmask'}</b></td> </tr>\n";
46 @iflist = split(/\s+/, &getval("interfaces"));
47 $len = @iflist ? @iflist+1 : 2;
48 for($i=0; $i<$len; $i++) {
50 if ($iflist[$i] =~ /^([0-9\.]+)\/([0-9]+)$/) {
51 for($j=0; $j<$2; $j++) { $pw += 2**(31-$j); }
52 $n = sprintf "%u.%u.%u.%u",
53 ($pw>>24)&0xff, ($pw>>16)&0xff,
54 ($pw>>8)&0xff, ($pw)&0xff;
55 print "<td><input name=interface_ip$i value=$1 size=15></td>\n";
56 print "<td><input name=interface_nm$i value=$n size=15></td>\n";
58 elsif ($iflist[$i] =~ /^([0-9\.]+)\/([0-9\.]+)$/) {
59 print "<td><input name=interface_ip$i value=$1 size=15></td>\n";
60 print "<td><input name=interface_nm$i value=$2 size=15></td>\n";
62 elsif ($iflist[$i] =~ /^(\S+)$/) {
63 print "<td><input name=interface_ip$i value=$1 size=15></td>\n";
64 print "<td><input name=interface_nm$i size=15></td>\n";
67 print "<td><input name=interface_ip$i size=15></td>\n";
68 print "<td><input name=interface_nm$i size=15></td>\n";
72 print "</table></td> </tr>\n";
74 print "<tr> <td><b>$text{'net_keepalive'}</b></td>\n";
75 printf "<td><input type=radio name=keepalive_def value=1 %s> $text{'net_notsend'}\n",
76 &getval("keepalive") eq "" ? "checked" : "";
77 printf "<input type=radio name=keepalive_def value=0 %s>\n",
78 &getval("keepalive") eq "" ? "" : "checked";
79 print "$text{'net_every'}\n";
80 printf "<input name=keepalive size=5 value=\"%s\">$text{'config_secs'}</td> </tr>\n",
83 print "<tr> <td><b>$text{'net_maxpacket'}</b></td>\n";
84 printf "<td><input type=radio name=max_xmit_def value=1 %s> $text{'default'}\n",
85 &getval("max xmit") eq "" ? "checked" : "";
86 printf "<input type=radio name=max_xmit_def value=0 %s>\n",
87 &getval("max xmit") eq "" ? "" : "checked";
88 printf "<input name=max_xmit size=5 value=\"%s\"> $text{'config_bytes'}</td> </tr>\n",
91 print "<tr> <td><b>$text{'net_listen'}</b></td>\n";
92 printf "<td><input type=radio name=socket_address_def value=1 %s> $text{'config_all'}\n",
93 &getval("socket address") eq "" ? "checked" : "";
94 printf "<input type=radio name=socket_address_def value=0 %s>\n",
95 &getval("socket address") eq "" ? "" : "checked";
96 printf "<input name=socket_address size=15 value=\"%s\"></td> </tr>\n",
97 &getval("socket address");
99 print "<tr> <td valign=top><b>$text{'net_socket'}</b></td>\n";
100 print "<td><table>\n";
101 foreach (split(/\s+/, &getval("socket options"))) {
102 if (/^([A-Z\_]+)=(.*)/) { $sopts{$1} = $2; }
103 else { $sopts{$_} = ""; }
105 for($i=0; $i<@sock_opts; $i++) {
106 $sock_opts[$i] =~ /^([A-Z\_]+)(.*)$/;
107 if ($i%2 == 0) { print "<tr>\n"; }
108 printf "<td><input type=checkbox name=$1 value=1 %s> $1\n",
109 defined($sopts{$1}) ? "checked" : "";
111 printf "<input size=5 name=\"$1_val\" value=\"%s\">\n",
115 if ($i%2 == 1) { print "<tr>\n"; }
117 print "</table></td> </tr>\n";
119 print "</table></td></tr></table><p>\n";
120 print "<input type=submit value=$text{'save'}></form>\n";
122 &ui_print_footer("", $text{'index_sharelist'});