Skip to content

Commit

Permalink
don't bundle ssh and sshpass by default as openssh doesn't seem to wa…
Browse files Browse the repository at this point in the history
…nt to read or write from our pipes, do switch to semicolon as separator (easier to print and parse), merge code that find sshpass.exe if present

git-svn-id: https://xpra.org/svn/Xpra/trunk@20041 3bb7dfac-3a0b-4e04-842a-767bc560f471
  • Loading branch information
totaam committed Aug 5, 2018
1 parent 68cf255 commit 9f24e53
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
14 changes: 7 additions & 7 deletions src/win32/MINGW_BUILD.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN_INSTALLER=${RUN_INSTALLER:-1}
DO_MSI=${DO_MSI:-0}
DO_SIGN=${DO_SIGN:-1}
BUNDLE_PUTTY=${BUNDLE_PUTTY:-1}
BUNDLE_OPENSSH=${BUNDLE_OPENSSH:-1}
BUNDLE_OPENSSH=${BUNDLE_OPENSSH:-0}
BUNDLE_OPENSSL=${BUNDLE_OPENSSL:-1}

PYTHON=${PYTHON:-python2}
Expand Down Expand Up @@ -211,10 +211,6 @@ if [ "${DO_TESTS}" == "1" ]; then
fi
fi

# For building Python 3.x Sound sub-app (broken because of cx_Freeze bugs)
#echo "* Building Python 3.4 Cython modules (see win32/Python${PYTHON_MAJOR_VERSION}-build.log)"
#${PYTHON} ./setup.py build_ext ${BUILD_OPTIONS} --inplace >& win32/Python${PYTHON_MAJOR_VERSION}-build.log

echo "* Generating installation directory"
CX_FREEZE_LOG="win32/cx_freeze-install.log"
${PYTHON} ./setup.py install_exe ${BUILD_OPTIONS} --install=${DIST} >& ${CX_FREEZE_LOG}
Expand Down Expand Up @@ -261,8 +257,8 @@ if [ "${PYTHON_MAJOR_VERSION}" == "3" ]; then
pushd lib > /dev/null
else
mv lib/PIL/*dll ./lib/
mv lib/*dll ./ > /dev/null
pushd .
mv lib/*dll ./
pushd . > /dev/null
fi
#remove all the pointless duplication:
for x in `ls *dll`; do
Expand Down Expand Up @@ -296,7 +292,11 @@ fi
if [ "${BUNDLE_OPENSSH}" == "1" ]; then
echo "* Adding OpenSSH"
cp -fn "/usr/bin/ssh.exe" "${DIST}/"
cp -fn "/usr/bin/sshpass.exe" "${DIST}/"
cp -fn "/usr/bin/ssh-keygen.exe" "${DIST}/"
for x in 2.0 gcc_s-seh crypto z gssapi asn1 com_err roken crypt heimntlm krb5 heimbase wind hx509 hcrypto sqlite3; do
cp -fn /usr/bin/msys-$x*.dll "${DIST}/"
done
fi

if [ "${BUNDLE_OPENSSL}" == "1" ]; then
Expand Down
10 changes: 7 additions & 3 deletions src/xpra/net/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,11 @@ def ssh_exec_connect_to(display_desc, opts=None, debug_cb=None, ssh_fail_cb=ssh_
env = display_desc.get("env")
kwargs["stderr"] = sys.stderr
if WIN32:
from subprocess import CREATE_NEW_PROCESS_GROUP, CREATE_NEW_CONSOLE
from subprocess import CREATE_NEW_PROCESS_GROUP, CREATE_NEW_CONSOLE, STARTUPINFO, STARTF_USESHOWWINDOW
startupinfo = STARTUPINFO()
startupinfo.dwFlags |= STARTF_USESHOWWINDOW
startupinfo.wShowWindow = 0 #aka win32.con.SW_HIDE
kwargs["startupinfo"] = startupinfo
flags = CREATE_NEW_PROCESS_GROUP | CREATE_NEW_CONSOLE
kwargs["creationflags"] = flags
kwargs["stderr"] = PIPE
Expand Down Expand Up @@ -486,7 +490,7 @@ def ssh_exec_connect_to(display_desc, opts=None, debug_cb=None, ssh_fail_cb=ssh_
if INITENV_COMMAND:
remote_cmd = INITENV_COMMAND + ";" + remote_cmd
remote_args = " ".join(proxy_command + display_as_args)
remote_cmd = "#run-xpra %s\n%s" % (remote_args, remote_cmd)
remote_cmd = "#run-xpra %s;%s" % (remote_args, remote_cmd)
#putty gets confused if we wrap things in shell command:
if display_desc.get("is_putty", False):
cmd.append(remote_cmd)
Expand Down Expand Up @@ -522,7 +526,7 @@ def ssh_exec_connect_to(display_desc, opts=None, debug_cb=None, ssh_fail_cb=ssh_
if env:
kwargs["env"] = env
if SSH_DEBUG:
sys.stdout.write("executing ssh command: %s\n" % (" ".join("\"%s\"" % x for x in cmd)))
log.info("executing ssh command: %s" % (" ".join("\"%s\"" % x for x in cmd)))
child = Popen(cmd, stdin=PIPE, stdout=PIPE, **kwargs)
except OSError as e:
raise InitExit(EXIT_SSH_FAILURE, "Error running ssh command '%s': %s" % (" ".join("\"%s\"" % x for x in cmd), e))
Expand Down
9 changes: 7 additions & 2 deletions src/xpra/platform/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,14 @@ def do_get_sshpass_command():
import os.path
def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
for path in os.environ["PATH"].split(os.pathsep):
SSHPASS = "sshpass"
from xpra.platform.features import EXECUTABLE_EXTENSION
if EXECUTABLE_EXTENSION:
SSHPASS = "sshpass.%s" % EXECUTABLE_EXTENSION
paths = os.environ["PATH"].split(os.pathsep)
for path in paths:
path = path.strip('"')
exe_file = os.path.join(path, "sshpass")
exe_file = os.path.join(path, SSHPASS)
if is_exe(exe_file):
return exe_file
return None
Expand Down
4 changes: 2 additions & 2 deletions src/xpra/server/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def chan_send(send_fn, data, timeout=5):
#try to detect it and extract the actual command the client is trying to run.
#ie:
#['sh', '-c',
# '#run-xpra _proxy\nxpra initenv;\
# '#run-xpra _proxy;xpra initenv;\
# if [ -x $XDG_RUNTIME_DIR/xpra/run-xpra ]; then $XDG_RUNTIME_DIR/xpra/run-xpra _proxy;\
# elif [ -x ~/.xpra/run-xpra ]; then ~/.xpra/run-xpra _proxy;\
# elif type "xpra" > /dev/null 2>&1; then xpra _proxy;\
Expand All @@ -187,7 +187,7 @@ def chan_send(send_fn, data, timeout=5):
if parse_cmd.startswith("#run-xpra "):
#newer versions make it easy,
#the first line contains a comment which gives us the actual arguments for run-xpra:
args = parse_cmd.splitlines()[0].split("#run-xpra ")[1]
args = parse_cmd.split(";")[0].split("#run-xpra ")[1]
if args=="_proxy":
self._run_proxy(channel)
return True
Expand Down

0 comments on commit 9f24e53

Please sign in to comment.