Handle hostnames with upper-case letters
[webmin.git] / spam / save_priv.cgi
1 #!/usr/local/bin/perl
2 # save_priv.cgi
3 # Save privileged options
4
5 require './spam-lib.pl';
6 &error_setup($text{'priv_err'});
7 &ReadParse();
8 &set_config_file_in(\%in);
9 &can_use_check("priv");
10 &execute_before("priv");
11 &lock_spam_files();
12 $conf = &get_config();
13
14 &parse_opt($conf, "auto_whitelist_path", \&check_path);
15 &parse_opt($conf, "auto_whitelist_file_mode", \&check_mode);
16 &parse_opt($conf, "dcc_options", \&check_args);
17 &parse_opt($conf, "timelog_path", \&check_path);
18 &parse_opt($conf, "razor_config", \&check_path);
19
20 &flush_file_lines();
21 &unlock_spam_files();
22 &execute_after("priv");
23 &webmin_log("priv");
24 &redirect($redirect_url);
25
26 sub check_path
27 {
28 $_[0] =~ /^(\/|\~)\S+$/ || &error(&text('priv_epath', $_[0]));
29 }
30
31 sub check_mode
32 {
33 $_[0] =~ /^[0-7]{4}$/ || &error(&text('priv_emode', $_[0]));
34 }
35
36 sub check_args
37 {
38 $_[0] =~ /^[A-Za-z \-]+$/ || &error(&text('priv_eargs', $_[0]));
39 }
40