[X2go-Commits] x2gobroker.git - master (branch) updated: 933e9a79d24b0669de27ba229d07329fcd1c2385

X2Go dev team git-admin at x2go.org
Sat Sep 15 21:55:17 CEST 2012


The branch, master has been updated
       via  933e9a79d24b0669de27ba229d07329fcd1c2385 (commit)
       via  4cb228d3cfee43162922b2f8fbf4064fd0b39a82 (commit)
       via  3098bed45d56262d5de490d5fa45f51fb13b975c (commit)
      from  9efd0dcf3ea924d2049ff027b854d1159c29c617 (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 933e9a79d24b0669de27ba229d07329fcd1c2385
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Sat Sep 15 21:55:14 2012 +0200

    split up x2gobroker-command into a separate binary arch-dep package

commit 4cb228d3cfee43162922b2f8fbf4064fd0b39a82
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Sat Sep 15 21:54:52 2012 +0200

    fix paths in Makefile

commit 3098bed45d56262d5de490d5fa45f51fb13b975c
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Sat Sep 15 21:43:42 2012 +0200

    get rid of suidperl, draft only for now

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

Summary of changes:
 Makefile                                          |   41 +++++++++++
 debian/control                                    |   37 ++++++++++-
 debian/rules                                      |    1 +
 debian/x2gobroker-common.install                  |    1 -
 lib/{x2gobroker-command => x2gobroker-command.pl} |    2 +-
 src/x2gobroker-command.c                          |   77 +++++++++++++++++++++
 6 files changed, 156 insertions(+), 3 deletions(-)
 create mode 100755 Makefile
 rename lib/{x2gobroker-command => x2gobroker-command.pl} (98%)
 create mode 100644 src/x2gobroker-command.c

The diff of changes is:
diff --git a/Makefile b/Makefile
new file mode 100755
index 0000000..36f0d01
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,41 @@
+#!/usr/bin/make -f
+
+SRC_DIR=$(CURDIR)
+SHELL=/bin/bash
+
+INSTALL_DIR=install -d -o root -g root -m 755
+INSTALL_FILE=install -o root -g root -m 644
+INSTALL_PROGRAM=install -o root -g root -m 755
+
+RM_FILE=rm -f
+RM_DIR=rmdir -p --ignore-fail-on-non-empty
+
+DESTDIR=
+PREFIX=/usr/local
+ETCDIR=/etc/x2go
+BINDIR=$(PREFIX)/bin
+SBINDIR=$(PREFIX)/sbin
+LIBDIR=$(PREFIX)/lib/x2go
+MANDIR=$(PREFIX)/share/man
+SHAREDIR=$(PREFIX)/share/x2go
+
+BIN_SCRIPTS=$(shell cd bin && echo *)
+SBIN_SCRIPTS=$(shell cd sbin && echo *)
+LIB_FILES=$(shell cd lib && echo *)
+
+all: clean build
+
+build: build-arch build-indep
+
+build-arch: build_setgidwrappers
+
+build_setgidwrappers:
+	gcc -fPIE -pie -o lib/x2gobroker-command src/x2gobroker-command.c
+
+build-indep:
+
+clean: clean_arch
+
+clean_arch:
+	rm -f lib/x2gobroker-command
+
diff --git a/debian/control b/debian/control
index dd5b395..f552bdb 100644
--- a/debian/control
+++ b/debian/control
@@ -13,7 +13,6 @@ Standards-Version: 3.9.3
 Package: x2gobroker-simple
 Architecture: all
 Depends:
- ${perl:Depends},
  ${misc:Depends},
 Description: X2Go http(s) session broker (simple broker)
  X2Go is a serverbased computing environment with
@@ -63,3 +62,39 @@ Description: X2Go http(s) based session broker (common files)
  .
  This package contains common files needed by all X2Go session
  brokers being package for this distribution.
+
+Package: x2gobroker-commmand
+Architecture: any
+Depends:
+ ${misc:Depends},
+Description: X2Go http(s) based session broker (common files)
+ X2Go is a serverbased computing environment with
+    - session resuming
+    - low bandwidth support
+    - LDAP support
+    - client side mass storage mounting support
+    - client side printing support
+    - audio support
+    - authentication by smartcard and USB stick
+ .
+ The session broker is a server tool for X2Go that
+ tells your X2Go Client application in a terminal
+ server cluster what servers and session types are
+ most appropriate for the user in front of the
+ X2Go terminal.
+ .
+ A session broker is most useful in load balanced
+ X2Go server farms.
+ .
+ This package contains a setuid backend command that
+ is required by the X2Go session broker.
+ .
+ WARNING: This packages installs the setuid wrapper
+ /usr/lib/x2go/broker/x2gobroker-command on your system.
+ This wrapper is only able to execute the Perl script
+ /usr/lib/x2go/broker/x2gobroker-command.pl. This is
+ done with setuid privileges.
+ .
+ If you hesitate to install this package, study the code
+ of the named wrapper and the named Perl script beforehand.
+ Nonetheless, you act on your own risk from here.
diff --git a/debian/rules b/debian/rules
index a190714..42ff909 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,3 +1,4 @@
 #!/usr/bin/make -f
 
+include /usr/share/cdbs/1/class/makefile.mk
 include /usr/share/cdbs/1/rules/debhelper.mk
\ No newline at end of file
diff --git a/debian/x2gobroker-common.install b/debian/x2gobroker-common.install
index 4f12f9f..e69de29 100644
--- a/debian/x2gobroker-common.install
+++ b/debian/x2gobroker-common.install
@@ -1 +0,0 @@
-lib/x2gobroker-command usr/lib/x2go/broker/
\ No newline at end of file
diff --git a/lib/x2gobroker-command b/lib/x2gobroker-command.pl
similarity index 98%
rename from lib/x2gobroker-command
rename to lib/x2gobroker-command.pl
index 425a5cf..ead8242 100755
--- a/lib/x2gobroker-command
+++ b/lib/x2gobroker-command.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/suidperl -TU
+#!/usr/bin/perl
 use strict;
 
 sub initUser
diff --git a/src/x2gobroker-command.c b/src/x2gobroker-command.c
new file mode 100644
index 0000000..36ba83d
--- /dev/null
+++ b/src/x2gobroker-command.c
@@ -0,0 +1,77 @@
+/*
+ * This file is part of the  X2Go Project - http://www.x2go.org
+ * Copyright (C) 2012 Mike Gabriel <mike.gabriel at das-netzwerkteam.de> 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the
+ * Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * 
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <libgen.h>
+#include <errno.h>
+
+int main( int argc, char *argv[] ) {
+	char * x2gobrokercmdpl = NULL;
+	size_t path_max;
+	
+/*
+	The following snippet is taken from the realpath manpage
+*/
+#ifdef PATH_MAX
+	path_max = PATH_MAX;
+#else
+	path_max = pathconf (".", _PC_PATH_MAX);
+	if (path_max <= 0){
+		path_max = 4096;
+	}
+#endif
+	{
+		// allocate dynamic buffer in stack: this needs C99 or gnu??
+		char buffer[path_max];
+		ssize_t rvrl;
+		int rvap;
+
+		// resolve link of /proc/self/exe to find out where we are
+		rvrl = readlink("/proc/self/exe", buffer, path_max);
+		if(rvrl == -1){
+			perror("readlink(\"/proc/self/exe\",buffer,path_max)");
+			exit(EXIT_FAILURE);
+		}
+		if(rvrl >= path_max){
+			fprintf(stderr, "Could not resolve the path of this file using \"/proc/self/exe\". The path is too long (> %i)", path_max);
+			exit(EXIT_FAILURE);
+		}
+
+		// derive the full path of x2gobroker-command.pl from path of this binary
+		rvap = asprintf(&x2gobrokercmdpl, "%s/%s", dirname(buffer), "x2gobroker-command.pl");
+		if(rvap == -1){
+			fprintf(stderr, "Failed to allocate memory calling asprintf\n");
+			exit(EXIT_FAILURE);
+		}
+
+		// execute the script, running with user-rights of this binary 
+		execv(x2gobrokercmdpl, argv);
+
+	}
+
+	// ...fail
+	fprintf(stderr, "Failed to execute %s: %s\n", x2gobrokercmdpl, strerror(errno));
+	return EXIT_FAILURE;
+
+}


hooks/post-receive
-- 
x2gobroker.git (Debian package x2gobroker)

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 "x2gobroker.git" (Debian package x2gobroker).




More information about the x2go-commits mailing list