pymilter
0.9.6
|
Public Member Functions | |
def | __init__ |
def | dns |
Cached DNS lookup. More... | |
def | dns_txt |
Public Attributes | |
cache | |
Static Public Attributes | |
tuple | SAFE2CACHE |
Additional DNS RRs we can safely cache. More... | |
A Session object has a simple cache with no TTL that is valid for a single "session", for example an SMTP conversation.
def Milter.dns.Session.dns | ( | self, | |
name, | |||
qtype, | |||
cnames = None |
|||
) |
Cached DNS lookup.
name | the DNS label to query |
qtype | the query type, e.g. 'A' |
cnames | tracks CNAMES already followed in recursive calls DNS query. If the result is in cache, return that. Otherwise pull the result from DNS, and cache ALL answers, so additional info is available for further queries later. CNAMEs are followed. If there is no data, [] is returned. pre: qtype in ['A', 'AAAA', 'MX', 'PTR', 'TXT', 'SPF'] post: isinstance(__return__, types.ListType) |
References Milter.dns.Session.cache, Milter.cache.AddrCache.cache, Milter.dns.Session.dns(), and Milter.dns.DNSLookup().
Referenced by Milter.dns.Session.dns().
|
static |
Additional DNS RRs we can safely cache.
We have to be careful which additional DNS RRs we cache. For instance, PTR records are controlled by the connecting IP, and they could poison our local cache with bogus A and MX records. Each entry is a tuple of (query_type,rr_type). So for instance, the entry ('MX','A') says it is safe (for milter purposes) to cache any 'A' RRs found in an 'MX' query.