while ($c[0] =~ /^-[vh]$/) { shift @c; }
$ru = $query->remote_user;
($rh = $query->remote_host) =~ s/[^A-Za-z0-9. \240-\376-]/?/g;
- # This might look insecure, but we know all the names have been correctly
+
+ # "@c" might look insecure, but we know all the names have been correctly
# validated by the first sleuth run.
- `( echo "Domain: $domain" ;
- echo "Server: $server [$serverip]" ;
- echo "User: $ru" ;
- echo "From: $submitter ($rh)" ;
- echo ;
- ./sleuth @c
- ) | mail -s \"New zone\" $secondaries_to`;
- $? && print "<P><EM>Forwarding failed (rc=$?)</EM>\n";
+ &{sub {
+ local *HMSLEUTH;
+ open(HMSLEUTH,"./sleuth -m @c|") or return;
+ my $hostmaster = ""; # default
+ /^\. Hostmaster e-mail address is (.*)$/m and $hostmaster=$1 while <HMSLEUTH>;
+ close HMSLEUTH;
+
+ local *MAILCMD;
+ open(MAILCMD,"|(cat;./sleuth @c)|/usr/sbin/sendmail -oi -oee -t") or return;
+ print MAILCMD (!$hostmaster ? "" : "Reply-To: \"Hostmaster for $domain\" <$hostmaster>\n"),
+ <<"EOF";
+Subject: New zone
+To: $secondaries_to
+
+Domain: $domain
+Server: $server [$serverip]
+Hostmaster: $hostmaster
+User: $ru
+From: $submitter ($rh)
+
+EOF
+ close MAILCMD;
+ 1;
+ }} or print "<P><EM>Forwarding failed (rc=$?)</EM>\n";
}
}
print "<hr>\n";