[X2Go-Commits] python-x2go.git - release/0.4.0.x (branch) updated: 0.1.1.4-176-g572d145

X2Go dev team git-admin at x2go.org
Tue Jan 7 16:17:49 CET 2014


The branch, release/0.4.0.x has been updated
       via  572d145da7979de0dadb5b6f569d03754f67de3a (commit)
      from  98dfd3538c3c9bdadb61965e5968aafc70a3891e (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 |    2 ++
 x2go/session.py  |   10 ++++++++++
 x2go/sshproxy.py |   14 ++++++++++++++
 3 files changed, 26 insertions(+)

The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index 61a1016..34daac1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -80,6 +80,8 @@ python-x2go (0.1.2.0-0~x2go1) UNRELEASED; urgency=low
     - Fix metatype detection of session profiles.
     - Implement X2Go-Top category in .desktop files that get used in the
       context of published applications.
+    - If the SSH proxy connection tries to bind to a used port, detect an
+      unused local port and write this port change to the session profile.
   * Depend on python-xlib.
 
  -- Mike Gabriel <mike.gabriel at das-netzwerkteam.de>  Sat, 28 Sep 2012 01:44:21 +0100
diff --git a/x2go/session.py b/x2go/session.py
index a1dc490..49816cf 100644
--- a/x2go/session.py
+++ b/x2go/session.py
@@ -320,6 +320,16 @@ class X2goSession(object):
         if self.is_connected():
             self.retrieve_server_features()
 
+    def get_client_instance(self):
+        """\
+        Return parent L{X2goClient} instance if avaiable.
+
+        return: L{X2goClient} instance this session is associated with
+        rtype: C{obj}
+
+        """
+        return self.client_instance
+
     def HOOK_auto_connect(self):
         """\
         HOOK method: called if the session demands to auto connect.
diff --git a/x2go/sshproxy.py b/x2go/sshproxy.py
index 5817da3..53dc8b9 100644
--- a/x2go/sshproxy.py
+++ b/x2go/sshproxy.py
@@ -170,6 +170,11 @@ class X2goSSHProxy(paramiko.SSHClient, threading.Thread):
             username = _CURRENT_LOCAL_USER
 
         self._keepalive = True
+        self.session_instance = session_instance
+
+        self.client_instance = None
+        if self.session_instance is not None:
+            self.client_instance = self.session_instance.get_client_instance()
 
         self.ssh_rootdir = ssh_rootdir
         paramiko.SSHClient.__init__(self)
@@ -258,6 +263,15 @@ class X2goSSHProxy(paramiko.SSHClient, threading.Thread):
         """
         if self.get_transport() is not None and self.get_transport().is_authenticated():
             self.local_port = utils.detect_unused_port(bind_address=self.local_host, preferred_port=self.local_port)
+            if self.client_instance is not None:
+                _profile_id = self.session_instance.get_profile_id()
+                if self.client_instance.session_profiles.has_profile(_profile_id):
+                    self.client_instance.session_profiles.update_value(_profile_id,
+                                                                       'sshproxytunnel',
+                                                                       '%s:%s:%s:%s' % (self.local_host, self.local_port, self.remote_host, self.remote_port)
+                                                                      )
+                self.client_instance.session_profiles.write_user_config = True
+                self.client_instance.session_profiles.write()
             self.fw_tunnel = forward.start_forward_tunnel(local_host=self.local_host,
                                                           local_port=self.local_port,
                                                           remote_host=self.remote_host,


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