1 From: Tobias Geerinckx-Rice <me@tobias.gr>
2 Date: Fri, 01 Mar 2019 20:51:32 +0100
3 Subject: [PATCH] dkimproxy: Add IPv6 support.
5 The following patch was copied verbatim from Debian[0].
7 [0]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=656041
10 --- dkimproxy-1.4.1.orig/lib/MSDW/SMTP/Server.pm
11 +++ dkimproxy-1.4.1/lib/MSDW/SMTP/Server.pm
13 # Written by Bennett Todd <bet@rahul.net>
15 package MSDW::SMTP::Server;
17 +use IO::Socket::INET6;
22 =item new(interface => $interface, port => $port);
24 The interface and port to listen on must be specified. The interface
25 -must be a valid numeric IP address (0.0.0.0 to listen on all
26 -interfaces, as usual); the port must be numeric. If this call
27 -succeeds, it returns a server structure with an open
28 -IO::Socket::INET in it, ready to listen on. If it fails it dies, so
29 -if you want anything other than an exit with an explanatory error
30 -message, wrap the constructor call in an eval block and pull the
31 -error out of $@ as usual. This is also the case for all other
32 -methods; they succeed or they die.
33 +must be a valid numeric IPv4 or IPv6 address (0.0.0.0 or :: to listen
34 +on all interfaces, as usual); the port must be numeric. If this call
35 +succeeds, it returns a server structure with an open IO::Socket::INET6
36 +in it, ready to listen on. If it fails it dies, so if you want
37 +anything other than an exit with an explanatory error message, wrap
38 +the constructor call in an eval block and pull the error out of $@ as
39 +usual. This is also the case for all other methods; they succeed or
42 =item accept([debug => FD]);
45 my ($this, @opts) = @_;
46 my $class = ref($this) || $this;
47 my $self = bless { @opts }, $class;
48 - $self->{sock} = IO::Socket::INET->new(
49 + $self->{sock} = IO::Socket::INET6->new(
50 LocalAddr => $self->{interface},
51 LocalPort => $self->{port},
55 --- dkimproxy-1.4.1.orig/scripts/dkimproxy.out
56 +++ dkimproxy-1.4.1/scripts/dkimproxy.out
61 - # try to determine peer's address
63 - my $peersockaddr = getpeername(STDOUT);
64 - my ($port, $iaddr) = sockaddr_in($peersockaddr);
65 - $ENV{REMOTE_ADDR} = inet_ntoa($iaddr);
70 openlog("dkimproxy.out", "perror,pid,ndelay", "mail");
71 - syslog("debug", '%s', "connect from $ENV{REMOTE_ADDR}");
72 + syslog("debug", '%s', "connect from $self->{server}->{peeraddr}");