[pkg-remote-commits] [x2goserver] 01/06: debian/patches: Update 1002_backport-x2golistshadowsessions.patch. Add missing database function.
Mike Gabriel
sunweaver at debian.org
Wed Oct 25 23:43:34 UTC 2017
This is an automated email from the git hooks/post-receive script.
sunweaver pushed a commit to branch master
in repository x2goserver.
commit 1c6cc60e72fdc0a04f47b9382bd077cf56201e23
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Thu Oct 26 01:05:46 2017 +0200
debian/patches: Update 1002_backport-x2golistshadowsessions.patch. Add missing database function.
---
.../1002_backport-x2golistshadowsessions.patch | 117 +++++++++++++++++++++
1 file changed, 117 insertions(+)
diff --git a/debian/patches/1002_backport-x2golistshadowsessions.patch b/debian/patches/1002_backport-x2golistshadowsessions.patch
index d82b3c4..29797e8 100644
--- a/debian/patches/1002_backport-x2golistshadowsessions.patch
+++ b/debian/patches/1002_backport-x2golistshadowsessions.patch
@@ -160,3 +160,120 @@ Comment:
"X2GO_MOUNT_UNCPATHS") echo "ok"; exit 0;;
"X2GO_CLIPBOARD_MODES") echo "ok"; exit 0;;
*) exit -1;;
+--- a/x2goserver/lib/x2godbwrapper.pm
++++ b/x2goserver/lib/x2godbwrapper.pm
+@@ -674,3 +674,63 @@
+ return split("\n",`$x2go_lib_path/x2gosqlitewrapper listsessions_all`);
+ }
+ }
++
++sub db_listshadowsessions
++{
++ my $server=shift or die "argument \"server\" missed";
++ if ($backend eq 'postgres')
++ {
++ my @strings;
++ my $dbh=DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbuser", "$dbpass",{AutoCommit => 1}) or die $_;
++ my $sth=$dbh->prepare("select agent_pid, session_id, display, server, status,
++ to_char(init_time,'YYYY-MM-DD\"T\"HH24:MI:SS'), cookie, client, gr_port,
++ sound_port, to_char( last_time, 'YYYY-MM-DD\"T\"HH24:MI:SS'), uname,
++ to_char(now()- init_time,'SSSS'), fs_port from sessions_view
++ where status !='F' and server='$server' and
++ (session_id is like '%XSHAD%') order by status desc");
++ $sth->execute() or die;
++ my @data;
++ my $i=0;
++ while (@data = $sth->fetchrow_array)
++ {
++ @strings[$i++]=join('|', at data);
++ }
++ $sth->finish();
++ undef $dbh;
++ return @strings;
++ }
++ if ($backend eq 'sqlite')
++ {
++ return split("\n",`$x2go_lib_path/x2gosqlitewrapper listshadowsessions $server`);
++ }
++}
++
++sub db_listshadowsessions_all
++{
++ if($backend eq 'postgres')
++ {
++ my @strings;
++ my $dbh=DBI->connect("dbi:Pg:dbname=$db;host=$host;port=$port;sslmode=$sslmode", "$dbuser", "$dbpass",{AutoCommit => 1}) or die $_;
++ my $sth=$dbh->prepare("select agent_pid, session_id, display, server, status,
++ to_char(init_time,'YYYY-MM-DD\"T\"HH24:MI:SS'), cookie, client, gr_port,
++ sound_port, to_char( last_time, 'YYYY-MM-DD\"T\"HH24:MI:SS'), uname,
++ to_char(now()- init_time,'SSSS'), fs_port from sessions_view
++ where status !='F' and
++ (session_id is like '%XSHAD%') order by status desc");
++ $sth->execute()or die;
++ my @data;
++ my $i=0;
++ while (@data = $sth->fetchrow_array)
++ {
++ @strings[$i++]=join('|', at data);
++ }
++ $sth->finish();
++ undef $dbh;
++ return @strings;
++ }
++ if ($backend eq 'sqlite')
++ {
++ return split("\n",`$x2go_lib_path/x2gosqlitewrapper listshadowsessions_all`);
++ }
++}
++
+--- a/x2goserver/lib/x2gosqlitewrapper.pl
++++ b/x2goserver/lib/x2gosqlitewrapper.pl
+@@ -509,6 +509,48 @@
+ }
+ fetchrow_printall_array($sth);
+ }
++
++elsif($cmd eq "listshadowsessions")
++{
++ my $server=shift or die "argument \"server\" missed";
++ my @strings;
++ my $sth=$dbh->prepare("select agent_pid, session_id, display, server, status,
++ strftime('%Y-%m-%dT%H:%M:%S',init_time),
++ cookie,client,gr_port,sound_port,
++ strftime('%Y-%m-%dT%H:%M:%S',last_time),
++ uname,
++ strftime('%s','now','localtime') - strftime('%s',init_time),fs_port from sessions
++ where status !='F' and server=? and uname=?
++ and ( session_id like '%XSHAD%') order by status desc");
++ $sth->execute($server, $realuser);
++ if ($sth->err())
++ {
++ syslog('error', "listshadowsessions (SQLite3 session db backend) failed with exitcode: $sth->err()");
++ die();
++ }
++ fetchrow_printall_array($sth);
++}
++
++elsif($cmd eq "listshadowsessions_all")
++{
++ my @strings;
++ my $sth=$dbh->prepare("select agent_pid, session_id, display, server, status,
++ strftime('%Y-%m-%dT%H:%M:%S',init_time),
++ cookie,client,gr_port,sound_port,
++ strftime('%Y-%m-%dT%H:%M:%S',last_time),
++ uname,
++ strftime('%s','now','localtime') - strftime('%s',init_time),fs_port from sessions
++ where status !='F' and uname=? and ( session_id like '%XSHAD%') order by status desc");
++
++ $sth->execute($realuser);
++ if ($sth->err())
++ {
++ syslog('error', "listshadowsessions_all (SQLite3 session db backend) failed with exitcode: $sth->err()");
++ die();
++ }
++ fetchrow_printall_array($sth);
++}
++
+ else
+ {
+ print "unknown command $cmd\n";
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-remote/x2goserver.git
More information about the pkg-remote-commits
mailing list