[X2Go-Commits] [python-x2go] 01/02: Preserve class-wide control session options (like add_to_known_hosts, forward_sshagent, etc.). Thanks to Dick Kniep for reporting this.

git-admin at x2go.org git-admin at x2go.org
Mon Feb 10 17:01:28 CET 2014


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

x2go pushed a commit to branch brokerclient
in repository python-x2go.

commit 6b2929a13a086fc9c0bbf234f492a49c11ab6643
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Mon Feb 10 17:00:25 2014 +0100

    Preserve class-wide control session options (like add_to_known_hosts, forward_sshagent, etc.). Thanks to Dick Kniep for reporting this.
---
 debian/changelog               |    2 ++
 x2go/backends/control/plain.py |   25 +++++++++++++++++--------
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 1204581..5a9604d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -18,6 +18,8 @@ python-x2go (0.4.0.10-0x2go1) UNRELEASED; urgency=low
     - Don't pass default values to ConfigParser constructor when initializing
       an INI file.
     - Return color depth on MS Windows machines.
+    - Preserve class-wide control session options (like add_to_known_hosts,
+      forward_sshagent, etc.). Thanks to Dick Kniep for reporting this.
 
  -- Mike Gabriel <mike.gabriel at das-netzwerkteam.de>  Sun, 05 Jan 2014 16:35:57 +0100
 
diff --git a/x2go/backends/control/plain.py b/x2go/backends/control/plain.py
index 75fc053..bb0ec98 100644
--- a/x2go/backends/control/plain.py
+++ b/x2go/backends/control/plain.py
@@ -700,10 +700,12 @@ class X2GoControlSession(paramiko.SSHClient):
                 use_sshproxy=False, sshproxy_host=None, sshproxy_port=22, sshproxy_user=None, sshproxy_password=None, sshproxy_force_password_auth=False,
                 sshproxy_key_filename=None, sshproxy_pkey=None, sshproxy_look_for_keys=False, sshproxy_passphrase='', sshproxy_allow_agent=False,
                 sshproxy_tunnel=None,
+                add_to_known_hosts=None,
                 forward_sshagent=None,
                 unique_hostkey_aliases=None,
+                force_password_auth=False,
                 session_instance=None,
-                add_to_known_hosts=False, force_password_auth=False):
+        ):
         """\
         Connect to an X2Go server and authenticate to it. This method is directly
         inherited from the C{paramiko.SSHClient} class. The features of the Paramiko
@@ -820,13 +822,19 @@ class X2GoControlSession(paramiko.SSHClient):
         if type(sshproxy_password) not in (types.StringType, types.UnicodeType):
             sshproxy_password = ''
 
-        if unique_hostkey_aliases is not None:
-            self.unique_hostkey_aliases = unique_hostkey_aliases
-            # prep the fake hostname with the real hostname, so we trigger the corresponding code path in 
-            # x2go.checkhosts and either of its missing host key policies
-            if self.unique_hostkey_aliases:
-                if port != 22: _fake_hostname = "[%s]:%s" % (hostname, port)
-                else: _fake_hostname = hostname
+        if unique_hostkey_aliases is None:
+            unique_hostkey_aliases = self.unique_hostkey_aliases
+        # prep the fake hostname with the real hostname, so we trigger the corresponding code path in 
+        # x2go.checkhosts and either of its missing host key policies
+        if unique_hostkey_aliases:
+            if port != 22: _fake_hostname = "[%s]:%s" % (hostname, port)
+            else: _fake_hostname = hostname
+
+        if add_to_known_hosts is None:
+            add_to_known_hosts = self.add_to_known_hosts
+
+        if forward_sshagent is None:
+            forward_sshagent = self.forward_sshagent
 
         if look_for_keys:
             key_filename = None
@@ -841,6 +849,7 @@ class X2GoControlSession(paramiko.SSHClient):
                 if not sshproxy_tunnel:
                     sshproxy_tunnel = "localhost:44444:%s:%s" % (hostname, port)
                 self.sshproxy_session = sshproxy.X2GoSSHProxy(known_hosts=self.known_hosts,
+                                                              add_to_known_hosts=add_to_known_hosts,
                                                               sshproxy_host=sshproxy_host,
                                                               sshproxy_port=sshproxy_port,
                                                               sshproxy_user=sshproxy_user,

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



More information about the x2go-commits mailing list