[X2go-Commits] x2goserver.git - master (branch) updated: 3.0.99-2-218-gcfbadba

X2go dev team git-admin at x2go.org
Thu Sep 8 01:27:59 CEST 2011


The branch, master has been updated
       via  cfbadbad8aa07a623c38313799170feae6f63936 (commit)
       via  d8bf461f9299ce7f2b5c61ce4f6e7330f2ab2974 (commit)
       via  4408d3d51bfe24d168e67ae6411c26f459769132 (commit)
       via  618c1468df976ea93f307e658360a6ec20fc44a0 (commit)
      from  39feab07aa3bfaa30de5f35e7f13f2c61d435e66 (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 -----------------------------------------------------------------
commit cfbadbad8aa07a623c38313799170feae6f63936
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Thu Sep 8 01:29:05 2011 +0200

    Add sanity checks to x2goprint, script can only be run as root.

commit d8bf461f9299ce7f2b5c61ce4f6e7330f2ab2974
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Thu Sep 8 01:27:14 2011 +0200

    postinst fix

commit 4408d3d51bfe24d168e67ae6411c26f459769132
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Thu Sep 8 01:18:25 2011 +0200

    revert test code in dbwrapper

commit 618c1468df976ea93f307e658360a6ec20fc44a0
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Thu Sep 8 01:14:51 2011 +0200

    revert setgid wrapper for x2goprint

-----------------------------------------------------------------------

Summary of changes:
 debian/changelog                    |    8 +++-----
 debian/x2goserver.postinst          |    2 +-
 x2goserver/Makefile                 |    4 ----
 x2goserver/bin/x2goprint            |   27 ++++++++++++++++++++++-----
 x2goserver/lib/x2gosqlitewrapper.pl |    1 -
 5 files changed, 26 insertions(+), 16 deletions(-)

The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index c7cb3f6..8a9626e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,6 @@
 x2goserver (3.0.99.5-0~x2go3) UNRELEASED; urgency=low
 
-  [Mike Gabriel]
+  [ Mike Gabriel ]
   * Rename x2goumount_session calls to x2goumount-session calls in x2goserver
     internal scripts.
   * React to bug #627990, prefer man2html-base over man2html.
@@ -34,11 +34,9 @@ x2goserver (3.0.99.5-0~x2go3) UNRELEASED; urgency=low
   * Silence x2golistsessions on missing session.log files.
   * Create x2goprint user/group on package installation, add same info to 
     INSTALL howto.
-  * Change permissions on x2goprint, using 2755:root:x2goprint (setgid).
-  * Change X2go printing concept: use setgit and a sgid wrapper instead of sudo.
-  * Makefile update for x2goprint setgid wrapper.
+  * Add sanity checks to x2goprint, script can only be run as root.
 
-  [Martin Oehler]
+  [ Martin Oehler ]
   * Removes old debug code fragment, fixes x2golistsessions parsing.
 
  -- Mike Gabriel <mike.gabriel at das-netzwerkteam.de>  Sun, 05 Jun 2011 20:44:32 +0200
diff --git a/debian/x2goserver.postinst b/debian/x2goserver.postinst
index 961fdc1..407cf79 100755
--- a/debian/x2goserver.postinst
+++ b/debian/x2goserver.postinst
@@ -128,7 +128,7 @@ case "$1" in
 			chown root:root /usr/bin/x2goprint
 			chmod 0755 /usr/bin/x2goprint
 		fi
-
+		;;
 
 	abort-upgrade|abort-remove|abort-deconfigure)
 		;;
diff --git a/x2goserver/Makefile b/x2goserver/Makefile
index b46c117..71cced9 100755
--- a/x2goserver/Makefile
+++ b/x2goserver/Makefile
@@ -37,7 +37,6 @@ build-arch: build_setgidwrappers
 
 build_setgidwrappers:
 	gcc -o x2gosqlitewrapper x2gosqlitewrapper.c
-	gcc -o x2goprint x2goprint.c
 
 build-indep: build_man2html
 
