Handle hostnames with upper-case letters
[webmin.git] / samba / save_bind.cgi
1 #!/usr/local/bin/perl
2 # save_bind.cgi
3 # Save inputs from conf_bind.cgi
4
5 require './samba-lib.pl';
6 &ReadParse();
7 &lock_file($config{'smb_conf'});
8 $global = &get_share("global");
9
10 # check acls
11
12 &error_setup("<blink><font color=red>$text{'eacl_aviol'}</font></blink>");
13 &error("$text{'eacl_np'} $text{'eacl_pcm'}") unless $access{'conf_bind'};
14  
15 &error_setup($text{'bind_err'});
16 &setval("winbind enable local accounts", $in{'local'} ? "yes" : "no");
17
18 &setval("winbind trusted domains only", $in{'trust'} ? "yes" : "no");
19
20 &setval("winbind enum users", $in{'users'} ? "yes" : "no");
21
22 &setval("winbind enum groups", $in{'groups'} ? "yes" : "no");
23
24 &setval("winbind use default domain", $in{'defaultdomain'} ? "yes" : "no");
25
26 $in{'realm'} eq "" || $in{'realm'} =~ /^\S+$/ || &error($text{'bind_erealm'});
27 &setval("realm", $in{'realm'});
28
29 $in{'cache'} =~ /^\d+$/ || &error($text{'bind_ecache'});
30 &setval("winbind cache time", $in{'cache'});
31
32 $in{'uid'} eq "" || $in{'uid'} =~ /^\d+\-\d+$/ || &error($text{'bind_euid'});
33 &setval("idmap uid", $in{'uid'});
34
35 $in{'gid'} eq "" || $in{'gid'} =~ /^\d+\-\d+$/ || &error($text{'bind_egid'});
36 &setval("idmap gid", $in{'gid'});
37
38 &setval("idmap backend", $in{'backend_def'} ? "" : $in{'backend'});
39
40 if ($global) { &modify_share("global", "global"); }
41 else { &create_share("global"); }
42 &unlock_file($config{'smb_conf'});
43 &webmin_log("bind", undef, undef, \%in);
44 &redirect("");
45