If a string-based configuation entry had whitespace in it, it would be
reassembled via a round-trip through the python interpreter, resulting
in a line like this:
PidFile /home/dkimpy-milter/pid file
produces a string like "['/home/dkimpy-milter/pid', 'file']", which is
clearly wrong.
I don't want to encourage people to use paths or other strings with
whitespace in them, but if we're going to fail on them we should be
failing explicitly, not doing a weird transformation that will just
break.
This is concretely useful for the DNSOverride mechanism, which is
where i ran into the problem when trying to set up testing that could
work without setting up an emulated DNS system.
Without this fix, a verifying dkimpy-milter that has no explicit
AuthservID produces the following crashing behavior as it tries to
create the authres header:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/Milter/__init__.py", line 772, in <lambda>
milter.set_eom_callback(lambda ctx: ctx.getpriv().eom())
File "…/dkimpy_milter/__init__.py", line 199, in eom
h = fold(str(h))
File "/usr/lib/python2.7/dist-packages/authres/core.py", line 476, in __str__
return ''.join((self.HEADER_FIELD_NAME, ': ', self.header_value()))
File "/usr/lib/python2.7/dist-packages/authres/core.py", line 496, in header_value
return ''.join(strs)
Changing ownership of sockets that doesn't exist isn't a great
practice.
A better approach would be to apply os.chown() to the file descriptor
of the open socket, but at the very least dkimpy-milter shouldn't
crash the way it currently does if the socket isn't already present.
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'