[X2go-Commits] python-x2go.git - build-main (branch) updated: 0.1.1.2-8-g1e88fc4

X2go dev team git-admin at x2go.org
Wed Jul 6 22:15:16 CEST 2011


The branch, build-main has been updated
       via  1e88fc4810c4a2ab6e3fa9073f61347f538ac93a (commit)
       via  d843f23c1e4d2df3cccb1ede0ce67653309f7898 (commit)
       via  dfb613dbfe8c96c12d1150c64bc86368b8cb70a5 (commit)
      from  d5f871ba0fa17cd63dc3bca118844ec74f3ebb03 (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 -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 debian/changelog                 |    7 +++++--
 x2go/backends/control/_stdout.py |   21 +++++++++++++++------
 x2go/session.py                  |    2 ++
 x2go/sshproxy.py                 |   14 ++++++++++++--
 4 files changed, 34 insertions(+), 10 deletions(-)

The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index 9ca8382..1d263ac 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,4 +1,4 @@
-python-x2go (0.1.1.3-0~x2go1) UNRELEASED; urgency=low
+python-x2go (0.1.1.3-0~x2go1) unstable; urgency=low
 
   * New upstream version (0.1.1.3):
     - README/TODO update.
@@ -7,8 +7,11 @@ python-x2go (0.1.1.3-0~x2go1) UNRELEASED; urgency=low
     - Fix AttributeError if no graphical proxy instance has been declared yet.
     - Do not allow any interruption during X2go cleanup calls.
     - Stabilize desktop sharing if the remote session is not available.
+    - Enforce IPv4 on all SSH proxy and other SSHClient connections when connecting to
+      ''localhost''.
+    - Detect SFTP client connections failures, abort session if that happens.
 
- -- Mike Gabriel <mike.gabriel at das-netzwerkteam.de>  Fri, 01 Jul 2011 14:53:48 +0200
+ -- Mike Gabriel <mike.gabriel at das-netzwerkteam.de>  Wed, 06 Jul 2011 22:15:01 +0200
 
 python-x2go (0.1.1.2-0~x2go1) unstable; urgency=low
 
diff --git a/x2go/backends/control/_stdout.py b/x2go/backends/control/_stdout.py
index 059d091..4b6c947 100644
--- a/x2go/backends/control/_stdout.py
+++ b/x2go/backends/control/_stdout.py
@@ -383,13 +383,19 @@ class X2goControlSessionSTDOUT(paramiko.SSHClient):
             key_filename = None
             pkey = None
 
-        self.logger('connecting to %s' % hostname, loglevel=log.loglevel_NOTICE)
+        self.logger('connecting to [%s]:%s' % (hostname, port), loglevel=log.loglevel_NOTICE)
 
         self.load_session_host_keys()
+
+        _hostname = hostname
+        # enforce IPv4 for localhost address
+        if _hostname == 'localhost':
+            _hostname = '127.0.0.1'
+
         if (key_filename and os.path.exists(os.path.normpath(key_filename))) or pkey:
             try:
                 self.logger('trying SSH pub/priv key authentication with server', loglevel=log.loglevel_DEBUG)
-                paramiko.SSHClient.connect(self, hostname, port=port, username=username, pkey=pkey,
+                paramiko.SSHClient.connect(self, _hostname, port=port, username=username, pkey=pkey,
                                            key_filename=key_filename, timeout=timeout, allow_agent=allow_agent, 
                                            look_for_keys=look_for_keys)
 
@@ -398,7 +404,7 @@ class X2goControlSessionSTDOUT(paramiko.SSHClient):
                 if password:
                     self.logger('next auth mechanism we\'ll try is keyboard-interactive authentication', loglevel=log.loglevel_DEBUG)
                     try:
-                        paramiko.SSHClient.connect(self, hostname, port=port, username=username, password=password,
+                        paramiko.SSHClient.connect(self, _hostname, port=port, username=username, password=password,
                                                    timeout=timeout, allow_agent=allow_agent, 
                                                    look_for_keys=look_for_keys)
                     except paramiko.AuthenticationException, e:
@@ -430,7 +436,7 @@ class X2goControlSessionSTDOUT(paramiko.SSHClient):
                 password = "".join([random.choice(string.letters+string.digits) for x in range(1, 20)])
             self.logger('performing SSH keyboard-interactive authentication with server', loglevel=log.loglevel_DEBUG)
             try:
-                paramiko.SSHClient.connect(self, hostname, port=port, username=username, password=password,
+                paramiko.SSHClient.connect(self, _hostname, port=port, username=username, password=password,
                                            timeout=timeout, allow_agent=allow_agent, look_for_keys=look_for_keys)
             except paramiko.AuthenticationException, e:
                 self.close()
@@ -448,8 +454,11 @@ class X2goControlSessionSTDOUT(paramiko.SSHClient):
         self.hostname = hostname
         self.port = port
 
-        # if we succeed, we immediately grab us an sFTP client session
-        self.sftp_client = self.open_sftp()
+	# if we succeed, we immediately grab us an sFTP client session
+        try:
+            self.sftp_client = self.open_sftp()
+        except:
+            raise x2go_exceptions.X2goControlSessionException('could not invoke server-side SFTP subsystem')
 
         # preparing reverse tunnels
         ssh_transport = self.get_transport()
diff --git a/x2go/session.py b/x2go/session.py
index d4500d1..11f0cdd 100644
--- a/x2go/session.py
+++ b/x2go/session.py
@@ -755,6 +755,8 @@ class X2goSession(object):
                                                               use_sshproxy=self.use_sshproxy, 
                                                               session_instance=self, 
                                                               **_params)
+            except X2goControlSessionException, e:
+                raise X2goSessionException(str(e))
             except:
                 # remove credentials immediately
                 self.control_params['password'] = ''
diff --git a/x2go/sshproxy.py b/x2go/sshproxy.py
index 3d08a35..dcf7f51 100644
--- a/x2go/sshproxy.py
+++ b/x2go/sshproxy.py
@@ -136,6 +136,7 @@ class X2goSSHProxy(paramiko.SSHClient, threading.Thread):
                 except IndexError: pass
             else:
                 self.hostname = sshproxy_host
+
         if sshproxy_user: self.username = sshproxy_user
         if sshproxy_password: password = sshproxy_password
         if sshproxy_key_filename: key_filename = sshproxy_key_filename
@@ -150,6 +151,15 @@ class X2goSSHProxy(paramiko.SSHClient, threading.Thread):
             self.remote_host = remote_host
             self.remote_port = int(remote_port)
 
+        # enforce IPv4 for localhost addresses!!!
+        _hostname = self.hostname
+        if _hostname == 'localhost':
+            _hostname = '127.0.0.1'
+        if self.local_host == 'localhost':
+            self.local_host = '127.0.0.1'
+        if self.remote_host == 'localhost':
+            self.remote_host = '127.0.0.1'
+
         if username is None:
             username = _CURRENT_LOCAL_USER
 
@@ -171,7 +181,7 @@ class X2goSSHProxy(paramiko.SSHClient, threading.Thread):
         try:
             if (key_filename and os.path.exists(os.path.normpath(key_filename))) or pkey:
                 try:
-                    self.connect(self.hostname, port=self.port, 
+                    self.connect(_hostname, port=self.port, 
                                  username=self.username, 
                                  key_filename=key_filename,
                                  pkey=pkey,
@@ -191,7 +201,7 @@ class X2goSSHProxy(paramiko.SSHClient, threading.Thread):
                 if not password:
                     password = "".join([random.choice(string.letters+string.digits) for x in range(1, 20)])
                 try:
-                    self.connect(self.hostname, port=self.port,
+                    self.connect(_hostname, port=self.port,
                                  username=self.username,
                                  password=password,
                                  look_for_keys=False,


hooks/post-receive
-- 
python-x2go.git (Python X2go Client API)

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 "python-x2go.git" (Python X2go Client API).




More information about the x2go-commits mailing list