From bf5306798cc7b22eaddefa13d4e76cd3599a54b0 Mon Sep 17 00:00:00 2001 From: Juan Jose Nicola Date: Wed, 16 Oct 2019 11:45:30 +0200 Subject: [PATCH] Fix set permission on unix socket. It was trying to set the permissions on the unix socket before creating it. --- CHANGELOG.md | 9 ++++++++- ospd/server.py | 6 +++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d492ff88..87561c99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [20.4] (unreleased) -## [2.0.0] (unreleased) +## [2.0.1] (unreleased) + +### Fixed +- Fix set permission in unix socket. [#157](https://github.com/greenbone/ospd/pull/157) + +[2.0.1]: https://github.com/greenbone/ospd/compare/v2.0.0...ospd-2.0 + +## [2.0.0] (2019-10-11) ### Added - Add OSP command get_vts and the vts dictionary. [#12](https://github.com/greenbone/ospd/pull/12) [#60](https://github.com/greenbone/ospd/pull/60) [#72](https://github.com/greenbone/ospd/pull/72) [#73](https://github.com/greenbone/ospd/pull/73) [#93](https://github.com/greenbone/ospd/pull/93) diff --git a/ospd/server.py b/ospd/server.py index 5523de38..9356abf0 100644 --- a/ospd/server.py +++ b/ospd/server.py @@ -202,9 +202,6 @@ def start(self, stream_callback: StreamCallbackType): self._cleanup_socket() self._create_parent_dirs() - if self.socket_path.exists(): - os.chmod(str(self.socket_path), self.socket_mode) - try: self.stream_callback = stream_callback self.server = ThreadedUnixSocketServer(self, str(self.socket_path)) @@ -217,6 +214,9 @@ def start(self, stream_callback: StreamCallbackType): ) ) + if self.socket_path.exists(): + self.socket_path.chmod(self.socket_mode) + def close(self): super().close() self._cleanup_socket()