[X2Go-Commits] [x2goserver] 01/01: 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:54 CET 2015
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch release/4.0.1.x
in repository x2goserver.
commit d6b726dc6b9ad2945d3a3218ce2eeaef6474257a
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).
---
debian/changelog | 5 +++++
x2goserver/bin/x2gomountdirs | 21 +++++++++++++++++----
2 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 4d34828..bf219da 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -55,6 +55,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 8ef6ba0..52b8c6d 100755
--- a/x2goserver/bin/x2gomountdirs
+++ b/x2goserver/bin/x2gomountdirs
@@ -296,10 +296,20 @@ for (my $i=0;$i<@dirs;$i++)
{
$code_conv="-o $code_conv";
}
- $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";
+ if ( -f "$key" )
+ {
+ syslog('debug', "SSH key file has arrived: $key");
+ }
+ if ( -f "$key.ident" )
+ {
+ syslog('debug', "SSH host key has arrived: $key.ident");
+ }
+ $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";
- 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)
+
+ # 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("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");
@@ -381,9 +391,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);
}
}
@@ -391,7 +404,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