Package: pflogsumm
Version: 1.1.5-5
Tags: patch ipv6
If pflogsumm encounters a postscreen reject line with an IPv6 address,
it produces the following errors:
Use of uninitialized value $domain in string eq at /usr/sbin/pflogsumm
line 1546, <> line 1.
Use of uninitialized value $rejData in hash element at
/usr/sbin/pflogsumm line 1720, <> line 1.
Use of uninitialized value $norm1 in pattern match (m//) at
/usr/sbin/pflogsumm line 1429, <> line 1.
Use of uninitialized value $norm1 in split at /usr/sbin/pflogsumm line
1434, <> line 1.
Example log line:
Apr 3 07:10:43 server postfix/postscreen[5133]: NOQUEUE: reject: RCPT
from [1234:5678::1]:56922: 450 4.3.2 Service currently unavailable;
from=<[email protected]>, to=<[email protected]>, proto=ESMTP,
helo=<out.example.com>
Here is a way to reproduce the problem:
$ echo 'Apr 3 07:10:43 server postfix/postscreen[5133]: NOQUEUE:
reject: RCPT from [1234:5678::1]:56922: 450 4.3.2 Service currently
unavailable; from=<[email protected]>, to=<[email protected]>,
proto=ESMTP, helo=<out.example.com>' > testlog
$ /usr/sbin/pflogsumm testlog >/dev/null
The attached patch fixes these errors.
Cheers,
Juri
--- pflogsumm.orig 2020-04-03 12:16:50.100865258 +0200
+++ pflogsumm 2020-04-03 12:18:24.283805803 +0200
@@ -1539,7 +1539,7 @@
unless((($domain, $ipAddr) = /^([^\[]*)\[((?:\d{1,3}\.){3}\d{1,3})\]/) == 2||
(($domain, $ipAddr) = /^([^\/]*)\/([0-9a-f.:]+)/i) == 2) {
# more exhaustive method
- ($domain, $ipAddr) = /^([^\[\(\/]+)[\[\(\/]([^\]\)]+)[\]\)]?:?\s*$/;
+ ($domain, $ipAddr) = /^([^\[\(\/]*)[\[\(\/]([^\]\)]+)[\]\)]:?\d*$/;
}
# "mach.host.dom"/"mach.host.do.co" to "host.dom"/"host.do.co"