[X2Go-Commits] x2goserver.git - build-baikal (branch) updated: 3.0.1-1
X2Go dev team
git-admin at x2go.org
Fri Jan 3 20:52:06 CET 2014
The branch, build-baikal has been updated
via 3d51ceffea2987a4619ccb89399767352027cc9c (commit)
from df26fa042d97b8c90cc9821910bc3f890314aace (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:
INSTALL | 3 +-
debian/changelog | 7 ++
debian/control | 2 +-
debian/dirs | 1 +
debian/rules | 2 +
x2gocleansessions | 5 +-
x2golistsessions | 3 +-
x2golistsessions_root | 3 +-
x2gopgwrapper | 3 +
x2gopgwrapper_sqlite | 201 +++++++++++++++++++++++++++++++++++++++++++++++++
x2gosqlite.sh | 54 +++++++++++++
x2goumount_session | 3 +-
12 files changed, 280 insertions(+), 7 deletions(-)
create mode 100755 x2gopgwrapper_sqlite
create mode 100755 x2gosqlite.sh
The diff of changes is:
diff --git a/INSTALL b/INSTALL
index 953cc74..15df0dc 100644
--- a/INSTALL
+++ b/INSTALL
@@ -34,4 +34,5 @@ copy public part "/root/.x2go/ssh/.pg/id_dsa.pub" on computer with running sql s
and add it to ~postgres/.ssh/authorized_keys
cat id_dsa.pub >> ~postgres/.ssh/authorized_keys
-
+IF YOU WANT TO USE SQLITE
+echo -n sqlite > /etc/x2go/sql
diff --git a/debian/changelog b/debian/changelog
index a34c13a..26e4c95 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+x2goserver (3.0.1-1) unstable; urgency=low
+
+ * Support for sqlite
+ * fixed problem with HOSTNAME variable in perl scripts when users shell is zsh. Thank Ralf Schulze
+
+ -- Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de> Thu, 16 Jul 2009 10:56:23 +0200
+
x2goserver (3.0.0-2) unstable; urgency=low
* Support for rdesktop sessions
diff --git a/debian/control b/debian/control
index 9448d4b..5f33d54 100644
--- a/debian/control
+++ b/debian/control
@@ -8,7 +8,7 @@ Standards-Version: 3.7.2
Package: x2goserver
Architecture: all
Depends: x2goagent, sudo, lsof, ssh
-Recommends: sshfs, postgresql
+Recommends: sshfs
Description: x2goserver (daemon and tools)
x2go is a serverbased computing environment with
- session resuming
diff --git a/debian/dirs b/debian/dirs
index b9b8278..f2b2ebc 100644
--- a/debian/dirs
+++ b/debian/dirs
@@ -2,3 +2,4 @@ usr/bin
usr/sbin
etc/x2go
usr/lib/x2go/script
+var/db/x2go
\ No newline at end of file
diff --git a/debian/rules b/debian/rules
index 681a023..7069731 100755
--- a/debian/rules
+++ b/debian/rules
@@ -62,6 +62,7 @@ install: build
install x2gomountdirs $(CURDIR)/debian/x2goserver/usr/bin/
install x2gopgwrapper $(CURDIR)/debian/x2goserver/usr/bin/
install x2gopgwrapper_local $(CURDIR)/debian/x2goserver/usr/bin/
+ install x2gopgwrapper_sqlite $(CURDIR)/debian/x2goserver/usr/bin/
install x2gopgwrapper_net $(CURDIR)/debian/x2goserver/usr/bin/
install x2goresume-session $(CURDIR)/debian/x2goserver/usr/bin/
install x2goruncommand $(CURDIR)/debian/x2goserver/usr/bin/
@@ -76,6 +77,7 @@ install: build
cp sql $(CURDIR)/debian/x2goserver/etc/x2go/
install x2gocleansessions $(CURDIR)/debian/x2goserver/usr/sbin/
install x2gocreatebase.sh $(CURDIR)/debian/x2goserver/usr/lib/x2go/script
+ install x2gosqlite.sh $(CURDIR)/debian/x2goserver/usr/lib/x2go/script
diff --git a/x2gocleansessions b/x2gocleansessions
index 491d634..52ee57d 100755
--- a/x2gocleansessions
+++ b/x2gocleansessions
@@ -1,4 +1,5 @@
#!/usr/bin/perl
+use Sys::Hostname;
use strict;
sub check_pid
@@ -41,8 +42,8 @@ sub catch_term
}
my $uname;
-my $serv=$ENV{'HOSTNAME'};
-
+#my $serv=$ENV{'HOSTNAME'};
+my $serv = hostname;
my $pid = fork();
if (not defined $pid)
{
diff --git a/x2golistsessions b/x2golistsessions
index 726cc6d..7d53683 100755
--- a/x2golistsessions
+++ b/x2golistsessions
@@ -1,4 +1,5 @@
#!/usr/bin/perl
+use Sys::Hostname;
use strict;
@@ -17,7 +18,7 @@ sub check_stat
my $serv=shift;
if( ! $serv)
{
- $serv=$ENV{'HOSTNAME'};
+ $serv=hostname;
}
my $uname=$ENV{'USER'};
my $outp;
diff --git a/x2golistsessions_root b/x2golistsessions_root
index 4e128b7..efb71f3 100755
--- a/x2golistsessions_root
+++ b/x2golistsessions_root
@@ -1,4 +1,5 @@
#!/usr/bin/perl
+use Sys::Hostname;
use strict;
@@ -21,7 +22,7 @@ my $uname;
my $serv=shift;
if( ! $serv)
{
- $serv=$ENV{'HOSTNAME'};
+ $serv=hostname;
}
my $outp=`x2golistsessions_sql $serv 2>/dev/null`;
diff --git a/x2gopgwrapper b/x2gopgwrapper
index a9a33f0..0f9ac5e 100755
--- a/x2gopgwrapper
+++ b/x2gopgwrapper
@@ -3,6 +3,9 @@ SQLHOST=`cat /etc/x2go/sql`
if [ "$SQLHOST" == "local" ]
then
x2gopgwrapper_local $@ 2> /dev/null
+elif [ "$SQLHOST" == "sqlite" ]
+then
+ x2gopgwrapper_sqlite $@ 2> /dev/null
else
x2gopgwrapper_net $SQLHOST $@
fi
\ No newline at end of file
diff --git a/x2gopgwrapper_sqlite b/x2gopgwrapper_sqlite
new file mode 100755
index 0000000..31edb49
--- /dev/null
+++ b/x2gopgwrapper_sqlite
@@ -0,0 +1,201 @@
+#!/bin/bash
+#use only with sudo !!
+
+UNAME=$SUDO_USER
+
+DATABASE=/var/db/x2go/x2go_sessions
+
+
+case "$1" in
+
+getdisplays)
+ echo "select '|'||display||'|' from sessions;"|sqlite $DATABASE
+ ;;
+
+getports)
+ echo "select '|'||port||'|' from used_ports;"|sqlite $DATABASE
+ ;;
+
+getservers)
+ echo "select server,count(*) from sessions where status != 'F' group by server;"|sqlite $DATABASE
+ ;;
+
+listsessions)
+ echo "select agent_pid, session_id, display, server, status,\
+ substr(strftime('%d.%m.%Y*%H:%M:%S',init_time),0,6)||substr(strftime('%d.%m.%Y*%H:%M:%S',init_time),9,11),\
+ cookie,client,gr_port,sound_port,\
+ substr(strftime('%d.%m.%Y*%H:%M:%S',last_time),0,6)||substr(strftime('%d.%m.%Y*%H:%M:%S',last_time),9,11),\
+ uname,\
+ strftime('%s','now','localtime') - strftime('%s',init_time),fs_port from sessions \
+ where status !='F' and server='$2' and uname='$UNAME' order by status desc;"|sqlite $DATABASE
+ ;;
+
+listsessions_all)
+ echo "select agent_pid, session_id, display, server, status,\
+ substr(strftime('%d.%m.%Y*%H:%M:%S',init_time),0,6)||substr(strftime('%d.%m.%Y*%H:%M:%S',init_time),9,11),\
+ cookie,client,gr_port,sound_port,\
+ substr(strftime('%d.%m.%Y*%H:%M:%S',last_time),0,6)||substr(strftime('%d.%m.%Y*%H:%M:%S',last_time),9,11),\
+ uname,\
+ strftime('%s','now','localtime') - strftime('%s',init_time),fs_port from sessions \
+ where status !='F' and uname='$UNAME' order by status desc;"|sqlite $DATABASE
+ ;;
+
+listsessionsroot)
+ if [ "$UNAME" != "root" ]
+ then
+ echo "$UNAME, You have not permission to do this job!"
+ exit
+ fi
+ echo "select agent_pid, session_id, display, server, status,\
+ substr(strftime('%d.%m.%Y*%H:%M:%S',init_time),0,6)||substr(strftime('%d.%m.%Y*%H:%M:%S',init_time),9,11),\
+ cookie,client,gr_port,sound_port,\
+ substr(strftime('%d.%m.%Y*%H:%M:%S',last_time),0,6)||substr(strftime('%d.%m.%Y*%H:%M:%S',last_time),9,11),\
+ uname,\
+ strftime('%s','now','localtime') - strftime('%s',init_time),fs_port from sessions \
+ where server='$2' order by status desc;"|sqlite $DATABASE
+ ;;
+
+listsessionsroot_all)
+ if [ "$UNAME" != "root" ]
+ then
+ echo "$UNAME, You have not permission to do this job!"
+ exit
+ fi
+ echo "select agent_pid, session_id, display, server, status,\
+ substr(strftime('%d.%m.%Y*%H:%M:%S',init_time),0,6)||substr(strftime('%d.%m.%Y*%H:%M:%S',init_time),9,11),\
+ cookie,client,gr_port,sound_port,\
+ substr(strftime('%d.%m.%Y*%H:%M:%S',last_time),0,6)||substr(strftime('%d.%m.%Y*%H:%M:%S',last_time),9,11),\
+ uname,\
+ strftime('%s','now','localtime') - strftime('%s',init_time),fs_port from sessions \
+ order by status desc;"|sqlite $DATABASE
+ ;;
+
+listsusp)
+ if [ "$UNAME" != "root" ]
+ then
+ echo "$UNAME, You have not permission to do this job!"
+ exit
+ fi
+ echo "select session_id, display, uname, server,round((strftime('%s','now','localtime') - strftime('%s',last_time))/60)\
+ from sessions where server='$2' and status='S';"|sqlite $DATABASE
+ ;;
+
+listallrunning)
+ if [ "$UNAME" != "root" ]
+ then
+ echo "$UNAME, You have not permission to do this job!"
+ exit
+ fi
+ echo "select agent_pid, session_id, display, server, status,\
+ substr(strftime('%d.%m.%Y*%H:%M:%S',init_time),0,6)||substr(strftime('%d.%m.%Y*%H:%M:%S',init_time),9,11),\
+ cookie,client,gr_port,sound_port,\
+ substr(strftime('%d.%m.%Y*%H:%M:%S',last_time),0,6)||substr(strftime('%d.%m.%Y*%H:%M:%S',last_time),9,11),\
+ uname,\
+ strftime('%s','now','localtime') - strftime('%s',init_time),fs_port from sessions \
+ where status='R';"|sqlite $DATABASE
+ ;;
+
+listmails)
+ if [ "$UNAME" != "root" ]
+ then
+ echo "$UNAME, You have not permission to do this job!"
+ exit
+ fi
+ echo "select user_messages.mess_id,sessions.session_id,\
+ sessions.uname,sessions.display from sessions,user_messages,\
+ messages where sessions.uname=user_messages.uname and sessions.status!='F'\
+ and messages.mess_id=user_messages.mess_id and sessions.server='$2';"|sqlite $DATABASE
+ ;;
+
+getmail)
+ if [ "$UNAME" != "root" ]
+ then
+ echo "$UNAME, You have not permission to do this job!"
+ exit
+ fi
+ echo "select message from messages where mess_id='$2';"|sqlite $DATABASE
+ ;;
+
+rmmail)
+ if [ "$UNAME" != "root" ]
+ then
+ echo "$UNAME, You have not permission to do this job!"
+ exit
+ fi
+ echo "delete from user_messages where mess_id='$2' and uname='$3';"|sqlite $DATABASE
+ ;;
+
+rmsessionsroot)
+ if [ "$UNAME" != "root" ]
+ then
+ echo "$UNAME, You have not permission to do this job!"
+ exit
+ fi
+ echo "delete from sessions \
+ where session_id='$2';"|sqlite $DATABASE
+ echo "delete from used_ports \
+ where session_id='$2';"|sqlite $DATABASE
+ ;;
+
+getagent)
+ echo "select agent_pid from sessions where session_id = '$2';"|sqlite $DATABASE
+ ;;
+
+getdisplay)
+ echo "select display from sessions where session_id = '$2';"|sqlite $DATABASE
+ ;;
+
+changestatus)
+ echo "update sessions set last_time=datetime('now','localtime'),status='$2' where session_id = '$3' and uname='$UNAME';"|sqlite $DATABASE
+ ;;
+
+resume)
+ echo "update sessions set last_time=datetime('now','localtime'),status='R',client='$2' where session_id = '$3' and uname='$UNAME';"|sqlite $DATABASE
+ ;;
+
+insertsession)
+ OUTP=`echo "insert into sessions (display,server,uname,session_id, init_time, last_time) values \
+ ('$2','$3','$UNAME','$4', datetime('now','localtime'), datetime('now','localtime'));"|sqlite $DATABASE`
+ if [ "$OUTP" == "" ]
+ then
+ echo "INSERT 0 1"
+ fi
+ ;;
+
+createsession)
+ echo "update sessions set status='R',last_time=datetime('now','localtime'),cookie='$2',agent_pid='$3',\
+ client='$4',gr_port='$5',sound_port='$6',fs_port='$7' where session_id='$8' and uname='$UNAME';"|sqlite $DATABASE
+ ;;
+
+insertport)
+ OUTP=`echo "insert into used_ports (server,session_id,port) values \
+ ('$2','$3','$4');"|sqlite $DATABASE`
+ if [ "$OUTP" == "" ]
+ then
+ echo "INSERT 0 1"
+ fi
+ ;;
+
+insertmount)
+ OUTP=`echo "insert into mounts (session_id,path,client) values \
+ ('$2','$3','$4');"|sqlite $DATABASE`
+ if [ "$OUTP" == "" ]
+ then
+ echo "INSERT 0 1"
+ fi
+ ;;
+
+deletemount)
+ echo "delete from mounts where session_id='$2' and path='$3';"|sqlite $DATABASE
+ ;;
+
+getmounts)
+ echo "select client,path from mounts where session_id = '$2';"|sqlite $DATABASE
+ ;;
+
+*)
+ echo "$1: wrong argument"
+ ;;
+
+esac
+
diff --git a/x2gosqlite.sh b/x2gosqlite.sh
new file mode 100755
index 0000000..a42ecc1
--- /dev/null
+++ b/x2gosqlite.sh
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+DATABASE=/var/db/x2go/x2go_sessions
+
+#rm $DATABASE
+
+echo "create table sessions(
+ session_id varchar(500) primary key,
+ display integer not null,
+ uname varchar(100) not null,
+ server varchar(100) not null,
+ client inet,
+ status char(1) not null default 'R',
+ init_time timestamp not null default CURRENT_TIMESTAMP,
+ last_time timestamp not null default CURRENT_TIMESTAMP,
+ cookie char(33),
+ agent_pid int,
+ gr_port int,
+ sound_port int,
+ fs_port int,
+ unique(display)
+ );" | sqlite $DATABASE
+
+
+echo "create table messages(mess_id varchar(20) primary key, message text);" | sqlite $DATABASE
+
+echo "create table user_messages(
+ mess_id varchar(20) not null,
+ uname varchar(100) not null
+ );" | sqlite $DATABASE
+
+
+echo "create table used_ports(
+ server varchar(100) not null,
+ session_id varchar(500) references sessions on delete cascade,
+ port integer primary key
+ );" | sqlite $DATABASE
+
+echo "create table mounts(
+ session_id varchar(500) references sessions on delete restrict,
+ path varchar(512) not null,
+ client inet not null,
+ primary key(path,client)
+ );" | sqlite $DATABASE
+
+echo "CREATE TRIGGER fkd_mounts_session_id
+BEFORE DELETE ON sessions
+FOR EACH ROW BEGIN
+ SELECT CASE
+ WHEN ((SELECT session_id FROM mounts WHERE session_id = OLD.session_id) IS NOT NULL)
+ THEN RAISE(ABORT, 'delete on table \"sessions\" violates foreign key on table \"mounts\"')
+ END;
+END;" | sqlite $DATABASE
+
diff --git a/x2goumount_session b/x2goumount_session
index 64b212f..5e3da84 100755
--- a/x2goumount_session
+++ b/x2goumount_session
@@ -1,4 +1,5 @@
#!/usr/bin/perl
+use Sys::Hostname;
use strict;
my $session=shift;
@@ -6,7 +7,7 @@ my $only_path=shift;
my $uname=$ENV{'USER'};
-my $serv=$ENV{'HOSTNAME'};
+my $serv=hostname;
if($only_path)
{
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