[X2go-Commits] python-x2go.git - master (branch) updated: 0.1.0.3-18-g2e6f672

X2go dev team git-admin at x2go.org
Tue Jun 21 12:25:26 CEST 2011


The branch, master has been updated
       via  2e6f672fc9127f84cbc0b9d8f42c39f0a44a0565 (commit)
       via  49301f618fa80662ce7b1ababc36f7c1e1d5abf3 (commit)
      from  a93a3515718f8308feff5a704bfded92df932e1f (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 -----------------------------------------------------------------
commit 2e6f672fc9127f84cbc0b9d8f42c39f0a44a0565
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Tue Jun 21 12:24:55 2011 +0200

    Forget SSH proxy password after auth failures, fix local folder sharing.

commit 49301f618fa80662ce7b1ababc36f7c1e1d5abf3
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Tue Jun 21 12:23:33 2011 +0200

    dropping redundant code in cache.py

-----------------------------------------------------------------------

Summary of changes:
 x2go/cache.py   |   14 ++++++--------
 x2go/session.py |   44 +++++++++++++++++++++++++-------------------
 2 files changed, 31 insertions(+), 27 deletions(-)

The diff of changes is:
diff --git a/x2go/cache.py b/x2go/cache.py
index 7bd8b88..7a7fb1d 100644
--- a/x2go/cache.py
+++ b/x2go/cache.py
@@ -112,12 +112,14 @@ class X2goListSessionsCache(object):
         @type profile_name: C{str}
 
         """
+        self.last_listsessions_cache = copy.deepcopy(self.x2go_listsessions_cache)
+        control_session = self.client_instance.client_control_session_of_profile_name(profile_name)
         if not self.x2go_listsessions_cache.has_key(profile_name):
             self.x2go_listsessions_cache[profile_name] = {}
-        self._update_sessions(profile_name)
-        self._update_desktops(profile_name)
+        self._update_sessions(profile_name, control_session)
+        self._update_desktops(profile_name, control_session)
 
-    def _update_desktops(self, profile_name):
+    def _update_desktops(self, profile_name, control_session):
         """\
         Update session lists of L{X2goListSessionsCache} for session profile C{profile_name}.
 
@@ -125,8 +127,6 @@ class X2goListSessionsCache(object):
         @type profile_name: C{str}
 
         """
-        self.last_listsessions_cache = copy.deepcopy(self.x2go_listsessions_cache)
-        control_session = self.client_instance.client_control_session_of_profile_name(profile_name)
         try:
             self.x2go_listsessions_cache[profile_name]['desktops'] = control_session.list_desktops()
         except x2go_exceptions.X2goControlSessionException, e:
@@ -136,7 +136,7 @@ class X2goListSessionsCache(object):
                 pass
             raise e
 
-    def _update_sessions(self, profile_name):
+    def _update_sessions(self, profile_name, control_session):
         """\
         Update desktop list of L{X2goListSessionsCache} for session profile C{profile_name}.
 
@@ -144,8 +144,6 @@ class X2goListSessionsCache(object):
         @type profile_name: C{str}
 
         """
-        self.last_listsessions_cache = copy.deepcopy(self.x2go_listsessions_cache)
-        control_session = self.client_instance.client_control_session_of_profile_name(profile_name)
         try:
             self.x2go_listsessions_cache[profile_name]['sessions'] = control_session.list_sessions()
         except x2go_exceptions.X2goControlSessionException, e:
diff --git a/x2go/session.py b/x2go/session.py
index 7278e34..52cb682 100644
--- a/x2go/session.py
+++ b/x2go/session.py
@@ -704,16 +704,22 @@ class X2goSession(object):
             _params.update(self.control_params)
             _params.update(self.sshproxy_params)
 
-            self.connected = self.control_session.connect(self.server,
-                                                          use_sshproxy=self.use_sshproxy, 
-                                                          session_instance=self, 
-                                                          **_params)
-            # remove credentials immediately
-            self.control_params['password'] = ''
-            try: del self.sshproxy_params['sshproxy_user']
-            except KeyError: pass
-            try: del self.sshproxy_params['sshproxy_password']
-            except KeyError: pass
+            try:
+                self.connected = self.control_session.connect(self.server,
+                                                              use_sshproxy=self.use_sshproxy, 
+                                                              session_instance=self, 
+                                                              **_params)
+            except:
+                # remove credentials immediately
+                self.control_params['password'] = ''
+                if self.sshproxy_params and self.sshproxy_params.has_key('sshproxy_password'):
+                    del self.sshproxy_params['sshproxy_password']
+                raise
+            finally:
+                # remove credentials immediately
+                self.control_params['password'] = ''
+                if self.sshproxy_params and self.sshproxy_params.has_key('sshproxy_password'):
+                    del self.sshproxy_params['sshproxy_password']
 
             if not self.connected:
                 # then tidy up...
@@ -932,33 +938,34 @@ class X2goSession(object):
 
             if _terminal is not None:
 
-                if SUPPORTED_SOUND and _terminal.params.snd_system is not 'none':
+                self.terminal_session = _terminal
+                if SUPPORTED_SOUND and self.terminal_session.params.snd_system is not 'none':
                     _terminal.start_sound()
 
                 if (SUPPORTED_PRINTING and self.printing) or \
                    (SUPPORTED_MIMEBOX and self.allow_mimebox) or \
                    (SUPPORTED_FOLDERSHARING and self.allow_share_local_folders):
-                    _terminal.start_sshfs()
+                    self.terminal_session.start_sshfs()
 
                 try:
                     if SUPPORTED_PRINTING and self.printing:
-                        _terminal.start_printing()
-                        self.session_environment.update({'X2GO_SPOOLDIR': _terminal.get_printing_spooldir(), })
+                        self.terminal_session.start_printing()
+                        self.session_environment.update({'X2GO_SPOOLDIR': self.terminal_session.get_printing_spooldir(), })
                 except X2goUserException:
                     pass
 
                 if SUPPORTED_MIMEBOX and self.allow_mimebox:
-                        _terminal.start_mimebox(mimebox_extensions=self.mimebox_extensions, mimebox_action=self.mimebox_action)
-                        self.session_environment.update({'X2GO_MIMEBOX': _terminal.get_mimebox_spooldir(), })
+                        self.terminal_session.start_mimebox(mimebox_extensions=self.mimebox_extensions, mimebox_action=self.mimebox_action)
+                        self.session_environment.update({'X2GO_MIMEBOX': self.terminal_session.get_mimebox_spooldir(), })
 
                 if SUPPORTED_FOLDERSHARING and self.share_local_folders:
-                    if _control.get_transport().reverse_tunnels[_terminal.get_session_name()]['sshfs'][1] is not None:
+                    if _control.get_transport().reverse_tunnels[self.terminal_session.get_session_name()]['sshfs'][1] is not None:
                         for _folder in self.share_local_folders:
                             self.share_local_folder(_folder)
 
                 # only run the session startup command if we do not resume...
                 if _new_session:
-                    _terminal.run_command(env=self.session_environment)
+                    self.terminal_session.run_command(env=self.session_environment)
 
                 self.virgin = False
                 self.suspended = False
@@ -966,7 +973,6 @@ class X2goSession(object):
                 self.terminated = False
                 self.faulty = False
 
-                self.terminal_session = _terminal
                 return True
 
             else:


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