[X2Go-Commits] [x2goserver] 25/27: x2goserver/bin/x2goresume-session: actually check if the old port values have been refurbished within the system and reassign them.

git-admin at x2go.org git-admin at x2go.org
Wed Jan 10 00:17:59 CET 2018


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch release/4.0.1.x
in repository x2goserver.

commit 4da317ded579ddf512b40ac09d1d4f950c5af1c7
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Mon Jan 8 07:34:21 2018 +0100

    x2goserver/bin/x2goresume-session: actually check if the old port values have been refurbished within the system and reassign them.
---
 debian/changelog                  |  2 ++
 x2goserver/bin/x2goresume-session | 19 +++++++++++--------
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 40e89e1..d7e999e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -75,6 +75,8 @@ x2goserver (4.0.1.23-0x2go1) UNRELEASED; urgency=medium
     - x2goserver/lib/x2gogetfreeport: use the check_*_port functions, require
       current host name as a parameter and adapt x2gogetfreeport usages
       accordingly.
+    - x2goserver/bin/x2goresume-session: actually check if the old port values
+      have been refurbished within the system and reassign them.
   * x2goserver.spec:
     - RPMify x2goserver-xsession description.
     - Remove qt4 stuff, we're not using the framework here.
diff --git a/x2goserver/bin/x2goresume-session b/x2goserver/bin/x2goresume-session
index a9a9e70..2d4b041 100755
--- a/x2goserver/bin/x2goresume-session
+++ b/x2goserver/bin/x2goresume-session
@@ -153,21 +153,27 @@ FS_PORT="$(awk -F ',' '{print $14}' <<< "${SESSIONINFO}")"
 
 "${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'debug' "old ports: ${GR_PORT}, ${SOUND_PORT}, ${FS_PORT}"
 
-### FIXME ###
-### THIS NEVER WORKED CORRECTLY SINCE ${SYSTEM_PORTS} HAS BEEN REPLACED BY A ${USED_PORTS} COPY ###
+typeset X2GO_INTERNAL_SOURCE='1'
+# Make shellcheck happy.
+: "${X2GO_INTERNAL_SOURCE}"
+. "${X2GO_LIB_PATH}/x2gocheckport"
+unset X2GO_INTERNAL_SOURCE
+
+# define the full path to the ss utility
+typeset ss="$(PATH="${PATH}:/usr/sbin:/sbin" type -P 'ss')"
 
 #check if saved in DB ports free
-if grep -q "|${GR_PORT}|" <<< "${SYSTEM_PORTS}"; then
+if ! check_system_port "${ss}" "${GR_PORT}"; then
 	"${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'debug' "port ${GR_PORT} is already in use"
 	"${X2GO_LIB_PATH}/x2gormport" "${current_host_name}" "${SESSION_NAME}" "${GR_PORT}"
 	GR_PORT=''
 fi
-if grep -q "|${SOUND_PORT}|" <<< "${SYSTEM_PORTS}"; then
+if ! check_system_port "${ss}" "${SOUND_PORT}"; then
 	"${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'debug' "port ${SOUND_PORT} is already in use"
 	"${X2GO_LIB_PATH}/x2gormport" "${current_host_name}" "${SESSION_NAME}" "${SOUND_PORT}"
 	SOUND_PORT=''
 fi
-if grep -q "|${FS_PORT}|" <<< "${SYSTEM_PORTS}"; then
+if ! check_system_port "${ss}" "${FS_PORT}"; then
 	"${X2GO_LIB_PATH}/x2gosyslog" "${0}" 'debug' "port ${FS_PORT} is already in use"
 	"${X2GO_LIB_PATH}/x2gormport" "${current_host_name}" "${SESSION_NAME}" "${FS_PORT}"
 	FS_PORT=''
@@ -182,9 +188,6 @@ if ! SSH_PORT="$("${X2GO_LIB_PATH}/x2gogetrandomport")"; then
 	exit '5'
 fi
 
-# define the full path to the ss utility
-typeset ss="$(PATH="${PATH}:/usr/sbin:/sbin" type -P 'ss')"
-
 typeset -i retry='0'
 typeset -i max_retry='10'
 typeset -i free_port='0'

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git


More information about the x2go-commits mailing list