oetiker / znapzend

zfs backup with remote capabilities and mbuffer integration.
www.znapzend.org
GNU General Public License v3.0
609 stars 137 forks source link

znapzend not sending ERROR email #547

Open gchmurka123 opened 3 years ago

gchmurka123 commented 3 years ago

There is an error in using sendmail (after the -t option it is wrong to use the recipient's address )

using: exim4-daemon-light 4.90.1-1ubuntu1.8

my patch to fix this issue:

--- lib/ZnapZend.pm.org 2021-05-17 13:37:00.313340036 +0200
+++ lib/ZnapZend.pm     2021-05-17 13:36:15.636878130 +0200
@@ -783,7 +783,7 @@ my $sendRecvCleanup = sub {
             #my $mailprog = '/usr/lib/sendmail';
             my $mailprog = '/usr/sbin/sendmail';
             #my $from_address = "`id`@`hostname`" ;
-            if (open (MAIL, "|$mailprog -t " . $self->mailErrorSummaryTo)) {
+            if (open (MAIL, "|$mailprog -t")) {
                 $self->zLog->warn('Sending a copy of the report above to ' . $self->mailErrorSummaryTo);
                 print MAIL "To: " . $self->mailErrorSummaryTo . "\n";
                 #print MAIL "From: " . $from_address . "\n";
oetiker commented 3 years ago

you are correct ... it makes little sense to have the recipient on the commandline AND request for it to be extracted from the headers ... postfix < 2.1 also considers this an error ...

can you please make the change as a PR ?

rokkoyama commented 3 years ago

Oetiker: Would you be willing to merge the fix/540 branch? It is behind master with respect to this issue, and contains similar corrective action as described in the patch above to remove the recipient argument from the command in ZnapZend.pm due to the conflict with the -t flag that parses the recipient from the headers below. However, it also cleans up the variables.

The issue is reproducible in Exim version 4.92 on Deb 10 - Linux 4.19.0-17-amd64 #1 SMP Debian 4.19.194-1 (2021-06-10).

Applying the patch above resolves the issue.

I have not tested the innocuous variable related changes in fix/540 but am happy to do so if you would like.

oetiker commented 3 years ago

totally ... sorry that somehow slipped through the cracks