From 37cff7a5fb7ca85a3329b7f7f6b60dde02bdb62f Mon Sep 17 00:00:00 2001 From: Vladislav Babkin Date: Fri, 23 Dec 2022 02:49:50 +0200 Subject: [PATCH 1/2] Fix 2 issues Issue 1: in TPipeServer, the CloseHandle call happened on a None _handle after the super() call. Issue 2: Client raises an issue as described in https://github.com/osquery/osquery-python/issues/57, correct call seems to be CloseHandle. This commit fixes both issues --- osquery/TPipe.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/osquery/TPipe.py b/osquery/TPipe.py index e74ac51..d588c0d 100644 --- a/osquery/TPipe.py +++ b/osquery/TPipe.py @@ -32,7 +32,7 @@ def close(self): in the same way """ if self._handle is not None: - win32pipe.DisconnectNamedPipe(self._handle) + win32file.CloseHandle(self._handle) self._handle = None @@ -227,6 +227,5 @@ def close(self): attempts are successful """ if self._handle is not None: - super(TPipe, self).close() - win32file.CloseHandle(self._handle) - self._handle = None + win32pipe.DisconnectNamedPipe(self._handle) + super(TPipeBase).close() From dae0014fc90e6df35fba0d2d254cc922bbc9cb54 Mon Sep 17 00:00:00 2001 From: Vladislav Babkin Date: Fri, 23 Dec 2022 03:18:38 +0200 Subject: [PATCH 2/2] Fix a typo --- osquery/TPipe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osquery/TPipe.py b/osquery/TPipe.py index d588c0d..eb2a288 100644 --- a/osquery/TPipe.py +++ b/osquery/TPipe.py @@ -228,4 +228,4 @@ def close(self): """ if self._handle is not None: win32pipe.DisconnectNamedPipe(self._handle) - super(TPipeBase).close() + super(TPipe, self).close()