Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 559364 | Differences between
and this patch

Collapse All | Expand All

(-)pypolicyd-spf-1.3.1/policyd-spf.original (-4 / +11 lines)
Lines 38-47 Link Here
38
if int(micro) < 7:
38
if int(micro) < 7:
39
    raise ImportError("At least pyspf 2.0.7 is required.")
39
    raise ImportError("At least pyspf 2.0.7 is required.")
40
import policydspfsupp
40
import policydspfsupp
41
try:
41
import ipaddress
42
    import ipaddress
43
except ImportError:
44
    import ipaddr as ipaddress
45
try:
42
try:
46
    import authres
43
    import authres
47
except:
44
except:
Lines 54-59 Link Here
54
def _cidrmatch(ip, netwrk):
51
def _cidrmatch(ip, netwrk):
55
    """Match connect IP against a CIDR network of other IP addresses."""
52
    """Match connect IP against a CIDR network of other IP addresses."""
56
53
54
    if sys.version_info.major < 3:
55
        if isinstance(ip, str):
56
            ip = ip.decode('ascii')
57
        if isinstance(netwrk, str):
58
            netwrk = netwrk.decode('ascii')
59
57
    try:
60
    try:
58
        address = ipaddress.ip_address(ip)
61
        address = ipaddress.ip_address(ip)
59
    except AttributeError:
62
    except AttributeError:
Lines 65-70 Link Here
65
    return network.__contains__(address)
68
    return network.__contains__(address)
66
69
67
def _get_rdns_lookup(ip):
70
def _get_rdns_lookup(ip):
71
    if sys.version_info.major < 3:
72
        if isinstance(ip, str):
73
            ip = ip.decode('ascii')
74
68
    try:
75
    try:
69
        address = ipaddress.ip_address(ip)
76
        address = ipaddress.ip_address(ip)
70
    except AttributeError:
77
    except AttributeError:

Return to bug 559364