Sign/Verify based on Mode config option
This commit is contained in:
@@ -54,7 +54,7 @@ class dkimMilter(Milter.Base):
|
|||||||
self.mailfrom = None
|
self.mailfrom = None
|
||||||
self.id = Milter.uniqueID()
|
self.id = Milter.uniqueID()
|
||||||
# we don't want config used to change during a connection
|
# we don't want config used to change during a connection
|
||||||
self.conf = config
|
self.conf = milterconfig
|
||||||
self.fp = None
|
self.fp = None
|
||||||
|
|
||||||
@Milter.noreply
|
@Milter.noreply
|
||||||
@@ -65,8 +65,8 @@ class dkimMilter(Milter.Base):
|
|||||||
self.receiver = self.getsymval('j').strip()
|
self.receiver = self.getsymval('j').strip()
|
||||||
if hostaddr and len(hostaddr) > 0:
|
if hostaddr and len(hostaddr) > 0:
|
||||||
ipaddr = hostaddr[0]
|
ipaddr = hostaddr[0]
|
||||||
if iniplist(ipaddr,self.conf.internal_connect):
|
"""if iniplist(ipaddr,self.conf.internal_connect): FIXME
|
||||||
self.internal_connection = True
|
self.internal_connection = True"""
|
||||||
else: ipaddr = ''
|
else: ipaddr = ''
|
||||||
self.connectip = ipaddr
|
self.connectip = ipaddr
|
||||||
if self.internal_connection:
|
if self.internal_connection:
|
||||||
@@ -150,11 +150,11 @@ class dkimMilter(Milter.Base):
|
|||||||
self.log('REMOVE: ',val)
|
self.log('REMOVE: ',val)
|
||||||
# Check or sign DKIM
|
# Check or sign DKIM
|
||||||
self.fp.seek(0)
|
self.fp.seek(0)
|
||||||
if self.internal_connection:
|
if self.internal_connection or conf.get('Mode') == 's' or conf.get('Mode') == 'sv':
|
||||||
txt = self.fp.read()
|
txt = self.fp.read()
|
||||||
self.sign_dkim(txt)
|
self.sign_dkim(txt)
|
||||||
result = None
|
result = None
|
||||||
elif self.has_dkim:
|
if self.has_dkim and (conf.get('Mode') == 'v' or conf.get('Mode') == 'sv'):
|
||||||
txt = self.fp.read()
|
txt = self.fp.read()
|
||||||
if self.check_dkim(txt):
|
if self.check_dkim(txt):
|
||||||
result = 'pass'
|
result = 'pass'
|
||||||
|
|||||||
Reference in New Issue
Block a user