[X2Go-Commits] [x2goserver] 02/02: Start sshfs with a timeout of 30 seconds (because it never finishes if something is wrong with the client-side TCP socket). Also remove/unmount mountpoints erroneously registered sshfs mountpoints if sshfs command times out. (Fixes: #405).

git-admin at x2go.org git-admin at x2go.org
Thu Jan 8 15:23:53 CET 2015


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2goserver.

commit fdf4ca1949d2e8e52dfe34ffd8e4ee565980c0a8
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Thu Jan 8 13:26:21 2015 +0100

    Start sshfs with a timeout of 30 seconds (because it never finishes if something is wrong with the client-side TCP socket). Also remove/unmount mountpoints erroneously registered sshfs mountpoints if sshfs command times out. (Fixes: #405).
    
    Conflicts:
    	x2goserver/bin/x2gomountdirs
---
 debian/changelog             |    5 +++++
 x2goserver/bin/x2gomountdirs |   11 +++++++----
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index fe579b6..1e80d95 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -200,6 +200,11 @@ x2goserver (4.0.1.19-0x2go1) UNRELEASED; urgency=medium
     - Improve sanitizer, use 'x2gosid' sanitizer for session IDs everywhere.
       Drop unused 'pnixusername' sanitizer in 4.0.1.x release of X2Go Server.
     - Allow usernames in session IDs of length 48 chars.
+    - Start sshfs with a timeout of 30 seconds (because it never finishes if
+      something is wrong with the client-side TCP socket). Also remove/unmount
+      mountpoints erroneously registered sshfs mountpoints if sshfs command
+      times out. Furthermore, print errors to STDERR (not STDOUT). (Fixes:
+      #405).
   * debian/control:
     + Add D (x2goserver): libfile-which-perl.
     + Add C (x2goserver: x2godesktopsharing (<< 3.1.1.2).
diff --git a/x2goserver/bin/x2gomountdirs b/x2goserver/bin/x2gomountdirs
index 7c93a9e..efbfab2 100755
--- a/x2goserver/bin/x2gomountdirs
+++ b/x2goserver/bin/x2gomountdirs
@@ -284,12 +284,12 @@ for (my $i=0;$i<@dirs;$i++)
 		{
 			syslog('debug', "SSH host key has arrived: $key.ident");
 		}
-		$msg = "sshfs $code_conv -o idmap=user,uid=`id -u`,gid=`id -g`,$umaskstr,ServerAliveInterval=300,Cipher=blowfish,IdentityFile=$key,UserKnownHostsFile=$key.ident \"$user\"\@$host:\"@dirs[$i]\" \"$mntpath\" -p $port";
+		$msg = "timeout 30 sshfs $code_conv -o idmap=user,uid=`id -u`,gid=`id -g`,$umaskstr,ServerAliveInterval=300,Cipher=blowfish,IdentityFile=$key,UserKnownHostsFile=$key.ident \"$user\"\@$host:\"@dirs[$i]\" \"$mntpath\" -p $port";
 		syslog('debug', "executing: $msg");
 		print "inserted, $msg\n";
 
 		# FIXME: this system call should be converted to a multi-argument system call while pertaining the redirect of stderr to the mounts.log file
-		if (system("sshfs  $code_conv -o idmap=user,uid=`id -u`,gid=`id -g`,$umaskstr,ServerAliveInterval=300,Cipher=blowfish,IdentityFile=$key,UserKnownHostsFile=$key.ident \"$user\"\@$host:\"@dirs[$i]\" \"$mntpath\" -p $port 1>>$sessiondir/sshfs-mounts.log 2>&1")==0)
+		if (system("timeout 30 sshfs $code_conv -o idmap=user,uid=`id -u`,gid=`id -g`,$umaskstr,ServerAliveInterval=300,Cipher=blowfish,IdentityFile=$key,UserKnownHostsFile=$key.ident \"$user\"\@$host:\"@dirs[$i]\" \"$mntpath\" -p $port 1>>$sessiondir/sshfs-mounts.log 2>&1")==0)
 		{
 			print "mount @dirs[$i] ok\n";
 			syslog('notice', "successfully mounted $user\@$host:$port at dirs[$i] to $mntpath");
@@ -371,9 +371,12 @@ for (my $i=0;$i<@dirs;$i++)
 		else
 		{
 			$msg = "mounting of @dirs[$i] failed";
-			print "$msg\n";
+			print STDERR "$msg\n";
 			syslog('warning', "WARNING: $msg");
 			db_deletemount( $session, $mntpath);
+			# it maybe possible that the sshfs mount is already registered with the
+			# kernel, but dysfunctional. Attempting removal...
+			system("fusermount", "-u", "$mntpath");
 			rmdir($mntpath);
 		}
 	}
@@ -381,7 +384,7 @@ for (my $i=0;$i<@dirs;$i++)
 	{
 		$msg = "insertion of @dirs[$i] failed (already mounted?), not mounting";
 		syslog('warning', "WARNING: $msg");
-		print "$msg\n";
+		print STDERR "$msg\n";
 	}
 }
 

--
Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goserver.git


More information about the x2go-commits mailing list