Subject: Bug#889 closed by X2Go Release Manager <[email-masked]> (X2Go issue (in src:x2goserver) has been marked as closed)

From: [email-masked] (X2Go Bug Tracking System)
Date: Sun, 20 Nov 2016 15:10:03 +0000

This is an automatic notification regarding your Bug report
which was filed against the x2goserver package:

#889: Cleanup whitespaces and Fixing deletion of users with postgres database

It has been closed by X2Go Release Manager <[email-masked]>.

Their explanation is attached below along with your original report.
If this explanation is unsatisfactory and you have not received a
better one in a separate message then please contact X2Go Release Manager <[email-masked]> by
replying to this email.

-- 
X2Go Bug Tracking System
Contact [email-masked] with problems

Subject: X2Go issue (in src:x2goserver) has been marked as closed
From: X2Go Release Manager <[email-masked]>
To: [email-masked]
Cc: [email-masked], [email-masked]
Date: Sun, 20 Nov 2016 12:42:59 +0100 (CET)

close #889
thanks

Hello,

we are very hopeful that X2Go issue #889 reported by you
has been resolved in the new release (4.0.1.20) of the
X2Go source project »src:x2goserver«.

You can view the complete changelog entry of src:x2goserver (4.0.1.20)
below, and you can use the following link to view all the code changes
between this and the last release of src:x2goserver.

    http://code.x2go.org/gitweb?p=x2goserver.git;a=commitdiff;h=71e1e82d82acc718da71301d2fbd67eb0a71ad44;hp=8a494e794402c1b124d861893d649726a9016eb7

If you feel that the issue has not been resolved satisfyingly, feel
free to reopen this bug report or submit a follow-up report with
further observations described based on the new released version
of src:x2goserver.

Thanks a lot for contributing to X2Go!!!

light+love
X2Go Git Admin (on behalf of the sender of this mail)

