Handle hostnames with upper-case letters
[webmin.git] / rbac / save_policy.cgi
1 #!/usr/local/bin/perl
2 # Save global policy settings
3
4 require './rbac-lib.pl';
5 $access{'policy'} || &error($text{'policy_ecannot'});
6 &error_setup($text{'policy_err'});
7 &lock_rbac_files();
8 $conf = &get_policy_config();
9 &ReadParse();
10
11 # Validate and save inputs
12 $auths = &auths_parse("auths");
13 &save_policy($conf, "AUTHS_GRANTED", $auths);
14 $profs = &profiles_parse("profs");
15 &save_policy($conf, "PROFS_GRANTED", $profs);
16
17 if ($in{'allow_def'}) {
18         &save_policy($conf, "CRYPT_ALGORITHMS_ALLOW", undef);
19         }
20 else {
21         $allow = join(",", split(/\0/, $in{'allow'}));
22         $allow || &error($text{'policy_eallow'});
23         $in{'deprecate_def'} || &error($text{'policy_eclash'});
24         &save_policy($conf, "CRYPT_ALGORITHMS_ALLOW", $allow);
25         }
26
27 if ($in{'default_def'}) {
28         &save_policy($conf, "CRYPT_DEFAULT", undef);
29         }
30 else {
31         &save_policy($conf, "CRYPT_DEFAULT", $in{'default'});
32         }
33
34 if ($in{'deprecate_def'}) {
35         &save_policy($conf, "CRYPT_ALGORITHMS_DEPRECATE", undef);
36         }
37 else {
38         &save_policy($conf, "CRYPT_ALGORITHMS_DEPRECATE", $in{'deprecate'});
39         }
40
41 &flush_file_lines();
42 &unlock_rbac_files();
43 &webmin_log("policy");
44 &redirect("");
45