Secondary request has now Reply-To set to the zone hostmaster
authorshort <>
Fri, 28 Dec 2001 20:52:03 +0000 (20:52 +0000)
committershort <>
Fri, 28 Dec 2001 20:52:03 +0000 (20:52 +0000)
 - requested by Pavel Ruzicka <pavel.ruzicka@gtsgroup.cz>
 - "/usr/sbin/sendmail" is now used instead of mail(1)

check.cgi

index 1ab4eff..5f70939 100755 (executable)
--- a/check.cgi
+++ b/check.cgi
@@ -158,16 +158,33 @@ EOF
                        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";