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

X2go dev team git-admin at x2go.org
Tue Jul 19 14:03:00 CEST 2011


The branch, master has been updated
       via  dc8bfbe86594b7fb9185dfa1a92f6c976d1df45a (commit)
       via  fae45f199e643e777cfe929a8b2b5ac1fb5c87fd (commit)
      from  27cc5a7f19025d4e620c1c915edef7b1b4a3509c (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 dc8bfbe86594b7fb9185dfa1a92f6c976d1df45a
Author: Moritz 'Morty' Strübe <morty at gmx.net>
Date:   Tue Jul 19 12:00:20 2011 +0000

    Fix copyleft

commit fae45f199e643e777cfe929a8b2b5ac1fb5c87fd
Author: Moritz 'Morty' Strübe <morty at gmx.net>
Date:   Mon Jul 18 12:47:39 2011 +0200

    Make S-bit wrapper more robust

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

Summary of changes:
 x2goserver/x2gosqlitewrapper.c |   64 +++++++++++++++++++++++++++++++--------
 1 files changed, 51 insertions(+), 13 deletions(-)

The diff of changes is:
diff --git a/x2goserver/x2gosqlitewrapper.c b/x2goserver/x2gosqlitewrapper.c
index b702aa7..739c10d 100644
--- a/x2goserver/x2gosqlitewrapper.c
+++ b/x2goserver/x2gosqlitewrapper.c
@@ -1,5 +1,7 @@
 /*
- * Copyright (C) 2007-2011 X2go Project - http://wiki.x2go.org
+ * This file is part of the  X2go Project - http://www.x2go.org
+ * Copyright (C) 2011 Mike Gabriel <mike.gabriel at das-netzwerkteam.de> 
+ * Copyright (C) 2011 Moritz 'Morty' Strübe <morty at gmx.net>
  *
  * 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
@@ -16,30 +18,66 @@
  * Free Software Foundation, Inc.,
  * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * Copyright (C) 2007-2011  Oleksandr Shneyder <oleksandr.shneyder at obviously-nice.de>
- * Copyright (C) 2007-2011  Heinz-Markus Graesing <heinz-m.graesing at obviously-nice.de>
+ * 
  */
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <libgen.h>
+#include <errno.h>
+
 
-int main( int argc, char *argv[] ) {
 
-	char buffer[BUFSIZ];
+
+int main( int argc, char *argv[] ) {
 	char * x2gosqlitewrapper = 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 to long (> %i)", path_max);
+			exit(EXIT_FAILURE);
+		}
+
+
+		// derive the full path of x2gosqlitewrapper.pl from path of this binary
+		rvap = asprintf(&x2gosqlitewrapper, "%s/%s", dirname(dirname(buffer)), "lib/x2go/x2gosqlitewrapper.pl");
+		if(rvap == -1){
+			fprintf(stderr, "Failed to allocate memory calling asprintf\n");
+			exit(EXIT_FAILURE);
+		}
 
-	// resolve link of /proc/self/exe
-	readlink("/proc/self/exe", buffer, BUFSIZ);
 
-	// derive the full path of x2gosqlitewrapper.pl from path of this binary
-	asprintf(&x2gosqlitewrapper, "%s/%s", dirname(dirname(buffer)), "lib/x2go/x2gosqlitewrapper.pl");
+		// execute the script, running with user-rights of this binary 
+		execv(x2gosqlitewrapper, argv);
 
-	// execute the script, taking setuid bit into consideration if set...
-	execv(x2gosqlitewrapper, argv);
+	}
 
-	// fake a successful return value
-	return 0;
+	// ...fail
+	fprintf(stderr, "Failed to execute %s: %s\n", x2gosqlitewrapper, strerror(errno));
+	return EXIT_FAILURE;
 
 }


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