From 6aac37e157d93acca36c7da16baf46e7b8478cd4 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Sun, 1 Apr 2018 11:31:33 +0100 Subject: [PATCH] issue #106: allow any context to contact FileService. Also fix privilege check for register command. --- ansible_mitogen/services.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ansible_mitogen/services.py b/ansible_mitogen/services.py index 0266d533..058dac1c 100644 --- a/ansible_mitogen/services.py +++ b/ansible_mitogen/services.py @@ -112,6 +112,9 @@ class FileService(mitogen.service.Service): """ handle = 501 max_message_size = 1000 + policies = ( + mitogen.service.AllowAny(), + ) unprivileged_msg = 'Cannot register from unprivileged context.' unregistered_msg = 'Path is not registered with FileService.' @@ -133,7 +136,7 @@ class FileService(mitogen.service.Service): return getattr(self, cmd)(path, msg) def register(self, path, msg): - if msg.auth_id not in mitogen.parent_ids: + if not mitogen.core.has_parent_authority(msg): raise mitogen.core.CallError(self.unprivileged_msg) with open(path, 'rb') as fp: