3 # Display Windows 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_pcs'}") unless $access{'conf_smb'};
12 &ui_print_header(undef, $text{'smb_title'}, "");
16 print "<form action=save_smb.cgi>\n";
17 print "<table border width=100%>\n";
18 print "<tr $tb> <td><b>$text{'smb_title'}</b></td> </tr>\n";
19 print "<tr $cb> <td><table width=100%>\n";
22 print "<tr> <td><b>$text{'smb_workgroup'}</b></td>\n";
23 print "<td colspan=3>\n";
24 printf "<input type=radio name=workgroup_def value=1 %s> $text{'default'}\n",
25 &getval("workgroup") eq "" ? "checked" : "";
26 printf "$gap <input type=radio name=workgroup_def value=0 %s>\n",
27 &getval("workgroup") eq "" ? "" : "checked";
28 printf "<input name=workgroup size=15 value=\"%s\"></td> </tr>\n",
31 print "<tr> <td><b>$text{'smb_wins'}</b></td>\n";
32 print "<td colspan=3>\n";
33 printf "<input type=radio name=wins value=0 %s> $text{'smb_winsserver'}\n",
34 &isfalse("wins support") ? "" : "checked";
35 printf "$gap <input type=radio name=wins value=1 %s> $text{'smb_useserver'}\n",
36 &getval("wins server") eq "" ? "" : "checked";
37 printf "<input name=wins_server size=10 value=\"%s\">\n",
38 &getval("wins server");
39 printf "$gap <input type=radio name=wins value=2 %s> $text{'config_neither'}\n",
40 &isfalse("wins support") && &getval("wins server") eq "" ? "checked" : "";
41 print "</td> </tr>\n";
43 $desc = &getval("server string");
44 print "<tr> <td><b>$text{'smb_description'}</b></td>\n";
45 print "<td colspan=3>\n";
46 print &ui_radio("server_string_def", !defined($desc) ? 1 :
48 [ [ 1, $text{'default'} ],
49 [ 2, $text{'smb_descriptionnone'} ],
50 [ 0, &ui_textbox("server_string", $desc, 40) ] ]);
51 print "</td> </tr>\n";
53 print "<tr> <td><b>$text{'smb_name'}</b></td>\n";
54 printf "<td><input name=netbios_name size=15 value=\"%s\"></td>\n",
55 &getval("netbios name");
57 print "<td><b>$text{'smb_aliase'}</b></td>\n";
58 printf "<td><input name=netbios_aliases size=30 value=\"%s\"></td> </tr>\n",
59 &getval("netbios aliases");
61 print "<tr> <td><b>$text{'smb_default'}</b></td>\n";
62 print "<td><select name=default>\n";
63 printf "<option value=\"\" %s> $text{'config_none'}\n", &getval("default") eq "";
64 foreach $s (&list_shares()) {
65 next unless &can('r', \%access, $s) || !$access{'hide'};
66 printf "<option value=\"$s\" %s> $s\n",
67 &getval("default") eq $s ? "selected" : "";
69 print "</select></td>\n";
71 print "<td><b>$text{'smb_show'}</b></td>\n";
72 print "<td rowspan=2><select name=auto_services multiple size=3>\n";
73 foreach $s (split(/s\+/, &getval("auto services"))) { $autos{$s}++; }
74 foreach $s (&list_shares()) {
75 next unless &can('r', \%access, $s) || !$access{'hide'};
76 printf "<option value=\"$s\" %s> $s\n",
77 $autos{$s} ? "checked" : "";
79 print "</select></td> </tr>\n";
81 print "<tr> <td><b>$text{'smb_disksize'}</b></td>\n";
82 print "<td colspan=2>\n";
83 printf "<input type=radio name=max_disk_size_def value=1 %s> $text{'smb_unlimited'}\n",
84 &getval("max disk size") eq "" ? "checked" : "";
85 printf "$gap <input type=radio name=max_disk_size_def value=0 %s>\n",
86 &getval("max disk size") eq "" ? "" : "checked";
87 printf "<input name=max_disk_size size=5 value=\"%s\"> kB</td>\n",
88 &getval("max disk size");
90 print "<tr> <td><b>$text{'smb_winpopup'}</b></td>\n";
91 printf "<td><input name=message_command size=15 value=\"%s\"></td>\n",
92 &getval("message command");
94 print "<td><b>$text{'smb_priority'}</b></td>\n";
95 printf "<td><input name=os_level size=5 value=\"%d\"></td> </tr>\n",
98 print "<tr> <td><b>$text{'smb_protocol'}</b></td>\n";
99 print "<td><select name=protocol>\n";
100 printf "<option value=\"\" %s> $text{'default'}\n",
101 &getval("protocol") eq "" ? "selected" : "";
102 foreach $p (@protocols) {
103 printf "<option value=\"$p\" %s> $p\n",
104 &getval("protocol") eq $p ? "selected" : "";
106 print "</select></td>\n";
108 print "<td><b>$text{'smb_master'}</b></td>\n";
110 printf "<input type=radio name=preferred_master value=yes %s> $text{'yes'}\n",
111 &istrue("preferred master") ? "checked" : "";
112 printf "$gap <input type=radio name=preferred_master value=no %s> $text{'no'}\n",
113 &isfalse("preferred master") ? "checked" : "";
114 printf "<input type=radio name=preferred_master value=auto %s> $text{'smb_master_auto'}\n",
115 &getval("preferred master") =~ /auto/ ||
116 !&getval("preferred master") ? "checked" : "";
117 print "</td> </tr>\n";
119 print "<tr> <td><b>$text{'smb_security'}</b></td>\n";
120 print "<td><select name=security>\n";
121 printf "<option value='' %s> $text{'default'}\n",
122 &getval("security") ? "" : "selected";
123 printf "<option value=share %s> $text{'smb_sharelevel'}\n",
124 &getval("security") =~ /^share$/i ? "selected" : "";
125 printf "<option value=user %s> $text{'smb_userlevel'}\n",
126 &getval("security") =~ /^user$/i ? "selected" : "";
127 printf "<option value=server %s> $text{'smb_passwdserver'}\n",
128 &getval("security") =~ /^server$/i ? "selected" : "";
129 printf "<option value=domain %s> $text{'smb_domain'}\n",
130 &getval("security") =~ /^domain$/i ? "selected" : "";
131 printf "<option value=ads %s> $text{'smb_ads'}\n",
132 &getval("security") =~ /^ads$/i ? "selected" : "";
133 print "</select></td>\n";
135 print "<td><b>$text{'smb_passwdserver'}</b></td>\n";
136 printf "<td><input name=password_server size=10 value=\"%s\"></td> </tr>\n",
137 &getval("password server");
139 print "<tr> <td valign=top><b>$text{'smb_announce'}</b></td>\n";
140 print "<td colspan=3>\n";
141 printf "<input type=radio name=remote_def value=1 %s> $text{'smb_nowhere'}\n",
142 &getval("remote announce") ? "" : "checked";
143 printf "$gap <input type=radio name=remote_def value=0 %s> $text{'smb_fromlist'}<br>\n",
144 &getval("remote announce") ? "checked" : "";
145 print "<table border> <tr> <td><b>$text{'smb_ip'}</b></td> ",
146 "<td>$text{'smb_asworkgroup'}</td> </tr>\n";
147 @rem = split(/\s+/, &getval("remote announce")); $len = @rem ? @rem+1 : 2;
148 for($i=0; $i<$len; $i++) {
150 if ($rem[$i] =~ /^([\d\.]+)\/(.+)$/) { $ip = $1; $wg = $2; }
151 elsif ($rem[$i] =~ /^([\d\.]+)$/) { $ip = $1; $wg = ""; }
152 else { $ip = $wg = ""; }
153 print "<td><input name=remote_ip$i size=15 value=\"$ip\"></td>\n";
154 print "<td><input name=remote_wg$i size=15 value=\"$wg\"></td>\n";
157 print "</table></td> </tr>\n";
159 print "</table></td></tr></table><p>\n";
160 print "<input type=submit value=$text{'save'}></form>\n";
162 &ui_print_footer("", $text{'index_sharelist'});