---
X2Go Component: src:x2goserver
Version: 4.0.1.20-0x2go1
Status: RELEASE
Date: Sun, 20 Nov 2016 12:39:36 +0100
Fixes: 799 812 888 889 903 922 923 985 1065 1068 1073
Changes: 
 x2goserver (4.0.1.20-0x2go1) RELEASED; urgency=low
 .
   [ Mike DePaulo ]
   * New upstream version (4.0.1.20):
     - TERMINAL Session: Add support for qterminal
       (Lightweight terminal emulator written in Qt)
     - TRINITY: Add support for Q4OS
 .
   [ Mihai Moldovan ]
   * New upstream version (4.0.1.20):
     - x2goserver/bin/x2gogetapps: respect NoDisplay and Hidden values, don't
       parse the full desktop file if there are non-Desktop Entries groups.
       Based on a patch submitted by Jason Alavaliant. Fixes: #812.
     - x2goserver/bin/x2gogetapps: do not print spurious newlines.
     - Change string "X2go" to "X2Go" where appropriate.
     - Add runcommand.d hooks to x2goserver-extensions Makefile.
     - x2goserver/bin/x2gosessionlimit: don't iterate over the whole groups
       file. Only check the primary and secondary groups as returned by
       getgid()/getgroups(). Fixes long delays in session startup on machines
       with a gazillion of groups.
     - x2goserver/sbin/x2gocleansessions: re-fetch the current sessions' status
       before handling it. Using the "cached" value from the initial
       x2golistsessions run may be desynchronized with the actual current
       value. Avoids a race condition logging users out after they attached to a
       session.
     - x2goserver/sbin/x2gocleansessions: rename %remembered_sessions_since to
       %remembered_sessions_status_since. That's what it really is. Add
       comments to further clarify what it's actually doing. Change it to
       include a timestamp instead of the "iteration count multiplied by two"
       value. Compare timestamps to see if killing hanging nxagent processes is
       necessary.
     - x2goserver/sbin/x2gocleansessions: rename
       %remembered_sessions_status_since to
       %remembered_sessions_status_since_time. Add
       %remembered_sessions_status_since_iterations that will come in handy for
       the next change.
     - x2goserver/sbin/x2gocleansessions: give suspended-but-running sessions a
       grace period of one iteration. Fixes: #888.
     - x2goserver/sbin/x2gocleansessions: fix ugly missing whitespace.
     - x2goserver/sbin/x2gocleansessions: move up session status sync a bit,
       don't update session state when session has been removed from the
       database.
     - x2goserver/sbin/x2gocleansessions: unify log messages. Move dangling
       line around.
     - x2goserver/sbin/x2gocleansessions: whitespace only.
     - x2goserver/sbin/x2gocleansessions: also delete entries in the other,
       overlooked hashes.
     - x2goserver/sbin/x2gocleansessions: move socket and lock file cleanup
       into time-based block for finished/failed sessions.
     - x2goserver/sbin/x2gocleansessions: add @remembered_finished_sessions
       array. Merge with session list as queried from the database (won't
       include finished/failed sessions) and remember F-state sessions via this
       array. Only delete elements once work on these has been finished.
     - x2goserver/sbin/x2gocleansessions: don't add failed/finished sessions to
       remembered list if that list already includes them.
     - x2goserver/sbin/x2gocleansessions: don't use gmtime (time ()) but merely
       time (). The former one returns a formatted date-time string, which
       can't be checked by forming a difference. The latter one returns an UNIX
       timestamp, which is what we really want... minus leap seconds. Let's
       hope this doesn't bite back some time or later...
     - x2goserver/sbin/x2gocleansessions: add debugging output to show the
       state change when updating the cached state result.
     - x2goserver/sbin/x2gocleansessions: only output status refreshing debug
       message if the old and new states actually differ. Prevents log spam.
     - x2goserver/bin/x2gostartagent: changes to Robert Nowotny's SSH_PORT
       patch. Fixes: #922. Use default outgoing interface to determine IP
       address. Use the whole range of ${RANDOM}'s pool. Seed it for good
       measure. Change the default method to randomization instead of IP-based
       initialization. If IP-based initialization was requested but the default
       outgoing IP address unavailable, fall back to randomization.
     - x2goserver/bin/x2goruncommand: whitespace and comment changes only.
     - x2goserver/bin/x2gocleansessions: replace system_capture_stdout_output()
       with actual implementation. We don't have that function on the release
       branch.
     - x2goserver-xsession/etc/Xsession: use /bin/bash explicitly on RedHat-,
       Gentoo- and SuSE-based systems. Users might change /bin/sh to point to a
       shell like mksh or dash, which do not support the -l or -c flags to
       exec. C.f., BGO #575022 (Gentoo.)
     - x2goserver/bin/x2gomountdirs: remove blowfish Cipher spec hardcoded for
       sshfs mounts. The speed improvement is probably mostly an illusion
       (unless talking about high-bandwidth links) and more importantly recent
       OpenSSH server versions seem to disable the Blowfish cipher by default,
       leading to errors like "Connection reset by peer."
     - x2goserver/bin/x2goruncommand: whitespace only.
     - x2goserver/sbin/x2gocleansessions: add Perl documentation and --help,
       -h, -? and --man options. Fixes: #1065. Also print a usage message on
       unknown options.
     - x2goserver/man/man8/x2gocleansessions.8: drop obsolete man page.
     - x2goserver-xsession/etc/Xsession: fix uname calls when (potentially)
       creating session log/error file and add uname call where necessary.
     - x2goserver-xsession/etc/Xsession: include hostname in
       xsession-x2go-errors file name. Part of #923.
     - x2goserver-xsession/etc/Xsession: rotate old log/error file before
       appending new data. Fixes: #923.
     - x2goserver-xsession/etc/Xsession: fix wrong variable usage.
       Fixes: #1073.
     - x2goserver/sbin/x2gocleansessions: move in-file POD to end of file,
       rather than "commenting" out all the remaining code. Fixes: #1068.
     - x2goserver/sbin/x2godbadmin: exit earlier when not finding the required
       "x2gouser" user.
   * x2goserver.spec:
     - Add sudo and logcheck as BuildRequires and Requires. Don't own
       directories that are owned by sudo and logcheck. Logcheck is not
       available on *SUSE, FC < 20 and RHEL, so for those distros still own the
       directories.
     - Typo fix in comment: Recommands -> Recommends.
     - Fix installation on OpenSUSE 12.3 and higher: has replaced pwdutils with
       shadow. Also affects SLE{S,D} 12.
     - Add workaround documentation for sudoers on *SUSE 11.
     - Add shadow/shadow-utils/pwdutils Requires to x2goserver-printing
       sub package.
     - Add new dependency on bash.
     - Add new dependency on xkeyboard-config to x2goserver. Fixes: #903.
     - Add new dependency on perl and the Cwd module to x2goserver-xsession.
       Part of #923.
   * debian/control:
     - Add new dependency on bash.
     - Add new dependency on xkb-data to x2goserver.
     - Maintainer change in package: X2Go Developers <[email-masked]>.
     - Uploaders: add myself. Also, force a rebuild due to the changed
       versioning.
     - Add new dependency on perl-modules for Cwd. Part of #923.
 .
   [ Henning Heinold ]
   * New upstream version (4.0.1.20):
     - x2goserver/sbin/x2godbadmin: remove trailing whitespace.
     - x2goserver/sbin/x2godbadmin: revoke all PRIVILEGES before trying to
       delete a user on postgres. Fixes: #889.
 .
   [ Mike Gabriel ]
   * debian/x2goserver.preinst:
     + Use proper comment header explaining about preinst script argument
       calls (not postinst).
 .
   [ Robert Nowotny ]
   * New upstream version (4.0.1.20):
     - x2goserver/bin/x2gostartagent: original patch for SSH_PORT
       randomization/IP-based initialization. Submitted as #922.
 .
   [ Stefan Baur ]
   * New upstream version (4.0.1.20):
     - x2goserver/bin/x2goruncommand: add the other trinity launcher scripts in
       order from newest to oldest. Fixes: #985.
 .
   [ Tor Perkins ]
   * New upstream version (4.0.1.20):
     - x2goserver/bin/x2goruncommand: capture x2goruncommand debug output for
       x2gofeature X2GO_XSESSION.
 .
   [ Orion Poplawski ]
   * New upstream version (4.0.1.20):
     - x2goserver/bin/x2golistdesktops: drop -u parameter to ss. Fixes: #799.
       We would filter out UDP sockets later anyway and the combination -lxu is
       known to be broken with some versions of iproute2.

