Handle hostnames with upper-case letters
[webmin.git] / sendmail / save_ffile.cgi
1 #!/usr/local/bin/perl
2 # save_ffile.cgi
3 # Save a filter file
4
5 require (-r 'sendmail-lib.pl' ? './sendmail-lib.pl' :
6          -r 'qmail-lib.pl' ? './qmail-lib.pl' :
7                              './postfix-lib.pl');
8 &ReadParseMime();
9 &error_setup($text{'ffile_err'});
10 if (substr($in{'file'}, 0, length($access{'apath'})) ne $access{'apath'}) {
11         &error(&text('ffile_efile', $in{'file'}));
12         }
13
14 for($i=0; defined($in{"field_$i"}); $i++) {
15         next if (!$in{"field_$i"});
16         $in{"match_$i"} || &error($text{'ffile_ematch'});
17         $in{"action_$i"} || &error($text{'ffile_eaction'});
18         push(@filter, $in{"what_$i"}." ".$in{"action_$i"}." ".
19                       $in{"field_$i"}." ".$in{"match_$i"}."\n");
20         }
21 push(@filter, "2 ".$in{'other'}."\n") if ($in{'other'});
22
23 &open_lock_tempfile(FILE, ">$in{'file'}");
24 &print_tempfile(FILE, @filter);
25 &close_tempfile(FILE);
26 &redirect("edit_alias.cgi?num=$in{'num'}&name=$in{'name'}");
27