[pmg-devel] [PATCH pmg-api] fix #1653: parse ipv6 xfowrard correclty

Dominik Csapak d.csapak at proxmox.com
Tue Jan 21 16:55:55 CET 2020


postfix prepends an ipv6 address in the xforward message with 'IPv6:'
we did not remove it and our later checks in who objects fail silently.

we now check if the addr is prefixed with this and remove it to
allow the who objects to work.

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 src/PMG/SMTP.pm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/PMG/SMTP.pm b/src/PMG/SMTP.pm
index 544d0a5..ef78f1e 100644
--- a/src/PMG/SMTP.pm
+++ b/src/PMG/SMTP.pm
@@ -85,7 +85,12 @@ sub loop {
 	    my @tmp = split (/\s+/, $args);
 	    foreach my $attr (@tmp) {
 		my ($n, $v) = ($attr =~ /^(.*?)=(.*)$/);
-		$self->{xforward}->{lc($n)} = $v;
+		my $name = lc($n);
+		# Postfix prefixes ipv6 adresses with 'IPv6:'
+		if ($name eq 'addr' && $v =~ /^IPv6:(.*)$/i) {
+		    $v = $1;
+		}
+		$self->{xforward}->{$name} = $v;
 	    }
 	    $self->reply ("250 2.5.0 OK");
 	    next;
-- 
2.20.1




More information about the pmg-devel mailing list