From db030656cf2ee224d56c1da2e464aaea980fe2ca Mon Sep 17 00:00:00 2001 From: Carson Fleming Date: Thu, 22 Dec 2022 05:21:48 -0800 Subject: Use umask to allow group members to control pk + some cleanup --- pkctl.py | 5 +++-- pkd_stub.py | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pkctl.py b/pkctl.py index 9b3abc6..f54960e 100644 --- a/pkctl.py +++ b/pkctl.py @@ -65,7 +65,6 @@ def attach_reader(sock, state): if len(data) > 0: pnnl(str(data, 'utf-8')) sock.close() - threading.main_thread().join() def attach_cmd(): if not isd_running(): @@ -107,7 +106,9 @@ def attach_cmd(): state['attached'] = False break + state['attached'] = False sock.close() + reader_thread.join() return True def exec_cmd(*args): @@ -156,7 +157,7 @@ def main(): if attach_cmd(): print('Detached from daemon; quitting.') else: - print('Cannot contact daemon; ensure it is running.') + print('Cannot contact daemon; ensure it is running and you have access to it.') else: print('Unrecognized command:', sys.argv[1]) print_help() diff --git a/pkd_stub.py b/pkd_stub.py index b6ef8d4..ef5818d 100644 --- a/pkd_stub.py +++ b/pkd_stub.py @@ -376,7 +376,9 @@ def serve_screens(): try: sockets['screen'] = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) sock = sockets['screen'] + oldmask = os.umask(0o002) sock.bind(socket_file) + os.umask(oldmask) sock.listen(5) except: print('[FATAL] Unable to bind socket file.') -- cgit v1.2.3