Milter.dns.Session Class Reference

List of all members.

Public Member Functions

def __init__
def dns
 Cached DNS lookup.
def dns_txt

Public Attributes

 cache

Static Public Attributes

tuple SAFE2CACHE
 Additional DNS RRs we can safely cache.

Detailed Description

A Session object has a simple cache with no TTL that is valid
 for a single "session", for example an SMTP conversation.

Member Function Documentation

def Milter.dns.Session.dns (   self,
  name,
  qtype,
  cnames = None 
)

Cached DNS lookup.

Parameters:
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)

Member Data Documentation

Initial value:
frozenset((
    ('MX','MX'), ('MX','A'),
    ('CNAME','CNAME'), ('CNAME','A'),
    ('A','A'),
    ('AAAA','AAAA'),
    ('PTR','PTR'),
    ('NS','NS'), ('NS','A'),
    ('TXT','TXT'),
    ('SPF','SPF')
  ))

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.


The documentation for this class was generated from the following file:

Generated on 11 Jul 2015 for pymilter by  doxygen 1.6.1