[X2Go-Commits] [x2goserver] 03/03: x2golistsessions(_root): Only update session state in session DB if x2goagent's state file really exists. This addresses a problem that occurs when x2golistsessions gets called via an x2gobroker-agent. The x2golistsessions script may show session states (--all-servers) of sessions on other servers that have session states files on their remote /tmp dirs. These files are not accessible for that x2golistsessions script and should simply be ignored.
git-admin at x2go.org
git-admin at x2go.org
Fri Oct 17 11:33:45 CEST 2014
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository x2goserver.
commit f2ca618e13ef9dbca9a0eba2147908f0301de13a
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Fri Oct 17 11:17:42 2014 +0200
x2golistsessions(_root): Only update session state in session DB if x2goagent's state file really exists. This addresses a problem that occurs when x2golistsessions gets called via an x2gobroker-agent. The x2golistsessions script may show session states (--all-servers) of sessions on other servers that have session states files on their remote /tmp dirs. These files are not accessible for that x2golistsessions script and should simply be ignored.
Conflicts (resolved by Mike Gabriel):
x2goserver/bin/x2golistsessions
x2goserver/sbin/x2golistsessions_root
---
X2Go/Server/Agent/NX.pm | 12 ++++++++++++
debian/changelog | 7 +++++++
x2goserver/bin/x2golistsessions | 4 ++--
x2goserver/sbin/x2golistsessions_root | 4 ++--
4 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/X2Go/Server/Agent/NX.pm b/X2Go/Server/Agent/NX.pm
index 308eff0..eca431c 100644
--- a/X2Go/Server/Agent/NX.pm
+++ b/X2Go/Server/Agent/NX.pm
@@ -71,6 +71,18 @@ sub session_is_running
return 0;
}
+sub has_agent_state_file
+{
+ my $sess=@_[0];
+ my $user=@_[1];
+ my $stateFile = "/tmp/.x2go-".$user."/C-".$sess."/state";
+ if ( -e $stateFile )
+ {
+ return 1;
+ }
+ return 0;
+}
+
sub get_agent_state
{
my $sess=@_[1];
diff --git a/debian/changelog b/debian/changelog
index 85a5ebc..b913469 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -157,6 +157,13 @@ x2goserver (4.0.1.19-0x2go1) UNRELEASED; urgency=medium
- x2gocleansessions: Call x2gormforward also on terminated sessions. This
will make sure that re-assigned ports are really available on new session
startup.
+ - x2golistsessions(_root): Only update session state in session DB if
+ x2goagent's state file really exists. This addresses a problem that occurs
+ when x2golistsessions gets called via an x2gobroker-agent. The
+ x2golistsessions script may show session states (--all-servers) of
+ sessions on other servers that have session states files on their remote
+ /tmp dirs. These files are not accessible for that x2golistsessions script
+ and should simply be ignored. (Fixes: #638).
* debian/control:
+ Add D (x2goserver): libfile-which-perl.
* x2goserver.spec:
diff --git a/x2goserver/bin/x2golistsessions b/x2goserver/bin/x2golistsessions
index 91dedfa..fa21f7b 100755
--- a/x2goserver/bin/x2golistsessions
+++ b/x2goserver/bin/x2golistsessions
@@ -25,7 +25,7 @@ use Sys::Hostname;
use Sys::Syslog qw( :standard :macros );
use X2Go::Server::DB qw(db_listsessions db_listsessions_all db_changestatus);
-use X2Go::Server::Agent qw(session_is_suspended session_is_running);
+use X2Go::Server::Agent qw(session_is_suspended session_is_running has_agent_state_file);
use X2Go::Log qw(loglevel);
use X2Go::Utils qw( system_capture_stdout_output is_true );
@@ -70,7 +70,7 @@ for (my $i=0;$i<@outp;$i++)
{
print "@outp[$i]\n";
}
- else
+ else if (has_agent_state_file(@sinfo[1], @sinfo[11]))
{
if (@sinfo[4]eq 'R')
{
diff --git a/x2goserver/sbin/x2golistsessions_root b/x2goserver/sbin/x2golistsessions_root
index 5cbff3d..87149be 100755
--- a/x2goserver/sbin/x2golistsessions_root
+++ b/x2goserver/sbin/x2golistsessions_root
@@ -25,7 +25,7 @@ use Sys::Syslog qw( :standard :macros );
use X2Go::Log qw(loglevel);
use X2Go::Utils qw(system_capture_stdout_output);
-use X2Go::Server::Agent qw(session_is_suspended);
+use X2Go::Server::Agent qw(session_is_suspended has_agent_state_file);
my $x2go_lib_path = system_capture_stdout_output("x2gopath", "libexec");
openlog($0,'cons,pid','user');
@@ -51,7 +51,7 @@ for (my $i=0;$i<@outp;$i++)
{
print "@outp[$i]\n";
}
- else
+ else if (has_agent_state_file(@sinfo[1], at sinfo[11]))
{
if (@sinfo[4]eq 'R')
{
--
Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
More information about the x2go-commits
mailing list