Handle hostnames with upper-case letters
[webmin.git] / samba / save_winbind.cgi
1 #!/usr/local/bin/perl
2 # save_winbind.cgi
3 # Bind to a domain
4
5 require './samba-lib.pl';
6
7 $access{'winbind'} || &error($text{'winbind_ecannot'});
8 &ReadParse();
9
10 # Validate inputs and create command
11 $cmd = "$config{'net'} join";
12 &error_setup($text{'winbind_err'});
13 $in{'user'} || &error($text{'winbind_euser'});
14 $cmd .= " -U ".quotemeta($in{'user'});
15 if (!$in{'dom_def'}) {
16         $in{'dom'} || &error($text{'winbind_edom'});
17         $cmd .= " -S ".quotemeta($in{'dom'});
18         }
19
20 # Run it
21 &ui_print_header(undef, $text{'winbind_title'}, undef);
22 print &text('winbind_cmd', "<tt>$cmd</tt>"),"\n";
23 $temp = &transname();
24 open(TEMP, ">$temp");
25 print TEMP $in{'pass'},"\n";
26 close(TEMP);
27 $out = `$cmd 2>&1 <$temp`;
28 unlink($temp);
29 print "<pre>$out</pre>";
30 if ($? || $out =~ /error|failed/i) {
31         print "$text{'winbind_failed'}<br>\n";
32         }
33 else {
34         print "$text{'winbind_ok'}<br>\n";
35         }
36
37 &ui_print_footer("", $text{'index_sharelist'});
38