📄 save_masq.cgi
字号:
#!/usr/local/bin/perl# save_masq.cgi# Save domain masqueradingrequire './sendmail-lib.pl';&ReadParse();$access{'masq'} || &error($text{'masq_ecannot'});&error_setup($text{'masq_err'});$conf = &get_sendmailcf();$in{'masq'} =~ /^[A-z0-9\-\.]*$/ || &error(&text('masq_edomain', $in{'masq'}));@mlist = split(/\s+/, $in{'mlist'});foreach $m (@mlist) { $m =~ /^[A-z0-9\-\.]+$/ || &error(&text('masq_ehost', $m)); &check_ipaddress($m) && &error(&text('masq_eip', $m)); }@mlist = &unique(@mlist);# Update the DM directive (if there is one)foreach $d (&find_type("D", $conf)) { if ($d->{'value'} =~ /^M/) { push(@dmconf, $d); } }&save_directives($conf, \@dmconf, [ { 'type' => 'D', 'values' => [ "M$in{'masq'}" ] } ]);# Get old CM directives@old = grep { $_->{'value'} =~ /^M/ } &find_type("C", $conf);if ($in{'cmfile'}) { # If there is a cm file, write all domains to it and take any # out of sendmail.cf open(CM, "> $in{'cmfile'}"); foreach $m (@mlist) { print CM $m,"\n"; } close(CM); }else { # Put all domains in sendmail.cf foreach $m (@mlist) { push(@new, { 'type' => 'C', 'values' => [ "M$m" ] }); } }&save_directives($conf, \@old, \@new);&flush_file_lines();&restart_sendmail();&redirect("");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -