Menu

#134 opendmarc-reports crashes when sending smtp wessages with a warning that a variable is not initalized

1.3.1
closed
None
2017-03-04
2015-07-07
Tom
No

The script "opendmarc-reports" does not handle SMTP errors correctly. The variable "$answer" is not always initialized.

In our setup, the local mail server was not able to send messages to some recipients due to restrictions (relaying not allowed). The error message was not logged as $answer was not initialized. I didn't invest the time to find out why $answer is empty, the patch though seems to work in our scenario. $smtp->message contains the smtp error message.

Patch:

--- opendmarc-1.3.1.orig/reports/opendmarc-reports 2015-02-23 21:32:25.000000000 +0100
+++ opendmarc-1.3.1/reports/opendmarc-reports 2015-07-07 10:02:21.565155898 +0200
@@ -935,6 +935,9 @@
{
# now perl voodoo:
$answer = ${${*$smtp}{'net_cmd_resp'}}[1];
+ if ( !( defined $answer ) ) {
+ $answer=$smtp->message();
+ }
chomp($answer);
print STDERR "$progname: $smtpstatus report for $domain to $repdest ($answer)\n";
}

1 Attachments

Discussion

  • A. Schulze

    A. Schulze - 2015-07-07

    simpler:
    $answer = ${${*$smtp}{'net_cmd_resp'}}[1] || $smtp->message() || 'unknown error';

     
  • Murray S. Kucherawy

    Simpler patch applied.

     
  • Murray S. Kucherawy

    • assigned_to: Murray S. Kucherawy
     
  • Murray S. Kucherawy

    • status: open --> closed
     
  • Murray S. Kucherawy

    v1.3.2 released.

     

Log in to post a comment.