Attached.  I'd like to upload this to s-p-u.

Scott K
diff -u pyspf-2.0.5/debian/changelog pyspf-2.0.5/debian/changelog
--- pyspf-2.0.5/debian/changelog
+++ pyspf-2.0.5/debian/changelog
@@ -1,3 +1,11 @@
+pyspf (2.0.5-2+squeeze1) stable; urgency=low
+
+  * Backport upstream CVS commit 1.108.2.75 to correct pyspf processing
+    with CNAMES - already fixed in 2.0.7 in Wheezy/Sid (Closes: #663595)
+    - Changes inline due to lack of existing patch system
+
+ -- Scott Kitterman <sc...@kitterman.com>  Tue, 13 Mar 2012 16:16:06 -0400
+
 pyspf (2.0.5-2) unstable; urgency=low
 
   [ Sandro Tosi ]
only in patch2:
unchanged:
--- pyspf-2.0.5.orig/spf.py
+++ pyspf-2.0.5/spf.py
@@ -1190,17 +1190,22 @@
         pre: qtype in ['A', 'AAAA', 'MX', 'PTR', 'TXT', 'SPF']
         post: isinstance(__return__, types.ListType)
         """
+        if name.endswith('.'): name = name[:-1]
         if not reduce(lambda x,y:x and 0 < len(y) < 64, name.split('.'),True):
             return []   # invalid DNS name (too long or empty)
         result = self.cache.get( (name, qtype) )
-        cname = None
-
-        if not result:
+        if result: return result
+        cnamek = (name,'CNAME')
+        cname = self.cache.get( cnamek )
+ 
+        if cname:
+            cname = cname[0]
+        else:
             safe2cache = query.SAFE2CACHE
             for k, v in DNSLookup(name, qtype, self.strict, self.timeout):
-                if k == (name, 'CNAME'):
+                if k == cnamek:
                     cname = v
-                if (qtype,k[1]) in safe2cache:
+                if k[1] == 'CNAME' or (qtype,k[1]) in safe2cache:
                     self.cache.setdefault(k, []).append(v)
             result = self.cache.get( (name, qtype), [])
         if not result and cname:
@@ -1213,6 +1218,8 @@
             if cname in cnames:
                 raise PermError, 'CNAME loop'
             result = self.dns(cname, qtype, cnames=cnames)
+            if result:
+                self.cache[(name,qtype)] = result
         return result
 
     def cidrmatch(self, ipaddrs, n):

Attachment: signature.asc
Description: This is a digitally signed message part.



Reply via email to