[pmg-devel] [PATCH pmg-api] fix #1653: parse ipv6 xfowrard correclty
Stoiko Ivanov
s.ivanov at proxmox.com
Wed Jan 22 12:10:59 CET 2020
gave it a quick test (with forwarding to a second host) and ran into the
following logline and error:
```
Jan 22 12:05:54 pmg6 pmg-smtp-filter[28128]: xforward error - got: 501 5.5.4 Bad ADDR syntax: XXXXXX
```
(error comes from PMG::Utils::reinject_mail, where we use the collected
values to pass the xforward information to the outbound postfix)
as talked off-list - probably strip the 'IPV6:' while comparing.
Thanks!
On Tue, 21 Jan 2020 16:55:55 +0100
Dominik Csapak <d.csapak at proxmox.com> wrote:
> 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;
More information about the pmg-devel
mailing list