Endless loop in plugin sender_permitted_from on IPv6 clients
[email protected] (Michael Holzt) Wed, 14 Nov 2012 02:49:49 +0100
| Newsgroups | perl.qpsmtpd |
|---|---|
| Message-ID | <[email protected]> |
The sender_permitted_from plugin will hang in an endless loop for IPv6 clients. This is because of faulty code which only knows how to handle IPv4 addresses. The attached patch fixes this problem. Regards, Michael -- It's an insane world, but i'm proud to be a part of it. -- Bill Hicks
spf.fix
(text/plain, 754 B)
diff -Naur qpsmtpd-0.84.upstream/plugins/sender_permitted_from qpsmtpd-0.84.fixed/plugins/sender_permitted_from
--- qpsmtpd-0.84.upstream/plugins/sender_permitted_from 2009-04-03 07:48:34.000000000 +0200
+++ qpsmtpd-0.84.fixed/plugins/sender_permitted_from 2012-11-14 02:48:06.000000000 +0100
@@ -50,7 +50,12 @@
while ($client_ip) {
return (DECLINED) if exists $relay_clients{$client_ip};
return (DECLINED) if exists $more_relay_clients->{$client_ip};
- $client_ip =~ s/\d+\.?$//; # strip off another 8 bits
+ if ( $client_ip =~ /:/ ) {
+ $client_ip =~s /[0-9a-f]+:*$//; # strip off another segment
+ }
+ else {
+ $client_ip =~ s/\d+\.?$//; # strip off another 8 bits
+ }
}
my $host = lc $sender->host;