Subject: Cleanup whitespaces and Fixing deletion of users with postgres database
From: Henning Heinold <[email-masked]>
To: [email-masked]
Date: Sat, 20 Jun 2015 10:44:40 +0200

Package: x2goserver
Tag: patch

Actually users on the postgres database can not be deleted
We GRANT priviliges on some tables, which
can be not deleted by "DROP owned". So we need
to REVOKE the priviliges, before trying to delete
the user. Besides let us cleanup trailing whitespaces
in x2godbadmin.
>From a686205a5a85e9e206b5e10ec9fdc9140682e378 Mon Sep 17 00:00:00 2001
From: Henning Heinold <[email-masked]>
Date: Fri, 19 Jun 2015 23:00:07 +0200
Subject: [PATCH 1/2] x2goserver/sbin/x2godbadmin: remove trailing whitespaces

---
 x2goserver/sbin/x2godbadmin | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/x2goserver/sbin/x2godbadmin b/x2goserver/sbin/x2godbadmin
index 5629f31..16638e7 100755
--- a/x2goserver/sbin/x2godbadmin
+++ b/x2goserver/sbin/x2godbadmin
@@ -52,7 +52,7 @@ my $addgroup='';
 my $rmgroup='';
 my $listusers='';
 
-GetOptions('listusers' => \$listusers, 'createdb' => \$createdb, 'updatedb' => \$updatedb, 'help' => \$help, 'adduser=s' => \$adduser, 
+GetOptions('listusers' => \$listusers, 'createdb' => \$createdb, 'updatedb' => \$updatedb, 'help' => \$help, 'adduser=s' => \$adduser,
            'addgroup=s' => \$addgroup, 'rmuser=s' => \$rmuser, 'rmgroup=s' => \$rmgroup);
 
 if ($help  || ! ( $createdb || $updatedb || $adduser || $rmuser || $addgroup || $rmgroup || $listusers))
@@ -215,19 +215,19 @@ if ($Config->param("backend") eq 'sqlite')
 		                      END;
 		                      END;
 		                      ");
-		$sth->execute() or die; 
+		$sth->execute() or die;
 		$sth->finish();
 
 		my $sth=$dbh->prepare("
 		                      CREATE TRIGGER fkd_ports_session_id
 		                      BEFORE DELETE ON sessions
-		                      FOR EACH ROW 
+		                      FOR EACH ROW
 		                      BEGIN
 		                      DELETE  FROM used_ports WHERE session_id = OLD.session_id;
 		                      END;
 		                      END;
 		                      ");
-		$sth->execute() or die; 
+		$sth->execute() or die;
 		$sth->finish();
 
 		# undef $dbh should be preferred to $dbh->disconnect(), see
@@ -383,7 +383,7 @@ if ($adduser)
 
 if ($addgroup)
 {
-	my ($name, $passwd, $gid, $members)  = getgrnam( $addgroup); 
+	my ($name, $passwd, $gid, $members)  = getgrnam( $addgroup);
 	my @grp_members=split(' ',$members);
 	foreach (@grp_members)
 	{
@@ -399,7 +399,7 @@ if ($rmuser)
 
 if ($rmgroup)
 {
-	my ($name, $passwd, $gid, $members)  = getgrnam( $rmgroup); 
+	my ($name, $passwd, $gid, $members)  = getgrnam( $rmgroup);
 	my @grp_members=split(' ',$members);
 	foreach (@grp_members)
 	{
@@ -417,7 +417,7 @@ sub list_users()
 	printf ("%-20s DB user\n","UNIX user");
 	print "---------------------------------------\n";
 	my @data;
-	while (@data = $sth->fetchrow_array) 
+	while (@data = $sth->fetchrow_array)
 	{
 		@data[0]=~s/x2gouser_//;
 		printf ("%-20s x2gouser_@data[0]\n",@data[0]);
@@ -430,10 +430,10 @@ sub rm_user()
 {
 	my $user=shift;
 
-	print ("rm DB user \"x2gouser_$user\"\n"); 
+	print ("rm DB user \"x2gouser_$user\"\n");
 
 	my $sth=$dbh->prepare("DROP OWNED BY \"x2gouser_$user\"");
-	$sth->execute();      
+	$sth->execute();
 
 	my $sth=$dbh->prepare("drop USER if exists \"x2gouser_$user\"");
 	$sth->execute();
@@ -475,7 +475,7 @@ sub add_user()
 	$sth->{PrintError}=0;
 	$sth->execute();
 
-	print ("create DB user \"x2gouser_$user\"\n"); 
+	print ("create DB user \"x2gouser_$user\"\n");
 	$sth=$dbh->prepare("create USER \"x2gouser_$user\" WITH ENCRYPTED PASSWORD '$pass'");
 	$sth->execute();
 
@@ -541,8 +541,8 @@ sub create_tables()
 	$sth->execute() or die;
 
 	$sth=$dbh->prepare("
-	                   create VIEW sessions_view as 
-	                   SELECT 
+	                   create VIEW sessions_view as
+	                   SELECT
 	                   agent_pid, session_id, display, server, status, init_time, cookie, client, gr_port,
 	                   sound_port, last_time, uname, fs_port, tekictrl_port, tekidata_port from  sessions
 	                   where creator_id = current_user
@@ -550,8 +550,8 @@ sub create_tables()
 	$sth->execute() or die;
 
 	$sth=$dbh->prepare("
-	                   create VIEW servers_view as 
-	                   SELECT 
+	                   create VIEW servers_view as
+	                   SELECT
 	                   server, display, status from  sessions
 	                   ");
 	$sth->execute() or die;
@@ -579,8 +579,8 @@ sub create_tables()
 
 	$sth=$dbh->prepare("
 	                   create or replace RULE update_sess_view AS ON UPDATE
-	                   TO sessions_view DO INSTEAD 
-	                   update sessions set 
+	                   TO sessions_view DO INSTEAD
+	                   update sessions set
 	                   status=NEW.status,
 	                   last_time=NEW.last_time,
 	                   cookie=NEW.cookie,
@@ -617,7 +617,7 @@ sub create_tables()
 	$sth->execute() or die;
 
 	$sth=$dbh->prepare("
-	                   create VIEW ports_view as 
+	                   create VIEW ports_view as
 	                   SELECT
 	                   server, port from used_ports
 	                   ");
@@ -655,7 +655,7 @@ sub create_tables()
 	$sth->execute() or die;
 
 	$sth=$dbh->prepare("
-	                   create VIEW mounts_view as 
+	                   create VIEW mounts_view as
 	                   SELECT
 	                   client,path, session_id from mounts
 	                   where creator_id = current_user
@@ -664,11 +664,11 @@ sub create_tables()
 
 	$sth=$dbh->prepare("
 	                   create or replace RULE delete_mounts_view AS ON DELETE
-	                   TO mounts_view DO INSTEAD 
+	                   TO mounts_view DO INSTEAD
 	                   delete from mounts
 	                   where session_id=OLD.session_id and creator_id=current_user and path=OLD.path
 	                   ");
-	$sth->execute() or die;	  
+	$sth->execute() or die;
 
 	$sth=$dbh->prepare("
 	                   create or replace RULE insert_mount_priv AS ON INSERT
-- 
1.9.1

>From bff74ebea84f9d9356ee398037a248ca82fd63fd Mon Sep 17 00:00:00 2001
From: Henning Heinold <[email-masked]>
Date: Fri, 19 Jun 2015 23:01:24 +0200
Subject: [PATCH 2/2] x2goserver/sbin/x2godbadmin: revoke all PRIVILEGES before
 trying to delete an user on postgres

---
 x2goserver/sbin/x2godbadmin | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/x2goserver/sbin/x2godbadmin b/x2goserver/sbin/x2godbadmin
index 16638e7..0f5b91e 100755
--- a/x2goserver/sbin/x2godbadmin
+++ b/x2goserver/sbin/x2godbadmin
@@ -432,6 +432,12 @@ sub rm_user()
 
 	print ("rm DB user \"x2gouser_$user\"\n");
 
+	my $sth=$dbh->prepare("REVOKE ALL PRIVILEGES ON sessions, used_ports, mounts FROM \"x2gouser_$user\"");
+	$sth->execute();
+
+	my $sth=$dbh->prepare("REVOKE ALL PRIVILEGES ON sessions_view, mounts_view, servers_view, ports_view FROM \"x2gouser_$user\"");
+	$sth->execute();
+
 	my $sth=$dbh->prepare("DROP OWNED BY \"x2gouser_$user\"");
 	$sth->execute();
 
@@ -465,6 +471,16 @@ sub add_user()
 	$pass=`pwgen 8 1`;
 	chomp($pass);
 
+	my $sth=$dbh->prepare("REVOKE ALL PRIVILEGES ON sessions, used_ports, mounts FROM \"x2gouser_$user\"");
+	$sth->{Warn}=0;
+	$sth->{PrintError}=0;
+	$sth->execute();
+
+	my $sth=$dbh->prepare("REVOKE ALL PRIVILEGES ON sessions_view, mounts_view, servers_view, ports_view FROM \"x2gouser_$user\"");
+	$sth->{Warn}=0;
+	$sth->{PrintError}=0;
+	$sth->execute();
+
 	my $sth=$dbh->prepare("DROP OWNED BY \"x2gouser_$user\"");
 	$sth->{Warn}=0;
 	$sth->{PrintError}=0;
-- 
1.9.1