]> git.corax.cc Git - toolbox-goodies/commitdiff
include/ssh: Make sure handles don't contain line breaks
authorMatthias Kruk <matthias.kruk@miraclelinux.com>
Mon, 26 Jul 2021 06:49:50 +0000 (15:49 +0900)
committerMatthias Kruk <matthias.kruk@miraclelinux.com>
Mon, 26 Jul 2021 06:53:54 +0000 (15:53 +0900)
Handles returned by ssh_tunnel_open() and ssh_proxy_open() are base64
encoded using the base64 commandline tool. However, base64 inserts line
breaks into long outputs, causing line breaks to be inserted into long
handles, and the returned handles to become unusable.
This commit changes the parameters passed tp base64 so that no line
breaks are inserted into the handles.

include/ssh.sh

index 36d769651b1ea380d482d9bb72f312c50c06feaa..a1634ad87d670f874366d6ec402c10a7ed1a58d9 100755 (executable)
@@ -77,13 +77,13 @@ _ssh_make_handle() {
 
        local handle
 
-       if ! handle=$(base64 <<< "$ctrlsock" 2>/dev/null); then
+       if ! handle=$(base64 -w 0 <<< "$ctrlsock" 2>/dev/null); then
                return 1
        fi
 
        handle+=":"
 
-       if ! handle+=$(base64 <<< "$hostspec" 2>/dev/null); then
+       if ! handle+=$(base64 -w 0 <<< "$hostspec" 2>/dev/null); then
                return 1
        fi