Two more bugs: Typical returns from getSendersMta() here are:
for a v4 address: "dns; mmjgroup.beckerhairclinic.com (mmjgroup.beckerhairclinic.com [::ffff:66.23.216.62])" for a v6 address: "dns; mitra.fmp.com ([::1])" On Wed, 2015-03-18 at 10:53 -0500, Lindsay Haisley wrote: > courier.config.explodeIP6(sender)[:14] This won't work to pull the v6 /48 into the _senders dict for the same reasons the v4 code won't work, as noted in my last post and assuming we're fed the above or similar strings by getCourierMta(). You'll need courier.config.explodeIP6(sender)[sender.rindex("["):][:16], which will generate a sender ID unique to the /48 network. Second, if limitNetwork: if '.' in sender: # For IPv4, use the first three octets ....... will always identify a v4 address, even if sender contains a v6 address since the "if '.' in sender" will alway be True if the reverse resolution or other DN info containing a "." is included in the sender string, as it is here. If this happens, sender[sender.rindex("["):sender.rindex('.')] will return an empty string, which may be an adequate indicator that the code tried to parse a v6 address as v4. Something like this would work: # Parse a v4 address ID from sender senderID = sender[sender.rindex("["):sender.rindex('.')] if not senderID: [parse a v6 address] The inclusion of the reverse resolution fqdn, and what I assume may be the HELO address in the v4 string, may be under the control of configuration options for courieresmtpd, but they're a Fact of Life here and ratelimit.py will need to deal with them intelligently. If the full value returned from getSendersMta() does _not_ always contain the reverse resolution under variant courier configurations, then the situation is more complicated, since "sender[sender.rindex("["):sender.rindex('.')]" will throw a ValueError exception if it's fed a v6 address sans the DN data. -- Lindsay Haisley | "UNIX is user-friendly, it just FMP Computer Services | chooses its friends." 512-259-1190 | -- Andreas Bogk http://www.fmp.com | ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ courier-users mailing list courier-users@lists.sourceforge.net Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users