This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch master in repository x2goserver. commit 6e22bbd295fd2b40d1f0f973eef73af76e928c8d Author: Oleksandr Shneyder <o.shneyder@phoca-gmbh.de> Date: Fri Jun 27 12:30:17 2014 +0200 Move session file to /tmp/.x2go-$USER. Remove nxcleanup script. Remove unused dependencies. --- X2Go/Server/Agent/NX.pm | 3 +-- X2Go/Utils.pm | 15 +------------ debian/changelog | 4 +++- debian/control | 1 - x2goserver/bin/x2goruncommand | 2 +- x2goserver/bin/x2gostartagent | 27 ++++++++++++---------- x2goserver/bin/x2goterminate-session | 3 --- x2goserver/lib/x2gonxcleanup | 41 ---------------------------------- 8 files changed, 21 insertions(+), 75 deletions(-) diff --git a/X2Go/Server/Agent/NX.pm b/X2Go/Server/Agent/NX.pm index 7242474..b05f9e0 100644 --- a/X2Go/Server/Agent/NX.pm +++ b/X2Go/Server/Agent/NX.pm @@ -33,7 +33,6 @@ X2Go::Server::Agent::NX Perl package for X2Go::Server. use strict; use POSIX; use Sys::Syslog qw( :standard :macros ); -use File::HomeDir; use X2Go::Log qw( loglevel ); @@ -77,7 +76,7 @@ sub get_agent_state my $sess=@_[1]; my $user=@_[2]; my $state; - my $stateFile = File::HomeDir->users_home($user) . "/.x2go/C-".$sess."/state"; + my $stateFile = "/tmp/.x2go-".$user."/C-".$sess."/state"; if (! -e $stateFile ) { die "state file not exists: $stateFile\n"; diff --git a/X2Go/Utils.pm b/X2Go/Utils.pm index d5eb08d..41baf8b 100644 --- a/X2Go/Utils.pm +++ b/X2Go/Utils.pm @@ -35,14 +35,13 @@ X2Go::Utils Perl package. =cut use strict; -use IO::Socket; use base 'Exporter'; our @EXPORT = ( 'load_module', 'is_true', 'source_environment', 'clups', 'sanitizer', 'system_capture_merged_output', 'system_capture_stdout_output', - 'check_x2go_sessionid', 'test_socket_state', ); + 'check_x2go_sessionid'); use Sys::Syslog qw( :standard :macros ); use Capture::Tiny qw ( :all ); @@ -181,16 +180,4 @@ sub check_x2go_sessionid { } } -sub test_socket_state { - my $portNum = sanitizer("num",$_[0]) or die "Port number not a number '$_[0]'?"; - my $socket = IO::Socket::INET->new( PeerAddr => 'localhost', PeerPort => $portNum, Proto => 'tcp'); - if (defined $socket) { - print $socket "\n"; - $socket->close; - return 1; - } else { - return 0; - } -} - 1; diff --git a/debian/changelog b/debian/changelog index 5a0fc35..5ac6084 100644 --- a/debian/changelog +++ b/debian/changelog @@ -116,8 +116,10 @@ x2goserver (4.1.0.0-0x2go1.1) UNRELEASED; urgency=low [ Oleksandr Shneyder ] * x2gostartagent, x2golistsession, x2gosuspend-session and x2goresume-session - getting agent state from ~/.x2go/C-$SID/state. This should help to avoid + getting agent state from ~/.x2go/C-$SID/state. This should help to avoid session damage. (Fixes: #302). + - Move session file to /tmp/.x2go-$USER. Remove nxcleanup script. Remove + unused dependencies. -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Fri, 09 May 2014 13:06:24 +0200 diff --git a/debian/control b/debian/control index 5976f26..373738e 100644 --- a/debian/control +++ b/debian/control @@ -21,7 +21,6 @@ Depends: ${misc:Depends}, libfile-basedir-perl, libfile-readbackwards-perl, - libfile-homedir-perl, libtry-tiny-perl, libx2go-server-perl (>= ${source:Version}), libx2go-server-perl (<< ${source:Version}.1~), x2goagent (>= 2:3.5.0.25-0~), diff --git a/x2goserver/bin/x2goruncommand b/x2goserver/bin/x2goruncommand index 8339166..3e8dfab 100755 --- a/x2goserver/bin/x2goruncommand +++ b/x2goserver/bin/x2goruncommand @@ -306,5 +306,5 @@ test -r /etc/x2go/x2go_logout && . /etc/x2go/x2go_logout # clean up session dir if not in debug mode and if session has been successful if [ "$($X2GO_LIB_PATH/x2gologlevel)" != "7" ] && [ "x$successful_run" = "xtrue" ]; then - (sleep 10; rm -Rf "${HOME}/.x2go/C-${X2GO_SESSION}"; rm -f "/tmp/.x2go-${USER}/session-C-${X2GO_SESSION}.log"; rmdir --ignore-fail-on-non-empty "/tmp/.x2go-${USER}"; )& + (sleep 10; rm -f "${HOME}/.x2go/C-${X2GO_SESSION}"; rm -Rf "/tmp/.x2go-${USER}/C-${X2GO_SESSION}"; rmdir --ignore-fail-on-non-empty "/tmp/.x2go-${USER}"; )& fi diff --git a/x2goserver/bin/x2gostartagent b/x2goserver/bin/x2gostartagent index 3f82c7f..732df7d 100755 --- a/x2goserver/bin/x2gostartagent +++ b/x2goserver/bin/x2gostartagent @@ -247,31 +247,34 @@ if [ "$X2GO_STYPE" == "S" ]; then X2GO_GEOMETRY=`echo "$X2GO_GEOMETRY" | sed -e "s/-geometry//"` fi -SESSION_DIR="${X2GO_ROOT}/C-${SESSION_NAME}" +if [ ! -d "$X2GO_ROOT" ]; then + mkdir "$X2GO_ROOT" +fi + +X2GO_TMP_ROOT="/tmp/.x2go-${USER}" +if [ ! -d "$X2GO__TMP_ROOT" ]; then + mkdir "$X2GO_TMP_ROOT" +fi + +SESSION_DIR="${X2GO_TMP_ROOT}/C-${SESSION_NAME}" if [ "x$X2GO_TELEKINESIS_ENABLED" != "x0" ]; then mkdir -p "${SESSION_DIR}/telekinesis/remote/" fi -STATE_FILE="${X2GO_ROOT}/C-${SESSION_NAME}/state" +STATE_FILE="${SESSION_DIR}/state" # do not use $TMP or $TEMP here, the session.log file location has to be accessible by root -SESSION_LOG="/tmp/.x2go-${USER}/session-C-${SESSION_NAME}.log" -mkdir -p $(dirname "${SESSION_LOG}") -chmod -f 0700 $(dirname "${SESSION_LOG}") +SESSION_LOG="${SESSION_DIR}/session.log" +mkdir -p "${SESSION_DIR}" +chmod -f 0700 "${SESSION_DIR}" touch "${SESSION_LOG}" chmod -f 0600 "${SESSION_LOG}" -if [ ! -d "$X2GO_ROOT" ]; then - mkdir "$X2GO_ROOT" -fi if [ ! -d "$X2GO_ROOT/ssh" ]; then mkdir "$X2GO_ROOT/ssh" fi -if [ ! -d "$SESSION_DIR" ]; then - mkdir "$SESSION_DIR" -fi X2GO_COOKIE=`mcookie` @@ -337,7 +340,7 @@ else NX_TEMP=/tmp x2goagent $X2GO_NXAGENT_OPTIONS $NOLISTOPT $X2GODPIOPTION_ $XDMCPOPT -$SESSION_TYPE $NOEXITPARAM -auth "$XAUTHORITY" $agent_geometry -name "${SESSION_WINDOW_TITLE}" "${NX_AGENT}" 2>"${SESSION_LOG}" & fi -ln -s "${SESSION_LOG}" "${SESSION_DIR}/session.log" +ln -s "${SESSION_DIR}" "${X2GO_ROOT}/C-${SESSION_NAME}" X2GO_AGENT_PID=$! X2GO_AGENT_RETVAL=$? diff --git a/x2goserver/bin/x2goterminate-session b/x2goserver/bin/x2goterminate-session index 8455c2a..64d44f8 100755 --- a/x2goserver/bin/x2goterminate-session +++ b/x2goserver/bin/x2goterminate-session @@ -54,9 +54,6 @@ if kill -TERM $X2GO_AGENT_PID &>/dev/null; then # run x2goserver-extensions for post-terminate x2gofeature X2GO_RUN_EXTENSIONS &>/dev/null && x2goserver-run-extensions "$SESSION_NAME" post-terminate || true - # this makes sure that the socket on localhost blocked by NX agent gets released immediately - $X2GO_LIB_PATH/x2gonxcleanup - else err_msg="ERROR: failed to terminate session with ID $SESSION_NAME" diff --git a/x2goserver/lib/x2gonxcleanup b/x2goserver/lib/x2gonxcleanup deleted file mode 100755 index 81ce580..0000000 --- a/x2goserver/lib/x2gonxcleanup +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/perl - -# Copyright (C) 2014 X2Go Project - http://wiki.x2go.org -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the -# Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. -# -# Copyright (C) 2014 Guangzhou Nianguan Electronics Technology Co.Ltd. <opensource@gznianguan.com> -# Copyright (C) 2014 Mike Gabriel <mike.gabriel@das-netzwerkteam.de> -# - -use strict; -use X2Go::Server qw(get_session_info); -use X2Go::Utils qw(check_x2go_sessionid test_socket_state); - - -my $doRetryCnt = 5; -my $X2GoSID = check_x2go_sessionid; - -my @X2GoSesINFO = get_session_info($X2GoSID); -if (@X2GoSesINFO[1] eq $X2GoSID) { - while ($doRetryCnt > 0) { - $doRetryCnt--; - if (test_socket_state($X2GoSesINFO[8])) { - exit; - } - sleep 1; - } -} -- Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goserver.git