[X2Go-Commits] x2goserver.git - build-main (branch) updated: 3.1.0.1-15-g76d0c2f
X2Go dev team
git-admin at x2go.org
Wed Dec 4 06:18:14 CET 2013
The branch, build-main has been updated
via 76d0c2fb0339c299f8f9dbaa617e82439cd8dbd6 (commit)
from 28a8cbe306d40da954e8ec21cbba2b289872b575 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
-----------------------------------------------------------------------
Summary of changes:
debian/changelog | 2 +
x2goserver/lib/x2gosqlitewrapper.pl | 91 ++++++++++++++++++++++++++++-------
2 files changed, 76 insertions(+), 17 deletions(-)
The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index 8a87290..2e42dad 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,8 @@ x2goserver (3.1.1.0-0~x2go1) UNRELEASED; urgency=low
by X2Go client applications to retrieve a list of server-side
supported X2Go features.
- Update date and version number in man pages.
+ - Add syslogging to SQLite3 session DB backend for occuring
+ DB failures.
* Remove /etc/x2go/applications on package removal if it is a
symlink, keep it, if it is a directory. Remove /etc/x2go
(if empty after purge) on package purge.
diff --git a/x2goserver/lib/x2gosqlitewrapper.pl b/x2goserver/lib/x2gosqlitewrapper.pl
index 1e3b7e3..32e0b7b 100755
--- a/x2goserver/lib/x2gosqlitewrapper.pl
+++ b/x2goserver/lib/x2gosqlitewrapper.pl
@@ -23,6 +23,9 @@
use strict;
use DBI;
use POSIX;
+use Sys::Syslog qw( :standard :macros );
+use lib `echo -n \$(x2gobasepath)/lib/x2go`;
+use x2gologlevel;
# retrieve home dir of x2gouser
my $x2gouser='x2gouser';
@@ -36,13 +39,17 @@ my $realuser=$uname;
my $dbh=DBI->connect("dbi:SQLite:dbname=$dbfile","","",{AutoCommit => 1}) or die $_;
my $cmd=shift or die "command not specified";
+my $rc=0
if($cmd eq "rmsessionsroot")
{
checkroot();
my $sid=shift or die "argument \"session_id\" missed";
my $sth=$dbh->prepare("delete from sessions where session_id=?");
- $sth->execute($sid)or die;
+ $rc = $sth->execute($sid) or {
+ syslog('error', "rmsessionsroot (SQLite3 session db backend) failed with exitcode: $rc");
+ die;
+ }
$sth->finish();
}
@@ -58,7 +65,10 @@ elsif($cmd eq "listsessionsroot")
uname,
strftime('%s','now','localtime') - strftime('%s',init_time),fs_port from sessions
where server=? order by status desc");
- $sth->execute($server) or die;
+ $rc = $sth->execute($server) or {
+ syslog('error', "listsessionsroot (SQLite3 session db backend) failed with exitcode: $rc");
+ die;
+ }
fetchrow_printall_array($sth);
}
@@ -73,7 +83,10 @@ elsif($cmd eq "listsessionsroot_all")
uname,
strftime('%s','now','localtime') - strftime('%s',init_time),fs_port from sessions
order by status desc");
- $sth->execute()or die;
+ $rc = $sth->execute() or {
+ syslog('error', "listsessionsroot_all (SQLite3 session db backend) failed with exitcode: $rc");
+ die;
+ }
fetchrow_printall_array($sth);
}
@@ -83,7 +96,10 @@ elsif($cmd eq "getmounts")
check_user($sid);
my @strings;
my $sth=$dbh->prepare("select client, path from mounts where session_id=?");
- $sth->execute($sid)or die;
+ $rc = $sth->execute($sid) or {
+ syslog('error', "getmounts (SQLite3 session db backend) failed with exitcode: $rc");
+ die;
+ }
fetchrow_printall_array($sth);
}
@@ -93,7 +109,10 @@ elsif($cmd eq "deletemount")
my $path=shift or die "argument \"path\" missed";
check_user($sid);
my $sth=$dbh->prepare("delete from mounts where session_id=? and path=?");
- $sth->execute($sid, $path);
+ $rc = $sth->execute($sid, $path) or {
+ syslog('error', "deletemount (SQLite3 session db backend) failed with exitcode: $rc");
+ die;
+ }
$sth->finish();
}
@@ -108,6 +127,8 @@ elsif($cmd eq "insertmount")
if(!$sth->err())
{
print "ok";
+ } else {
+ syslog('debug', "insertmount (SQLite3 session db backend) failed with exitcode: $rc, this issue will be interpreted as: SSHFS share already mounted");
}
$sth->finish();
}
@@ -137,7 +158,10 @@ elsif($cmd eq "createsession")
check_user($sid);
my $sth=$dbh->prepare("update sessions set status='R',last_time=datetime('now','localtime'),cookie=?,agent_pid=?,
client=?,gr_port=?,sound_port=?,fs_port=? where session_id=? and uname=?");
- $sth->execute($cookie, $pid, $client, $gr_port, $snd_port, $fs_port, $sid, $realuser)or die;
+ $sth->execute($cookie, $pid, $client, $gr_port, $snd_port, $fs_port, $sid, $realuser) or {
+ syslog('error', "createsession (SQLite3 session db backend) failed with exitcode: $rc");
+ die;
+ }
$sth->finish();
print "ok";
}
@@ -149,7 +173,10 @@ elsif($cmd eq "insertport")
my $sshport=shift or die "argument \"port\" missed";
my $sth=$dbh->prepare("insert into used_ports (server,session_id,port) values (?, ?, ?)");
check_user($sid);
- $sth->execute($server, $sid, $sshport) or die;
+ $sth->execute($server, $sid, $sshport) or {
+ syslog('error', "insertport (SQLite3 session db backend) failed with exitcode: $rc");
+ die;
+ }
$sth->finish();
}
@@ -160,7 +187,10 @@ elsif($cmd eq "rmport")
my $sshport=shift or die "argument \"port\" missed";
my $sth=$dbh->prepare("delete from used_ports where server=? and session_id=? and port=?");
check_user($sid);
- $sth->execute($server, $sid, $sshport) or die;
+ $sth->execute($server, $sid, $sshport) or {
+ syslog('error', "rmport (SQLite3 session db backend) failed with exitcode: $rc");
+ die;
+ }
$sth->finish();
}
@@ -174,7 +204,10 @@ elsif($cmd eq "resume")
check_user($sid);
my $sth=$dbh->prepare("update sessions set last_time=datetime('now','localtime'),status='R',
client=?,gr_port=?,sound_port=?,fs_port=? where session_id = ? and uname=?");
- $sth->execute($client, $gr_port, $sound_port, $fs_port, $sid, $realuser) or die;
+ $sth->execute($client, $gr_port, $sound_port, $fs_port, $sid, $realuser) or {
+ syslog('error', "resume (SQLite3 session db backend) failed with exitcode: $rc");
+ die;
+ }
$sth->finish();
}
@@ -185,7 +218,10 @@ elsif($cmd eq "changestatus")
check_user($sid);
my $sth=$dbh->prepare("update sessions set last_time=datetime('now','localtime'),
status=? where session_id = ? and uname=?");
- $sth->execute($status, $sid, $realuser)or die;
+ $sth->execute($status, $sid, $realuser) or {
+ syslog('error', "changestatus (SQLite3 session db backend) failed with exitcode: $rc");
+ die;
+ }
$sth->finish();
}
@@ -194,7 +230,10 @@ elsif($cmd eq "getdisplays")
#ignore $server
my @strings;
my $sth=$dbh->prepare("select display from sessions");
- $sth->execute()or die;
+ $sth->execute() or {
+ syslog('error', "getdisplays (SQLite3 session db backend) failed with exitcode: $rc");
+ die;
+ }
my @data;
my $i=0;
while (@data = $sth->fetchrow_array)
@@ -212,7 +251,10 @@ elsif($cmd eq "getports")
my $server=shift or die "argument \"server\" missed";
my @strings;
my $sth=$dbh->prepare("select port from used_ports");
- $sth->execute()or die;
+ $sth->execute() or {
+ syslog('error', "getports (SQLite3 session db backend) failed with exitcode: $rc");
+ die;
+ }
my @data;
my $i=0;
while (@data = $sth->fetchrow_array)
@@ -227,7 +269,10 @@ elsif($cmd eq "getservers")
{
my @strings;
my $sth=$dbh->prepare("select server,count(*) from sessions where status != 'F' group by server");
- $sth->execute()or die;
+ $sth->execute() or {
+ syslog('error', "getservers (SQLite3 session db backend) failed with exitcode: $rc");
+ die;
+ }
my @data;
my $i=0;
while (@data = $sth->fetchrow_array)
@@ -245,7 +290,10 @@ elsif($cmd eq "getagent")
check_user($sid);
my $sth=$dbh->prepare("select agent_pid from sessions
where session_id=?");
- $sth->execute($sid)or die;
+ $sth->execute($sid) or {
+ syslog('error', "getagent (SQLite3 session db backend) failed with exitcode: $rc");
+ die;
+ }
my @data;
my $i=0;
if(@data = $sth->fetchrow_array)
@@ -263,7 +311,10 @@ elsif($cmd eq "getdisplay")
check_user($sid);
my $sth=$dbh->prepare("select display from sessions
where session_id =?");
- $sth->execute($sid)or die;
+ $sth->execute($sid) or {
+ syslog('error', "getdisplay (SQLite3 session db backend) failed with exitcode: $rc");
+ die;
+ }
my @data;
my $i=0;
if(@data = $sth->fetchrow_array)
@@ -286,7 +337,10 @@ elsif($cmd eq "listsessions")
strftime('%s','now','localtime') - strftime('%s',init_time),fs_port from sessions
where status !='F' and server=? and uname=?
and ( session_id not like '%XSHAD%') order by status desc");
- $sth->execute($server, $realuser)or die;
+ $sth->execute($server, $realuser) or {
+ syslog('error', "listsessions (SQLite3 session db backend) failed with exitcode: $rc");
+ die;
+ }
fetchrow_printall_array($sth);
}
@@ -301,7 +355,10 @@ elsif($cmd eq "listsessions_all")
strftime('%s','now','localtime') - strftime('%s',init_time),fs_port from sessions
where status !='F' and uname=? and ( session_id not like '%XSHAD%') order by status desc");
- $sth->execute($realuser)or die;
+ $sth->execute($realuser) or {
+ syslog('error', "listsessions_all (SQLite3 session db backend) failed with exitcode: $rc");
+ die;
+ }
fetchrow_printall_array($sth);
}
else
hooks/post-receive
--
x2goserver.git (X2Go Server)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "x2goserver.git" (X2Go Server).
More information about the x2go-commits
mailing list