@@ -50,7 +49,6 @@ clean: clean_arch clean_man2html
 
 clean_arch:
 	rm -f x2gosqlitewrapper
-	rm -f x2goprint
 
 clean_man2html:
 	rm -Rf `dirname $(MAN2HTML_DEST)`
@@ -64,7 +62,6 @@ install_scripts:
 	$(INSTALL_PROGRAM) bin/*                $(DESTDIR)$(BINDIR)/
 	$(INSTALL_PROGRAM) sbin/*               $(DESTDIR)$(SBINDIR)/
 	$(INSTALL_PROGRAM) x2gosqlitewrapper       $(DESTDIR)$(LIBDIR)/
-	$(INSTALL_PROGRAM) x2goprint               $(DESTDIR)$(BINDIR)/
 	$(INSTALL_PROGRAM) lib/*                   $(DESTDIR)$(LIBDIR)/
 	chmod a-x $(DESTDIR)$(LIBDIR)/*.pm
 	chown root:x2gouser $(DESTDIR)$(LIBDIR)/x2gosqlitewrapper
@@ -100,7 +97,6 @@ uninstall_scripts:
 	for file in $(SBIN_SCRIPTS); do $(RM_FILE) $(DESTDIR)$(SBINDIR)/$$file; done
 	for file in $(LIB_FILES); do $(RM_FILE) $(DESTDIR)$(LIBDIR)/$$file; done
 	$(RM_FILE) $(DESTDIR)$(LIBDIR)/x2gosqlitewrapper
-	$(RM_FILE) $(DESTDIR)$(BINDIR)/x2goprint
 	$(RM_DIR) $(DESTDIR)$(LIBDIR) || true
 
 uninstall_config:
diff --git a/x2goserver/bin/x2goprint b/x2goserver/bin/x2goprint
index ea35584..89028af 100755
--- a/x2goserver/bin/x2goprint
+++ b/x2goserver/bin/x2goprint
@@ -28,16 +28,33 @@ use strict;
 use lib `echo -n \$(x2gobasepath)/lib/x2go`;
 use x2godbwrapper;
 
-if (scalar(@ARGV) ==1)
+sub check_root
 {
-	db_listsessions_all @ARGV[0];
+	my ($uname, $pass, $uid, $pgid, $quota, $comment, $gcos, $homedir, $shell, $expire) = getpwuid($<);
+	my $realuser=$uname;
+	if ($realuser ne "root")
+	{
+		die "$realuser, you cannot use x2goprint as non-root user...";
+	}
 }
-elsif (scalar(@ARGV) != 4)
+
+sub usage
 {
-	print STDERR "ERROR: Usage:\nx2goprint user session file titleFile\nx2goprint user\n";
-	exit 1;
+	if (scalar(@ARGV) == 1)
+	{
+		system ("su @ARGV[0] -c \"x2golistsessions --all-servers\"");
+		exit 0;
+	}
+	elsif (scalar(@ARGV) != 4)
+	{
+		print STDERR "ERROR: Usage:\nx2goprint user session file titleFile\nx2goprint user\n";
+		exit 1;
+	}
 }
 
+check_root();
+usage();
+
 my ($user, $session, $file, $titleFile)=@ARGV;
 
 my ($tm,$tm,$uid,$gid,$tm,$tm,$tm,$homedir)=getpwnam("x2goprint");
diff --git a/x2goserver/lib/x2gosqlitewrapper.pl b/x2goserver/lib/x2gosqlitewrapper.pl
index 79f10af..0beef3a 100755
--- a/x2goserver/lib/x2gosqlitewrapper.pl
+++ b/x2goserver/lib/x2gosqlitewrapper.pl
@@ -279,7 +279,6 @@ elsif($cmd eq  "listsessions")
 
 elsif($cmd eq  "listsessions_all")
 {
-        my $user=shift and $realuser = $user;
 	my @strings;
 	my $sth=$dbh->prepare("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),


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