The branch, master has been updated via 18c58ed55e34f187de88f584635e5fe2758f5003 (commit) from 3e00713c69fe2416045671bc3912216807fe86dc (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 18c58ed55e34f187de88f584635e5fe2758f5003 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Tue May 8 10:00:09 2012 +0200 Catch exceptions while calling SSH transport's getpeername() method. ----------------------------------------------------------------------- Summary of changes: debian/changelog | 1 + x2go/backends/control/_stdout.py | 26 +++++++++++++++++++++----- x2go/backends/terminal/_stdout.py | 2 +- x2go/session.py | 4 +++- 4 files changed, 26 insertions(+), 7 deletions(-) The diff of changes is: diff --git a/debian/changelog b/debian/changelog index 457c8a2..14dc935 100644 --- a/debian/changelog +++ b/debian/changelog @@ -122,6 +122,7 @@ python-x2go (0.1.2.0-0~x2go1) UNRELEASED; urgency=low - Protect session cache from deletion while being processed. - Adapt python-x2go to launching Unity-2d on Ubuntu precise. - Ignore X windows with empty title while finding session window.. + - Catch exceptions while calling SSH transport's getpeername() method. * Depend on python-xlib. -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Sat, 28 Sep 2012 01:44:21 +0100 diff --git a/x2go/backends/control/_stdout.py b/x2go/backends/control/_stdout.py index c727345..a5d08ba 100644 --- a/x2go/backends/control/_stdout.py +++ b/x2go/backends/control/_stdout.py @@ -170,7 +170,7 @@ class X2goControlSessionSTDOUT(paramiko.SSHClient): def _x2go_sftp_put(self, local_path, remote_path): - self.logger('sFTP-put: %s -> %s:%s' % (os.path.normpath(local_path), self.get_transport().getpeername(), remote_path), loglevel=log.loglevel_DEBUG) + self.logger('sFTP-put: %s -> %s:%s' % (os.path.normpath(local_path), self.remote_peername(), remote_path), loglevel=log.loglevel_DEBUG) try: self.sftp_client.put(os.path.normpath(local_path), remote_path) except x2go_exceptions.SSHException: @@ -179,18 +179,18 @@ class X2goControlSessionSTDOUT(paramiko.SSHClient): def _x2go_sftp_write(self, remote_path, content): - self.logger('sFTP-write: opening remote file %s on host %s for writing' % (remote_path, self.get_transport().getpeername()), loglevel=log.loglevel_DEBUG) + self.logger('sFTP-write: opening remote file %s on host %s for writing' % (remote_path, self.remote_peername()), loglevel=log.loglevel_DEBUG) try: remote_fileobj = self.sftp_client.open(remote_path, 'w') self.logger('sFTP-write: writing content: %s' % content, loglevel=log.loglevel_DEBUG_SFTPXFER) remote_fileobj.write(content) remote_fileobj.close() except x2go_exceptions.SSHException: - self.logger('sFTP-write: opening remote file %s on host %s failed' % (remote_path, self.get_transport().getpeername()), loglevel=log.loglevel_WARN) + self.logger('sFTP-write: opening remote file %s on host %s failed' % (remote_path, self.remote_peername()), loglevel=log.loglevel_WARN) def _x2go_sftp_remove(self, remote_path): - self.logger('sFTP-write: removing remote file %s on host %s' % (remote_path, self.get_transport().getpeername()), loglevel=log.loglevel_DEBUG) + self.logger('sFTP-write: removing remote file %s on host %s' % (remote_path, self.remote_peername()), loglevel=log.loglevel_DEBUG) self.sftp_client.remove(remote_path) def _x2go_exec_command(self, cmd_line, loglevel=log.loglevel_INFO, timeout=20, **kwargs): @@ -307,7 +307,23 @@ class X2goControlSessionSTDOUT(paramiko.SSHClient): """ if self.get_transport() is not None: - return self.get_transport().get_username() + try: + return self.get_transport().get_username() + except: + raise x2go_exceptions.X2goControlSessionException('Lost connection to X2Go server') + else: + return None + + def remote_peername(self): + """\ + Returns the control session's remote host (name or ip). + + """ + if self.get_transport() is not None: + try: + return self.get_transport().getpeername() + except: + raise x2go_exceptions.X2goControlSessionException('Lost connection to X2Go server') else: return None diff --git a/x2go/backends/terminal/_stdout.py b/x2go/backends/terminal/_stdout.py index 5ed8d83..c8a1ec1 100644 --- a/x2go/backends/terminal/_stdout.py +++ b/x2go/backends/terminal/_stdout.py @@ -1159,7 +1159,7 @@ class X2goTerminalSessionSTDOUT(object): try: self.session_info.initialize(_stdout, username=self.control_session.remote_username(), - hostname=self.control_session.get_transport().getpeername(), + hostname=self.control_session.remote_peername(), ) except ValueError: raise x2go_exceptions.X2goTerminalSessionException("failed to start X2Go session") diff --git a/x2go/session.py b/x2go/session.py index cede735..e22014d 100644 --- a/x2go/session.py +++ b/x2go/session.py @@ -721,8 +721,10 @@ class X2goSession(object): @rtype: C{tuple} """ - return self.control_session.get_transport().getpeername() + return self.control_session.remote_peername() __get_server_peername = get_server_peername + remote_peername = get_server_peername + __remote_peername = get_server_peername def get_server_hostname(self): """\ 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).