diff options
author | Adam Tilghman <agt@ucsd.edu> | 2022-11-16 16:35:39 -0800 |
---|---|---|
committer | Adam Tilghman <agt@ucsd.edu> | 2022-11-16 16:35:39 -0800 |
commit | d2affc73b5f40a8a53c839f661dac4f4c4547ede (patch) | |
tree | 62361f1fd4344ab21904345cc9af3fbc70e136ee | |
parent | 27ee3534011dedaaeb5c85b333394fd5f94f14ca (diff) | |
download | websockify-d2affc73b5f40a8a53c839f661dac4f4c4547ede.tar.gz |
Insert rebinder at the head of the (possibly empty) LD_PRELOAD pathlist,
required for use cases relying on other preloaded libraries e.g. nss_wrapper.
-rw-r--r-- | websockify/websocketproxy.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/websockify/websocketproxy.py b/websockify/websocketproxy.py index c636d54..feed588 100644 --- a/websockify/websocketproxy.py +++ b/websockify/websocketproxy.py @@ -325,8 +325,11 @@ class WebSocketProxy(websockifyserver.WebSockifyServer): self.target_port = sock.getsockname()[1] sock.close() + # Insert rebinder at the head of the (possibly empty) LD_PRELOAD pathlist + ld_preloads = filter(None, [ self.rebinder, os.environ.get("LD_PRELOAD", None) ]) + os.environ.update({ - "LD_PRELOAD": self.rebinder, + "LD_PRELOAD": os.pathsep.join(ld_preloads), "REBIND_OLD_PORT": str(kwargs['listen_port']), "REBIND_NEW_PORT": str(self.target_port)}) |