3 # Save domain masquerading
5 require './sendmail-lib.pl';
7 $access{'masq'} || &error($text{'masq_ecannot'});
8 &error_setup($text{'masq_err'});
9 &lock_file($config{'sendmail_cf'});
10 $conf = &get_sendmailcf();
11 $in{'masq'} =~ /^[A-z0-9\-\.]*$/ ||
12 &error(&text('masq_edomain', $in{'masq'}));
13 @mlist = split(/\s+/, $in{'mlist'});
15 $m =~ /^[A-z0-9\-\.]+$/ ||
16 &error(&text('masq_ehost', $m));
17 &check_ipaddress($m) &&
18 &error(&text('masq_eip', $m));
20 @mlist = &unique(@mlist);
21 @nlist = split(/\s+/, $in{'nlist'});
23 $n =~ /^[A-z0-9\-\.]+$/ ||
24 &error(&text('masq_ehost', $n));
25 &check_ipaddress($n) &&
26 &error(&text('masq_eip', $n));
28 @nlist = &unique(@nlist);
30 # Update the DM directive (if there is one)
31 foreach $d (&find_type("D", $conf)) {
32 if ($d->{'value'} =~ /^M/) { push(@dmconf, $d); }
34 &save_directives($conf, \@dmconf,
35 [ { 'type' => 'D', 'values' => [ "M$in{'masq'}" ] } ]);
37 # Update domains to masquerade, and not to
38 &save_file_or_config($conf, "M", \@mlist);
39 &save_file_or_config($conf, "N", \@nlist);
41 &unlock_file($config{'sendmail_cf'});