diff --git a/Milter/policy.py b/Milter/policy.py index 0adc5a7..08ff83e 100644 --- a/Milter/policy.py +++ b/Milter/policy.py @@ -1,5 +1,8 @@ try: - from bsddb3 import db + try: + from berkeleydb import db + except: + from bsddb3 import db class DB(object): def open(self,fname,mode): if mode == 'r': flags = db.DB_RDONLY diff --git a/test/access b/test/access index ac79cf8..2da08d9 100644 --- a/test/access +++ b/test/access @@ -7,3 +7,4 @@ SMTP-Auth:good@example.com OK SMTP-Auth:example.com REJECT SMTP-Auth:bad@localhost.localdomain REJECT SMTP-Test: REJECT +SMTP-Test:.baz.com WILDCARD diff --git a/testpolicy.py b/testpolicy.py index f09acbb..732b8e0 100644 --- a/testpolicy.py +++ b/testpolicy.py @@ -8,6 +8,7 @@ class Config(object): def __init__(self): self.access_file='test/access.db' self.access_file_nulls=True + self.access_file_colon = False class PolicyTestCase(unittest.TestCase): @@ -23,8 +24,8 @@ class PolicyTestCase(unittest.TestCase): print("Missing test/access") def testPolicy(self): - self.config.use_colon = True - self.config.use_nulls = True + self.config.access_file_colon = False + self.config.access_file_nulls = True with MTAPolicy('good@example.com',conf=self.config) as p: pol = p.getPolicy('smtp-auth') self.assertEqual(pol,'OK')