This is an automated email from the git hooks/post-receive script. x2go pushed a change to branch release/4.0.1.x in repository x2goserver. from b27490f Make x2goruncommand aware of the LXQt desktop shell. new b73480d x2goserver/bin/x2gostartagent: fetch hostname via "hostname -s" and do not rely on the HOSTNAME variable. new 5a74c4b x2goserver/x2gosqlitewrapper.c: fix implicit declaration of execv(). new a3ae80e x2goserver/: backport x2golistshadowsessions. new 989336f x2goserver/bin/x2golistshadowsessions: whitespace only. new 08fc0dc x2goserver/sbin/x2gocleansessions: close syslog at program exit. new fcfed5e x2goserver/sbin/x2gocleansessions: whitespace only. new 0159ba1 x2goserver/bin/x2golistshadowsessions: copy and use a few needed utility functions from x2gocleansessions. new 11bb1d2 x2goserver/bin/x2golistshadowsessions: mark unavailable functionality with FIXME comments. The 8 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Summary of changes: debian/changelog | 13 +++ .../x2golistshadowsessions} | 101 ++++++++++----------- x2goserver/bin/x2gostartagent | 46 +++++++--- x2goserver/man/man8/x2golistshadowsessions.8 | 55 +++++++++++ x2goserver/sbin/x2gocleansessions | 20 ++-- x2goserver/share/x2gofeature.d/x2goserver.features | 1 + x2goserver/x2gosqlitewrapper.c | 2 + 7 files changed, 165 insertions(+), 73 deletions(-) copy x2goserver/{sbin/x2golistsessions_root => bin/x2golistshadowsessions} (68%) create mode 100644 x2goserver/man/man8/x2golistshadowsessions.8 -- Alioth's /srv/git/code.x2go.org/x2goserver.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
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 5a74c4b382910b5657dd9ce6a728a188d19ef8e7 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Wed Oct 11 07:04:32 2017 +0200 x2goserver/x2gosqlitewrapper.c: fix implicit declaration of execv(). --- debian/changelog | 1 + x2goserver/x2gosqlitewrapper.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/debian/changelog b/debian/changelog index e1964a7..69c22ea 100644 --- a/debian/changelog +++ b/debian/changelog @@ -102,6 +102,7 @@ x2goserver (4.0.1.21-0x2go1) UNRELEASED; urgency=medium - x2goserver/bin/x2goruncommand: stop exporting LD_LIBRARY_PATH when using 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(). -- X2Go Release Manager <git-admin@x2go.org> Sun, 20 Nov 2016 12:54:13 +0100 diff --git a/x2goserver/x2gosqlitewrapper.c b/x2goserver/x2gosqlitewrapper.c index ebcc171..a19f28f 100644 --- a/x2goserver/x2gosqlitewrapper.c +++ b/x2goserver/x2gosqlitewrapper.c @@ -21,6 +21,8 @@ * */ +#include <unistd.h> + int main( int argc, char *argv[] ) { char x2gosqlitewrapper[] = TRUSTED_BINARY; -- Alioth's /srv/git/code.x2go.org/x2goserver.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
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 b73480d381289b8fa8a4ae024f0f2a64b0e44928 Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Oct 11 06:56:07 2017 +0200 x2goserver/bin/x2gostartagent: fetch hostname via "hostname -s" and do not rely on the HOSTNAME variable. The latter is only set automatically by bash if it's not already part of the environment. We might get "garbage" in this way (and one user actually did.) --- debian/changelog | 4 ++++ x2goserver/bin/x2gostartagent | 46 ++++++++++++++++++++++++++++++++----------- 2 files changed, 39 insertions(+), 11 deletions(-) diff --git a/debian/changelog b/debian/changelog index 61051c9..e1964a7 100644 --- a/debian/changelog +++ b/debian/changelog @@ -29,6 +29,10 @@ x2goserver (4.0.1.21-0x2go1) UNRELEASED; urgency=medium loginctl utility before calling x2goagent. Fixes: #1198. - x2goserver-xsession/etc/Xsession: support Devuan just like Debian, give useful error message in case the OS is unknown. + - x2goserver/bin/x2gostartagent: fetch hostname via "hostname -s" and do + not rely on the HOSTNAME variable. The latter is only set automatically + by bash if it's not already part of the environment. We might get + "garbage" in this way (and one user actually did.) * x2goserver.spec: - Add mandatory perl-generators Build-Requires as per https://fedoraproject.org/wiki/Changes/Build_Root_Without_Perl diff --git a/x2goserver/bin/x2gostartagent b/x2goserver/bin/x2gostartagent index 5ac265c..96783e7 100755 --- a/x2goserver/bin/x2gostartagent +++ b/x2goserver/bin/x2gostartagent @@ -119,6 +119,31 @@ elif ! echo $HOME | iconv -f ASCII -t ASCII 1>/dev/null 2>/dev/null; then exit -5 fi +# ${HOSTNAME} should be automatically set by bash via gethostname(2), IFF this +# variable is not already set in the environment. +# +# This leads to two problems: +# - export HOSTNAME="malbox"; x2gostartagent will override the actual system +# host name and lead to authorization failures when connecting to +# x2goagent/nxagent later on. +# - even if the above is not the case, the value returned by gethostname(2) +# could either be a FQDN, the short name or anything in between. glibc +# seems to return the short name on Linux, since it calls uname(2), which +# typically does not include a domain, but *BSD seems to default to +# the FQDN. We explicitly need the short name. +# +# Workaround: use hostname -s, which luckily is portable enough to be available +# on a wide variety of systems. +typeset current_host_name="" +current_host_name="$(hostname -s)" + +if [[ "${?}" -ne "0" ]]; then + typeset msg="Unable to retrieve machine's hostname. This is required. Aborting session startup." + echo "${msg}" + "${X2GO_LIB_PATH}/x2gosyslog" "${0}" "err" "${msg}" + exit 1 +fi + X2GO_ROOT="${HOME}/.x2go" export NX_ROOT=$X2GO_ROOT @@ -204,8 +229,8 @@ if [ "$X2GO_STYPE" == "S" ]; then X2GO_PORT=`echo $OUTPUT | awk '{print $1}'` $X2GO_LIB_PATH/x2gosyslog "$0" "debug" "received shadow session information: cookie: $X2GO_COOKIE, port: $X2GO_PORT" - xauth -f "$XAUTHORITY" add "${HOSTNAME}/unix:${X2GO_PORT}" MIT-MAGIC-COOKIE-1 "${X2GO_COOKIE}" - xauth -f "$XAUTHORITY" add "${HOSTNAME}:${X2GO_PORT}" MIT-MAGIC-COOKIE-1 "${X2GO_COOKIE}" + xauth -f "$XAUTHORITY" add "${current_host_name}/unix:${X2GO_PORT}" MIT-MAGIC-COOKIE-1 "${X2GO_COOKIE}" + xauth -f "$XAUTHORITY" add "${current_host_name}:${X2GO_PORT}" MIT-MAGIC-COOKIE-1 "${X2GO_COOKIE}" echo $X2GO_PORT echo $X2GO_COOKIE @@ -246,7 +271,7 @@ elif [ "$X2GO_STYPE" == "S" ]; then fi if [ "$X2GO_CLIENT" == "" ]; then - X2GO_CLIENT="$HOSTNAME" + X2GO_CLIENT="${current_host_name}" fi # define the full path to the ss utility @@ -255,11 +280,11 @@ ss=$(PATH="$PATH:/usr/sbin:/sbin" type -P ss); while [ "$OUTPUT" != "inserted" ]; do typeset -a used_displays - IFS='' read -ar used_displays < <("${X2GO_LIB_PATH}/x2gogetdisplays" "${HOSTNAME}") + IFS='' read -ar used_displays < <("${X2GO_LIB_PATH}/x2gogetdisplays" "${current_host_name}") #Get all used in system ports from X2Go database and ss output USED_PORTS=$( - "$X2GO_LIB_PATH/x2gogetports" "$HOSTNAME"; + "$X2GO_LIB_PATH/x2gogetports" "${current_host_name}"; "$ss" -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])} }'; ); @@ -307,7 +332,7 @@ while [ "$OUTPUT" != "inserted" ]; do # sanitize session name SESSION_NAME=`echo "$SESSION_NAME" | perl -pe "s/[^a-zA-Z0-9\.\_\-\@]//g"` - OUTPUT=`$X2GO_LIB_PATH/x2goinsertsession "$X2GO_PORT" "$HOSTNAME" "$SESSION_NAME"` + OUTPUT=`$X2GO_LIB_PATH/x2goinsertsession "$X2GO_PORT" "${current_host_name}" "$SESSION_NAME"` fi done @@ -319,7 +344,7 @@ while [ "$GR_PORT" == "" ] || [ "$SOUND_PORT" == "" ] || [ "$FS_PORT" == "" ]; d #Get all used in system ports from X2Go database and ss output USED_PORTS=$( - "$X2GO_LIB_PATH/x2gogetports" "$HOSTNAME"; + "$X2GO_LIB_PATH/x2gogetports" "${current_host_name}"; "$ss" -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])} }'; ); @@ -330,7 +355,7 @@ while [ "$GR_PORT" == "" ] || [ "$SOUND_PORT" == "" ] || [ "$FS_PORT" == "" ]; d #check if port in /etc/services SERV=`grep $SSH_PORT /etc/services` if [ "$SERV" == "" ]; then - OUTPUT=`$X2GO_LIB_PATH/x2goinsertport "$HOSTNAME" "$SESSION_NAME" "$SSH_PORT"` + OUTPUT=`$X2GO_LIB_PATH/x2goinsertport "${current_host_name}" "$SESSION_NAME" "$SSH_PORT"` fi done @@ -402,13 +427,12 @@ grep PPid /proc/$PPID/status > ${SESSION_DIR}/sshd.pid X2GO_COOKIE=`mcookie` - PATH="${PATH}:${X2GO_BIN}/" export PATH -xauth -f "$XAUTHORITY" add "${HOSTNAME}/unix:${X2GO_PORT}" MIT-MAGIC-COOKIE-1 "${X2GO_COOKIE}" -xauth -f "$XAUTHORITY" add "${HOSTNAME}:${X2GO_PORT}" MIT-MAGIC-COOKIE-1 "${X2GO_COOKIE}" +xauth -f "$XAUTHORITY" add "${current_host_name}/unix:${X2GO_PORT}" MIT-MAGIC-COOKIE-1 "${X2GO_COOKIE}" +xauth -f "$XAUTHORITY" add "${current_host_name}:${X2GO_PORT}" MIT-MAGIC-COOKIE-1 "${X2GO_COOKIE}" option_geometry="" -- Alioth's /srv/git/code.x2go.org/x2goserver.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
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
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 989336f08271d8d390147010ee62679b65d2ccd6 Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Oct 11 07:41:32 2017 +0200 x2goserver/bin/x2golistshadowsessions: whitespace only. --- debian/changelog | 1 + x2goserver/bin/x2golistshadowsessions | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 6960bca..2564a44 100644 --- a/debian/changelog +++ b/debian/changelog @@ -33,6 +33,7 @@ x2goserver (4.0.1.21-0x2go1) UNRELEASED; urgency=medium not rely on the HOSTNAME variable. The latter is only set automatically by bash if it's not already part of the environment. We might get "garbage" in this way (and one user actually did.) + - x2goserver/bin/x2golistshadowsessions: whitespace only. * x2goserver.spec: - Add mandatory perl-generators Build-Requires as per https://fedoraproject.org/wiki/Changes/Build_Root_Without_Perl diff --git a/x2goserver/bin/x2golistshadowsessions b/x2goserver/bin/x2golistshadowsessions index baba045..404dff1 100755 --- a/x2goserver/bin/x2golistshadowsessions +++ b/x2goserver/bin/x2golistshadowsessions @@ -25,7 +25,7 @@ use Sys::Hostname; use Sys::Syslog qw( :standard :macros ); use lib `x2gopath lib`; -use x2godbwrapper; +use x2godbwrapper; use x2gologlevel; my $x2go_lib_path = `x2gopath libexec`; @@ -67,7 +67,7 @@ for (my $i=0;$i<@outp;$i++) print "@outp[$i]\n"; } else - { + { if (@sinfo[4]eq 'R') { my $shadow_user = @sinfo[1]; @@ -83,5 +83,5 @@ for (my $i=0;$i<@outp;$i++) } } -# closing syslog +# closing syslog closelog; -- Alioth's /srv/git/code.x2go.org/x2goserver.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
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 11bb1d21a5f8b36fab2e4a65af7dbe1ef4b9f0eb Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Oct 11 08:12:01 2017 +0200 x2goserver/bin/x2golistshadowsessions: mark unavailable functionality with FIXME comments. --- debian/changelog | 2 ++ x2goserver/bin/x2golistshadowsessions | 2 ++ 2 files changed, 4 insertions(+) diff --git a/debian/changelog b/debian/changelog index 23a986d..b758c11 100644 --- a/debian/changelog +++ b/debian/changelog @@ -38,6 +38,8 @@ x2goserver (4.0.1.21-0x2go1) UNRELEASED; urgency=medium - x2goserver/sbin/x2gocleansessions: whitespace only. - x2goserver/bin/x2golistshadowsessions: copy and use a few needed utility functions from x2gocleansessions. + - x2goserver/bin/x2golistshadowsessions: mark unavailable functionality + with FIXME comments. * x2goserver.spec: - Add mandatory perl-generators Build-Requires as per https://fedoraproject.org/wiki/Changes/Build_Root_Without_Perl diff --git a/x2goserver/bin/x2golistshadowsessions b/x2goserver/bin/x2golistshadowsessions index 8a90833..1382799 100755 --- a/x2goserver/bin/x2golistshadowsessions +++ b/x2goserver/bin/x2golistshadowsessions @@ -89,10 +89,12 @@ if( ! $serv) my @outp; if($serv eq "--all-servers") { + # FIXME: this also needs a backport to work. @outp=db_listshadowsessions_all(); } else { + # FIXME: this also needs a backport to work. @outp=db_listshadowsessions($serv); } -- Alioth's /srv/git/code.x2go.org/x2goserver.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
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 08fc0dc925b142b35d661361bfb0cfea46bd834a Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Oct 11 07:42:41 2017 +0200 x2goserver/sbin/x2gocleansessions: close syslog at program exit. --- debian/changelog | 1 + x2goserver/sbin/x2gocleansessions | 3 +++ 2 files changed, 4 insertions(+) diff --git a/debian/changelog b/debian/changelog index 2564a44..6775b6a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -34,6 +34,7 @@ x2goserver (4.0.1.21-0x2go1) UNRELEASED; urgency=medium by bash if it's not already part of the environment. We might get "garbage" in this way (and one user actually did.) - x2goserver/bin/x2golistshadowsessions: whitespace only. + - x2goserver/sbin/x2gocleansessions: close syslog at program exit. * x2goserver.spec: - Add mandatory perl-generators Build-Requires as per https://fedoraproject.org/wiki/Changes/Build_Root_Without_Perl diff --git a/x2goserver/sbin/x2gocleansessions b/x2goserver/sbin/x2gocleansessions index fb4321d..2d01341 100755 --- a/x2goserver/sbin/x2gocleansessions +++ b/x2goserver/sbin/x2gocleansessions @@ -129,6 +129,7 @@ sub get_agent_state sub catch_term { unlink("/var/run/x2goserver.pid"); + closelog; exit; } @@ -138,12 +139,14 @@ my $pid = fork(); if (not defined $pid) { print "resources not avilable.\n"; + closelog; } elsif ($pid != 0) { open (F,">/var/run/x2goserver.pid"); print F "$pid\n"; close(F); + closelog; } elsif ($pid == 0 ) { -- Alioth's /srv/git/code.x2go.org/x2goserver.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
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 0159ba1519b4f02b90668f784dc281b31e64a50b Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Oct 11 08:11:07 2017 +0200 x2goserver/bin/x2golistshadowsessions: copy and use a few needed utility functions from x2gocleansessions. --- debian/changelog | 2 ++ x2goserver/bin/x2golistshadowsessions | 41 ++++++++++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 287c85f..23a986d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -36,6 +36,8 @@ x2goserver (4.0.1.21-0x2go1) UNRELEASED; urgency=medium - x2goserver/bin/x2golistshadowsessions: whitespace only. - x2goserver/sbin/x2gocleansessions: close syslog at program exit. - x2goserver/sbin/x2gocleansessions: whitespace only. + - x2goserver/bin/x2golistshadowsessions: copy and use a few needed utility + functions from x2gocleansessions. * x2goserver.spec: - Add mandatory perl-generators Build-Requires as per https://fedoraproject.org/wiki/Changes/Build_Root_Without_Perl diff --git a/x2goserver/bin/x2golistshadowsessions b/x2goserver/bin/x2golistshadowsessions index 404dff1..8a90833 100755 --- a/x2goserver/bin/x2golistshadowsessions +++ b/x2goserver/bin/x2golistshadowsessions @@ -33,6 +33,45 @@ my $x2go_lib_path = `x2gopath libexec`; openlog($0,'cons,pid','user'); setlogmask( LOG_UPTO(x2gologlevel()) ); +sub get_agent_state +{ + my $sess=@_[0]; + my $user; + + if ( $sess =~ m/.*-[0-9]{2,}-[0-9]{10,}_stS(0|1)XSHAD.*XSHADPP.*/ ) { + my $shadow_user = $sess; + $shadow_user =~ s/.*XSHAD(.*)XSHADPP.*/$1/; + $user = $shadow_user; + } else { + $user=@_[1]; + } + + my $state; + my $stateFile = "/tmp/.x2go-".$user."/C-".$sess."/state"; + if (! -e $stateFile ) + { + syslog('warning', "$sess: state file for this session does not exist: $stateFile (this can be ignored during session startups)"); + $state = "UNKNOWN"; + } + else + { + open(F,"<$stateFile"); + $state=<F>; + close(F); + } + return $state; +} + +sub is_suspended +{ + my $state=get_agent_state(@_); + if(($state eq 'SUSPENDING')||($state eq 'SUSPENDED')) + { + return 1; + } + return 0; +} + if ( @ARGV ) { syslog('info', "x2golistshadowsessions has been called with options: @ARGV"); } else { @@ -72,7 +111,7 @@ for (my $i=0;$i<@outp;$i++) { my $shadow_user = @sinfo[1]; $shadow_user =~ s/.*XSHAD(.*)XSHADPP.*/$1/; - if(session_is_suspended(@sinfo[1], $shadow_user)) + if(is_suspended(@sinfo[1], $shadow_user)) { db_changestatus( 'S', @sinfo[1] ); @outp[$i] =~ s/\|R\|/\|S\|/; -- Alioth's /srv/git/code.x2go.org/x2goserver.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goserver.git
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 fcfed5e287d4e83e2904b12f7a1f5b6529a0c420 Author: Mihai Moldovan <ionic@ionic.de> Date: Wed Oct 11 08:02:52 2017 +0200 x2goserver/sbin/x2gocleansessions: whitespace only. --- debian/changelog | 1 + x2goserver/sbin/x2gocleansessions | 17 ++++++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/debian/changelog b/debian/changelog index 6775b6a..287c85f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -35,6 +35,7 @@ x2goserver (4.0.1.21-0x2go1) UNRELEASED; urgency=medium "garbage" in this way (and one user actually did.) - x2goserver/bin/x2golistshadowsessions: whitespace only. - x2goserver/sbin/x2gocleansessions: close syslog at program exit. + - x2goserver/sbin/x2gocleansessions: whitespace only. * x2goserver.spec: - Add mandatory perl-generators Build-Requires as per https://fedoraproject.org/wiki/Changes/Build_Root_Without_Perl diff --git a/x2goserver/sbin/x2gocleansessions b/x2goserver/sbin/x2gocleansessions index 2d01341..721ea62 100755 --- a/x2goserver/sbin/x2gocleansessions +++ b/x2goserver/sbin/x2gocleansessions @@ -88,12 +88,12 @@ sub is_suspended sub is_running { - my $state=get_agent_state(@_); - if(($state eq 'STARTING')||($state eq 'RESUMING')||($state eq 'RUNNING')) - { - return 1; - } - return 0; + my $state=get_agent_state(@_); + if(($state eq 'STARTING')||($state eq 'RESUMING')||($state eq 'RUNNING')) + { + return 1; + } + return 0; } sub get_agent_state @@ -136,12 +136,12 @@ sub catch_term my $uname; my $serv = hostname; my $pid = fork(); -if (not defined $pid) +if (not defined $pid) { print "resources not avilable.\n"; closelog; } -elsif ($pid != 0) +elsif ($pid != 0) { open (F,">/var/run/x2goserver.pid"); print F "$pid\n"; @@ -397,4 +397,3 @@ This manual has been written by Mike Gabriel <mike.gabriel@das-netzwerkteam.de> for the X2Go project (http://www.x2go.org). =cut - -- Alioth's /srv/git/code.x2go.org/x2goserver.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goserver.git