projects/aports·blob master · refs

45 lines · 1.5 KiB

1Patch-Source: https://github.com/proxmoxer/openssh-wrapper/commit/080d1143f490155684d15da91745f51c1108045f
2Upstream issue: https://github.com/NetAngels/openssh-wrapper/issues/20
3---
4From 080d1143f490155684d15da91745f51c1108045f Mon Sep 17 00:00:00 2001
5From: John Hollowell <[email protected]>
6Date: Tue, 10 Dec 2024 23:03:57 -0500
7Subject: [PATCH] Replace `pipes` with `shlex`
8
9---
10 openssh_wrapper.py | 8 ++++----
11 1 file changed, 4 insertions(+), 4 deletions(-)
12
13diff --git a/openssh_wrapper.py b/openssh_wrapper.py
14index 741da66..0a3375b 100644
15--- a/openssh_wrapper.py
16+++ b/openssh_wrapper.py
17@@ -6,7 +6,7 @@
18 import re
19 import os
20 import sys
21-import pipes
22+import shlex
23 import signal
24 import shutil
25 import getpass
26@@ -61,8 +61,8 @@ def b_quote(cmd_chunks):
27 """
28 quoted = []
29 for chunk in cmd_chunks:
30- # pipes.quote works with text representation only
31- quoted.append(b(pipes.quote(u(chunk))))
32+ # shlex.quote works with text representation only
33+ quoted.append(b(shlex.quote(u(chunk))))
34 return b(' ').join(quoted)
35
36
37@@ -318,7 +318,7 @@ def get_scp_targets(self, filenames, target):
38 >>> get_scp_targets(['foo.txt', ], '/etc/passwd')
39 ['/etc/passwd']
40 """
41- result = self.run(b('test -d %s' % pipes.quote(u(target))))
42+ result = self.run(b('test -d %s' % shlex.quote(u(target))))
43 is_directory = result.returncode == 0
44 if is_directory:
45 ret = []