[X2go-Commits] x2goserver.git - master (branch) updated: 3.0.99.10-27-g305f7e8

X2go dev team git-admin at x2go.org
Tue Feb 21 16:36:25 CET 2012


The branch, master has been updated
       via  305f7e897420aa9b0e151ffd37b7e1dd62def9e8 (commit)
      from  adabd159ef48fad1bb827c76c17a2604d30ec4b5 (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 305f7e897420aa9b0e151ffd37b7e1dd62def9e8
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Tue Feb 21 16:36:21 2012 +0100

    Tolerate user names containing "-" characters (SQLite DB backend).

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

Summary of changes:
 debian/changelog                    |    1 +
 x2goserver/lib/x2gosqlitewrapper.pl |   18 ++++++++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index 56dde28..4c36ff3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -37,6 +37,7 @@ x2goserver (3.1.0.0-0~x2go1) UNRELEASED; urgency=low
       /tmp. Use ENV{'TMP'} instead, unless it is empty. Then use /tmp.
     - Place quotations where appropriate into shell scripts.
     - Fix call to x2goterminate-desktopsharing in x2goruncommand.
+    - Tolerate user names containing "-" characters (SQLite DB backend).
   * Let x2goserver package suggest x2goserver-fmbindings.
 
  -- Mike Gabriel <mike.gabriel at das-netzwerkteam.de>  Wed, 01 Feb 2012 13:45:00 +0100
diff --git a/x2goserver/lib/x2gosqlitewrapper.pl b/x2goserver/lib/x2gosqlitewrapper.pl
index ac8a7c6..c09f3fc 100755
--- a/x2goserver/lib/x2gosqlitewrapper.pl
+++ b/x2goserver/lib/x2gosqlitewrapper.pl
@@ -322,12 +322,26 @@ sub checkroot
 sub check_user
 {
 	my $sid=shift or die "argument \"session_id\" missed";
-	return if $realuser eq "root";
 	# session id looks like someuser-51-1304005895_stDgnome-session_dp24
-	my ( $user, $rest ) = split('-', $sid, 2);
+	$sid = standardize_sid($sid);
+	return if $realuser eq "root";
+	# pass $sid backwards so that we can tolerate "-" chars in user names
+	my ($f4, $f3, $f2, @user) = reverse(split('-', $sid,));
+	my $user = join('-', reverse(@user));
 	$user eq $realuser or die "$realuser is not authorized (should be $user)";
 }
 
+sub standardize_sid
+{
+	my $sid=shift;
+	my @sid_fields = split('-', $sid);
+	while (@sid_fields <= 4)
+	{
+		push(@sid_fields, ('DUMMY'));
+	}
+	return join('-', @sid_fields);
+}
+
 sub fetchrow_printall_array
 {
 	# print all arrays separated by the pipe symbol


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