[X2go-Commits] x2gobroker.git - master (branch) updated: 0.0.0.5-46-g20c45b2

X2Go dev team git-admin at x2go.org
Mon Mar 4 23:51:15 CET 2013


The branch, master has been updated
       via  20c45b24317270cad9d201b307f2a2041bf8b57d (commit)
      from  fee39f5a3c8de2ab8ac1d3c32e534a568aa50f74 (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 20c45b24317270cad9d201b307f2a2041bf8b57d
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Mon Mar 4 23:51:06 2013 +0100

    simplify sanity checks in addauthkey/delauthkey function of x2gobroker agent

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

Summary of changes:
 lib/x2gobroker-agent.pl |   26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)

The diff of changes is:
diff --git a/lib/x2gobroker-agent.pl b/lib/x2gobroker-agent.pl
index 1e98d9d..9511858 100755
--- a/lib/x2gobroker-agent.pl
+++ b/lib/x2gobroker-agent.pl
@@ -61,16 +61,14 @@ sub AddAuthKey
 	$authkeyfile =~ s/%%/%/;
 
 	my $authkeydir = dirname($authkeyfile);
-
-	# make sure dir and file for authorized_keys do exist
-	if ( ! -d $authkeydir )
+	if ( ! $authkeyfile =~ m/\/.*/ )
 	{
-		system ("su - $uid -c \"mkdir -p $authkeydir\"");
-	}
-	if( ! -e $authkeyfile  )
-	{
-		system ("su - $uid -c \"touch $authkeyfile\"");
+		$authkeyfile = "$home/$authkeyfile";
 	}
+
+	# make sure dir and file for authorized_keys do exist
+	system ("su - $uid -c \"mkdir -p $authkeydir\"");
+	system ("su - $uid -c \"touch $authkeyfile\"");
 	my $authorized_keys = `su - $uid -c \"cat $authkeyfile\"`;
 	if ( ! ( $authorized_keys =~ m/$pubkey/ ) )
 	{
@@ -86,17 +84,11 @@ sub DelAuthKey
 	$authkeyfile =~ s/%u/$uid/;
 	$authkeyfile =~ s/%h/$home/;
 	$authkeyfile =~ s/%%/%/;
-
-	my $authkeydir = dirname($authkeyfile);
-
-	if( -e $authkeyfile  )
+	if ( ! $authkeyfile =~ m/\/.*/ )
 	{
-		my $authorized_keys = `su - $uid -c \"cat $authkeyfile\"`;
-		if ( ! ( $authorized_keys =~ m/$pubkey/ ) )
-		{
-			system("su - $uid -c \"sed -e s/'$pubkey'// -i $authkeyfile\"");
-		}
+		$authkeyfile = "$home/$authkeyfile";
 	}
+	system("su - $uid -c \"sed -e s\!'$pubkey'\!''\! -i $authkeyfile\" 1>/dev/null 2>/dev/null");
 }
 
 $< = $>;


hooks/post-receive
-- 
x2gobroker.git (HTTP(S) Session broker for X2Go)

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" (HTTP(S) Session broker for X2Go).




More information about the x2go-commits mailing list