- Delete own_socketfile to resolve race condition where the permissions
change fails on a Unix socket because it hasn't been created yet (libmilter will do this correctly on its own based on umask, the milter doesn't need to do it) (LP: #1849712)
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
1.1.4
|
||||
- Make error logging more explicit to aid debugging
|
||||
- Delete own_socketfile to resolve race condition where the permissions
|
||||
change fails on a Unix socket because it hasn't been created yet (libmilter
|
||||
will do this correctly on its own based on umask, the milter doesn't need
|
||||
to do it) (LP: #1849712)
|
||||
|
||||
1.1.3 2019-10-06
|
||||
- Fix sysv init so it works (LP: #1839487)
|
||||
|
||||
@@ -37,7 +37,6 @@ from dkimpy_milter.util import drop_privileges
|
||||
from dkimpy_milter.util import setExceptHook
|
||||
from dkimpy_milter.util import write_pid
|
||||
from dkimpy_milter.util import read_keyfile
|
||||
from dkimpy_milter.util import own_socketfile
|
||||
from dkimpy_milter.util import fold
|
||||
|
||||
__version__ = "1.0.1"
|
||||
@@ -401,7 +400,6 @@ def main():
|
||||
socketname = 'fd:3'
|
||||
if socketname is None:
|
||||
socketname = 'local:/var/run/dkimpy-milter/dkimpy-milter.sock'
|
||||
own_socketfile(milterconfig, socketname)
|
||||
drop_privileges(milterconfig)
|
||||
sys.stdout.flush()
|
||||
if milterconfig.get('Syslog'):
|
||||
|
||||
@@ -149,27 +149,6 @@ def write_pid(milterconfig):
|
||||
return pid
|
||||
|
||||
|
||||
def own_socketfile(milterconfig, sockname=None):
|
||||
"""If socket is Unix socket, chown to UserID before dropping privileges"""
|
||||
import os
|
||||
user, group = user_group(milterconfig.get('UserID'))
|
||||
offset = None
|
||||
if sockname is None:
|
||||
sockname = milterconfig.get('Socket')
|
||||
if sockname is None:
|
||||
return
|
||||
if sockname[:1] == '/':
|
||||
offset = 0
|
||||
elif sockname[:6] == "local:":
|
||||
offset = 6
|
||||
elif sockname[:5] == "unix:":
|
||||
offset = 5
|
||||
|
||||
if offset is not None:
|
||||
if os.path.exists(sockname[offset:]):
|
||||
os.chown(sockname[offset:], user, group)
|
||||
|
||||
|
||||
def read_keyfile(milterconfig, keytype):
|
||||
"""Read private key from file."""
|
||||
import syslog
|
||||
|
||||
Reference in New Issue
Block a user