Handle hostnames with upper-case letters
[webmin.git] / sendmail / save_cws.cgi
1 #!/usr/local/bin/perl
2 # save_cws.cgi
3 # Save sendmail.cw list
4
5 require './sendmail-lib.pl';
6 &ReadParseMime();
7 $access{'cws'} || &error($text{'cws_ecannot'});
8 &error_setup($text{'cws_err'});
9
10 &lock_file($config{'sendmail_cf'});
11 $conf = &get_sendmailcf();
12 &get_file_or_config($conf, "w", undef, \$cwfile);
13 &lock_file($cwfile) if ($cwfile);
14 @dlist = split(/\s+/, $in{'dlist'});
15 foreach $d (@dlist) {
16         $d =~ /^[A-z0-9\-\.]+$/ ||
17                 &error(&text('cws_ehost', $d));
18         }
19 @dlist = &unique(@dlist);
20
21 &save_file_or_config($conf, "w", \@dlist);
22 &flush_file_lines();
23 &unlock_file($cwfile) if ($cwfile);
24 &unlock_file($config{'sendmail_cf'});
25 &restart_sendmail();
26
27 &webmin_log("cws");
28 &redirect("");
29