Menu

#145 Use of uninitialized value $key in concatenation (.) or string at /usr/local/sbin/opendmarc-import

1.3.1
open
nobody
None
2015-12-03
2015-12-03
Tom
No

Opendmarc generates sometimes empty lines in the history file. The import tool does not handle this gracefully. I have the impression that the code that prints "pdomain" does sometimes insert an empty line.
The result is that during the import process, $key is uninitialized. The import process generates the following error:
Use of uninitialized value $key in concatenation (.) or string at /usr/local/sbin/opendmarc-import line 585, <stdin> line 606.
opendmarc-import: unknown key '' at line 606 </stdin>

Sample history file: The line 606 corresponds to the empty line.

action 2
job AF61B6A045
reporter *
received 1449066832
ipaddr
*
from
*
mfrom *
spf 1
pdomain
***

policy 18
rua mailto:*****
pct 100
adkim 114
aspf 114
p 110
sp 110
align_dkim 5

A fix would eliminate the empty line during import. The switch statement and the print in the opendmarc-import script should also be fixed.
Code that jumps that prevents raising an error:

          case "spf"            {
                                        $spf = $value;
                                }

          else                  {
                                        if ( $key ) {
                                          print STDERR "$progname: unknown key '$key' at line $lineno\n";
                                        }
                                }
        }

Alternative code that would log correctly:

          case "spf"            {
                                        $spf = $value;
                                }

          else                  {
                                        if ( $key ) {
                                             print STDERR "$progname: unknown key '$key' at line $lineno\n";
                                        }
                                        else {
                                            print STDERR "$progname: unknown key at line $lineno\n";
                                        }
                                }
        }

Discussion


Log in to post a comment.

MongoDB Logo MongoDB