[X2Go-Commits] x2goserver.git - build-baikal (branch) updated: 3.1.1.2-3-ge1d66fc

X2Go dev team git-admin at x2go.org
Fri Jan 3 18:04:52 CET 2014


The branch, build-baikal has been updated
       via  e1d66fc8929ff79495414e48068192a65c7d072d (commit)
      from  44cbc5037875d6f5755abfd39271ab1c41347228 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 debian/changelog                  |    1 +
 x2goserver/bin/x2goresume-session |    8 ++++++--
 x2goserver/bin/x2gostartagent     |   10 +++++++---
 3 files changed, 14 insertions(+), 5 deletions(-)

The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index 0d53fe4..611f584 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ x2goserver (3.1.1.3-0~x2go1) UNRELEASED; urgency=low
   [ Jan Engelhardt ]
   * New upstream version (3.1.1.3):
     - Do not block /etc/X11/Xresources with a directory (in Makefile).
+    - Avoid using archaic tools during free port detection.
 
  -- Mike Gabriel <mike.gabriel at das-netzwerkteam.de>  Fri, 29 Jun 2012 17:49:04 +0200
 
diff --git a/x2goserver/bin/x2goresume-session b/x2goserver/bin/x2goresume-session
index 3a9772f..cddbf05 100755
--- a/x2goserver/bin/x2goresume-session
+++ b/x2goserver/bin/x2goresume-session
@@ -64,8 +64,12 @@ SERVER=`echo "$SESSIONINFO" | awk -F, {'print $4'}`
 
 $X2GO_LIB_PATH/x2gosyslog "$0" "debug" "old ports: $GR_PORT, $SOUND_PORT, $FS_PORT"
 
-#Get all used in system ports from netstat output
-SYSTEM_PORTS=`netstat -nt -all | awk '{ n=split($0,lines,"\n"); for(i=1;i<=n;i++){split (lines[i],words," ");delim=split(words[4],ports,":"); if(delim>1)printf ("|%s|\n",ports[delim])} }'`
+#Get all used in system ports from ss output
+ss=$(PATH="$PATH:/usr/sbin:/sbin" type -P ss);
+USED_PORTS=$(
+	"$ss" -lnt |
+	perl -lne 'print$d{$2}="|$2|"if/^(\S+\s+){2}\S+:(\d+)/&&!exists$d{$2}';
+);
 
 #check if saved in DB ports free
 if grep -q "|${GR_PORT}|" <<<$SYSTEM_PORTS ; then
diff --git a/x2goserver/bin/x2gostartagent b/x2goserver/bin/x2gostartagent
index fedd6ba..abf1422 100755
--- a/x2goserver/bin/x2gostartagent
+++ b/x2goserver/bin/x2gostartagent
@@ -124,9 +124,13 @@ fi
 
 USED_DISPLAYS=`$X2GO_LIB_PATH/x2gogetdisplays $HOSTNAME`
 
-#Get all used in system ports from X2Go database and netstat output
-USED_PORTS=`$X2GO_LIB_PATH/x2gogetports $HOSTNAME ; netstat -nt -all | awk '{ n=split($0,lines,"\n"); for(i=1;i<=n;i++){split (lines[i],words," ");delim=split(words[4],ports,":"); if(delim>1)printf ("|%s|\n",ports[delim])} }'`
-
+#Get all used in system ports from X2Go database and ss output
+ss=$(PATH="$PATH:/usr/sbin:/sbin" type -P ss);
+USED_PORTS=$(
+	"$X2GO_LIB_PATH/x2gogetports" "$HOSTNAME";
+	"$ss" -lnt |
+	perl -lne 'print$d{$2}="|$2|"if/^(\S+\s+){2}\S+:(\d+)/&&!exists$d{$2}';
+);
 
 while [ "$OUTPUT"  != "inserted" ]; do
 	X2GO_PORT=$(($X2GO_PORT + 1))


hooks/post-receive
-- 
x2goserver.git (X2Go Server)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "x2goserver.git" (X2Go Server).




More information about the x2go-commits mailing list