Avoid AttributeError on simple connection and disconnection
Without this patch, this simple script for miltertest:
----
conn = mt.connect("unix:milter.sock")
if conn == nil then
error "mt.connect() failed"
end
if mt.conninfo(conn, nil, "unspec") ~= nil then
error "mt.conninfo() failed"
end
if mt.getreply(conn) ~= SMFIR_CONTINUE then
error "mt.conninfo() unexpected reply"
end
mt.disconnect(conn)
----
Produces the following error:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/Milter/__init__.py", line 702, in connect_callback
return m.connect(hostname,family,hostaddr)
File "/usr/lib/python2.7/dist-packages/Milter/__init__.py", line 173, in wrapper
rc = func(self,*args)
File "/home/dkg/src/dkimpy-milter/dkimpy-milter/dkimpy_milter/__init__.py", line 64, in connect
self.receiver = self.getsymval('j').strip()
AttributeError: 'NoneType' object has no attribute 'strip'
This commit is contained in:
@@ -61,7 +61,9 @@ class dkimMilter(Milter.Base):
|
||||
self.external_connection = False
|
||||
self.hello_name = None
|
||||
# sometimes people put extra space in sendmail config, so we strip
|
||||
self.receiver = self.getsymval('j').strip()
|
||||
self.receiver = self.getsymval('j')
|
||||
if self.receiver is not None:
|
||||
self.receiver = self.receiver.strip()
|
||||
try:
|
||||
self.AuthservID = milterconfig['AuthservID']
|
||||
except:
|
||||
|
||||
Reference in New Issue
Block a user