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 a3ae80e14483ba551a8b654e24d5031c6ba78942 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Wed Oct 11 07:25:48 2017 +0200 x2goserver/: backport x2golistshadowsessions. --- debian/changelog | 1 + x2goserver/bin/x2golistshadowsessions | 87 ++++++++++++++++++++++ x2goserver/man/man8/x2golistshadowsessions.8 | 55 ++++++++++++++ x2goserver/share/x2gofeature.d/x2goserver.features | 1 + 4 files changed, 144 insertions(+) diff --git a/debian/changelog b/debian/changelog index 69c22ea..6960bca 100644 --- a/debian/changelog +++ b/debian/changelog @@ -103,6 +103,7 @@ x2goserver (4.0.1.21-0x2go1) UNRELEASED; urgency=medium Arctica's nx-libs and its new Xinerama feature. Fixes: #1153. - Make x2goruncommand aware of the LXQt desktop shell. - x2goserver/x2gosqlitewrapper.c: fix implicit declaration of execv(). + - x2goserver/: backport x2golistshadowsessions. -- X2Go Release Manager <git-admin@x2go.org> Sun, 20 Nov 2016 12:54:13 +0100 diff --git a/x2goserver/bin/x2golistshadowsessions b/x2goserver/bin/x2golistshadowsessions new file mode 100755 index 0000000..baba045 --- /dev/null +++ b/x2goserver/bin/x2golistshadowsessions @@ -0,0 +1,87 @@ +#!/usr/bin/perl + +# Copyright (C) 2007-2015 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) 2007-2015 Oleksandr Shneyder <oleksandr.shneyder@obviously-nice.de> +# Copyright (C) 2007-2015 Heinz-Markus Graesing <heinz-m.graesing@obviously-nice.de> + +use strict; +use Sys::Hostname; +use Sys::Syslog qw( :standard :macros ); + +use lib `x2gopath lib`; +use x2godbwrapper; +use x2gologlevel; + +my $x2go_lib_path = `x2gopath libexec`; + +openlog($0,'cons,pid','user'); +setlogmask( LOG_UPTO(x2gologlevel()) ); + +if ( @ARGV ) { + syslog('info', "x2golistshadowsessions has been called with options: @ARGV"); +} else { + # hiding normal x2golistshadowsessions calls into debug loglevel + syslog('debug', "x2golistshadowsessions has been called with no option"); +} + + +my $serv=shift; +if( ! $serv) +{ + $serv=hostname; +} + +my @outp; +if($serv eq "--all-servers") +{ + @outp=db_listshadowsessions_all(); +} +else +{ + @outp=db_listshadowsessions($serv); +} + +for (my $i=0;$i<@outp;$i++) +{ + @outp[$i] =~ s/ //g; + @outp[$i] =~ s/\*/ /g; + my @sinfo=split('\\|',"@outp[$i]"); + if (@sinfo[4]eq 'F') + { + print "@outp[$i]\n"; + } + else + { + if (@sinfo[4]eq 'R') + { + my $shadow_user = @sinfo[1]; + $shadow_user =~ s/.*XSHAD(.*)XSHADPP.*/$1/; + if(session_is_suspended(@sinfo[1], $shadow_user)) + { + db_changestatus( 'S', @sinfo[1] ); + @outp[$i] =~ s/\|R\|/\|S\|/; + system("x2goumount-session","@sinfo[1]"); + } + } + print "@outp[$i]\n"; + } +} + +# closing syslog +closelog; diff --git a/x2goserver/man/man8/x2golistshadowsessions.8 b/x2goserver/man/man8/x2golistshadowsessions.8 new file mode 100644 index 0000000..5581d8b --- /dev/null +++ b/x2goserver/man/man8/x2golistshadowsessions.8 @@ -0,0 +1,55 @@ +'\" -*- coding: utf-8 -*- +.if \n(.g .ds T< \\FC +.if \n(.g .ds T> \\F[\n[.fam]] +.de URL +\\$2 \(la\\$1\(ra\\$3 +.. +.if \n(.g .mso www.tmac +.TH x2golistshadowsessions 8 "Jun 2014" "Version 4.1.0.0-preview" "X2Go Server Tool" +.SH NAME +x2golistshadowsessions \- List Available X2Go Shadow Sessions for User +.SH SYNOPSIS +'nh +.fi +.ad l +x2golistshadowsessions [\fI<server_hostname>\fR|\fI--all-servers\fR] + +.SH DESCRIPTION +\fBx2golistshadowsessions\fR returns a list of running or suspended X2Go shadow sessions +(sessions that provide the X2Go Desktop Sharing feature) for X2Go server \fI<server_hostname>\fR. +If no server hostname is given at the command line, the shadow session list query runs for the local system. +.PP +\fBx2golistshadowsessions\fR is run with normal user privileges and it is used by X2Go clients to render +a list of available X2Go shadow sessions. +.SH X2GO CLUSTER MODE +If \fBx2golistshadowsessions\fR is executed with the \fI--all-servers\fR option then the central database +of your X2Go cluster is queried for running/suspended shadow sessions belonging to the user executing this command. +These sessions may be active on any of the X2Go servers within your cluster. +.SH RETURN VALUES +A line-by-line list of available X2Go sessions. Each line consists of several session attribute fields separated by the pipe +symbol (,,|''). +.PP +The meaning of the session attributes of each output line are shown below: + + field 01: \fI<agent_pid>\fR + field 02: \fI<session_id>\fR + field 03: \fI<port>\fR + field 04: \fI<host>\fR + field 05: \fI<state>\fR + field 06: \fI<init_time>\fR + field 07: \fI<session_cookie>\fR + field 08: \fI<client_ip>\fR + field 09: \fI<gr_port>\fR + field 10: \fI<snd_port>\fR + field 11: \fI<last_time>\fR + field 12: \fI<user>\fR + field 13: \fI<age_in_secs>\fR + field 14: \fI<sshfs_port>\fR + +.PP +As exitcode \fBx2golistshadowsessions\fR always returns 0. +.SH SEE ALSO +x2golistsessions(8), x2golistdesktops(8), x2goresume-session(8), x2gosuspend-session(8), x2goterminate-session(8) +.SH AUTHOR +This manual has been written by Mike Gabriel <mike.gabriel@das-netzwerkteam.de> for the X2Go project +(http://www.x2go.org). diff --git a/x2goserver/share/x2gofeature.d/x2goserver.features b/x2goserver/share/x2gofeature.d/x2goserver.features index 87c1a01..d8e498f 100755 --- a/x2goserver/share/x2gofeature.d/x2goserver.features +++ b/x2goserver/share/x2gofeature.d/x2goserver.features @@ -36,6 +36,7 @@ case "$X2GO_FEATURE" in "X2GO_PUBLISHED_APPLICATIONS") echo "ok"; exit 0;; "X2GO_SERVERSIDE_DESKTOPCOMMANDS") echo "ok"; exit 0;; "X2GO_SET_KEYBOARD") echo "ok"; exit 0;; + "X2GO_LIST_SHADOWSESSIONS") echo "ok"; exit 0;; "X2GO_MOUNT_UNCPATHS") echo "ok"; exit 0;; "X2GO_CLIPBOARD_MODES") echo "ok"; exit 0;; *) exit -1;; -- Alioth's /srv/git/code.x2go.org/x2goserver.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goserver.git