[X2go-Commits] python-x2go.git - master (branch) updated: 0.1.1.4-8-gaa33a93

X2go dev team git-admin at x2go.org
Wed Jul 20 19:41:49 CEST 2011


The branch, master has been updated
       via  aa33a9393230debfcff65997e1f4cff724faf418 (commit)
       via  07dc7771aad40611427ad7953a89be9ac52b789e (commit)
       via  3c50a9d2584b10c573fd3762ceb527b03f8df20a (commit)
      from  4f2a4126df79a1abb0fc111f51e747a59189835e (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 aa33a9393230debfcff65997e1f4cff724faf418
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Wed Jul 20 19:41:56 2011 +0200

    manually merged in changelog entries from release/0.1.1.x branch

commit 07dc7771aad40611427ad7953a89be9ac52b789e
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Wed Jul 20 19:36:09 2011 +0200

    Handle full path cmd strings adequately: check existence of full path, but use basename for cmd startup.

commit 3c50a9d2584b10c573fd3762ceb527b03f8df20a
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Wed Jul 20 19:35:35 2011 +0200

    Call a hook method in case a session startup has failed (was: exception raisal).

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

Summary of changes:
 debian/changelog                  |    8 ++++++++
 x2go/backends/terminal/_stdout.py |   19 ++++++++++++++++---
 x2go/client.py                    |    7 +++++++
 x2go/session.py                   |   13 ++++++++++++-
 4 files changed, 43 insertions(+), 4 deletions(-)

The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index 6645f34..c112782 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,14 @@ python-x2go (0.1.2.0-0~x2go1) UNRELEASED; urgency=low
 
  -- Mike Gabriel <mike.gabriel at das-netzwerkteam.de>  Mon, 18 Jul 2011 13:51:09 +0200
 
+python-x2go (0.1.1.5-0~x2go1) unstable; urgency=low
+
+  * New upstream version (0.1.1.5), bugfix release for 0.1.1.x series:
+    - Call hook method instead of exception raisal if session startup has failed.
+    - Handle full path command string appropriately.
+
+ -- Mike Gabriel <mike.gabriel at das-netzwerkteam.de>  Tue, 19 Jul 2011 20:44:30 +0200
+
 python-x2go (0.1.1.4-0~x2go1) unstable; urgency=low
 
   * New upstream version (0.1.1.4):
diff --git a/x2go/backends/terminal/_stdout.py b/x2go/backends/terminal/_stdout.py
index 79ecee3..19d842e 100644
--- a/x2go/backends/terminal/_stdout.py
+++ b/x2go/backends/terminal/_stdout.py
@@ -698,7 +698,11 @@ class X2goTerminalSessionSTDOUT(object):
             return True
         elif 'XSHAD' in cmd:
             return True
-        elif cmd:
+        elif cmd and cmd.startswith('/'):
+            # check if full path is correct _and_ if application is in server path
+            test_cmd = 'test -x %s && which %s && echo OK' % (cmd, os.path.basename(cmd.split()[0]))
+        elif cmd and '/' not in cmd:
+            # check if application is in server path only
             test_cmd = 'which %s && echo OK' % os.path.basename(cmd.split()[0])
 
         if test_cmd:
@@ -743,14 +747,19 @@ class X2goTerminalSessionSTDOUT(object):
             # do not run command when in DESKTOP SHARING mode...
             return None
 
+
         self.params.update({'cmd': cmd})
 
+        # do not allow the execution of full path names
+        if '/' in cmd:
+            cmd = os.path.basename(cmd)
+
         cmd_line = [ "setsid x2goruncommand", 
                      str(self.session_info.display),
                      str(self.session_info.agent_pid),
                      str(self.session_info.name), 
                      str(self.session_info.snd_port),
-                     _rewrite_blanks(_rewrite_cmd(self.params.cmd, params=self.params)),
+                     _rewrite_blanks(_rewrite_cmd(cmd, params=self.params)),
                      str(self.params.snd_system),
                      str(self.params.session_type),
                      ">& /dev/null & exit",
@@ -827,6 +836,10 @@ class X2goTerminalSessionSTDOUT(object):
         if self.params.kblayout or self.params.kbtype:
             setkbd = "1"
 
+        cmd = self.params.cmd
+        if '/' in cmd:
+            cmd = os.path.basename(cmd)
+
         cmd_line = [ "x2gostartagent",
                      str(self.params.geometry),
                      str(self.params.link),
@@ -836,7 +849,7 @@ class X2goTerminalSessionSTDOUT(object):
                      str(self.params.kbtype),
                      str(setkbd),
                      str(self.params.session_type),
-                     self.params.cmd,
+                     cmd,
                    ]
 
         if self.params.cmd == 'XDMCP' and self.params.xdmcp_server:
diff --git a/x2go/client.py b/x2go/client.py
index dfdb564..e589f5a 100644
--- a/x2go/client.py
+++ b/x2go/client.py
@@ -328,6 +328,13 @@ class X2goClient(object):
         self.auto_update_listdesktops_cache = auto_update_listdesktops_cache
 
     # user hooks for detecting/notifying what happened during application runtime
+    def HOOK_session_startup_failed(self, profile_name='UNKNOWN'):
+        """\
+        HOOK method: called if the startup of a session failed.
+
+        """
+        self.logger('HOOK_session_startup_failed: session startup for session profile ,,%s'' failed.' % profile_name, loglevel=log.loglevel_WARN)
+
     def HOOK_no_known_xserver_found(self):
         """\
         HOOK method: called if the Python X2go module could not find any usable XServer
diff --git a/x2go/session.py b/x2go/session.py
index d28eec8..8265409 100644
--- a/x2go/session.py
+++ b/x2go/session.py
@@ -273,6 +273,16 @@ class X2goSession(object):
         self.init_control_session()
         self.terminal_session = None
 
+    def HOOK_session_startup_failed(self):
+        """\
+        HOOK method: called if the startup of a session failed.
+
+        """
+        if self.client_instance:
+            self.client_instance.HOOK_session_startup_failed(profile_name=self.profile_name)
+        else:
+            self.logger('HOOK_session_startup_failed: session startup for session profile ,,%s'' failed.' % self.profile_name, loglevel=log.loglevel_WARN)
+
     def HOOK_rforward_request_denied(self, server_port=0):
         """\
         HOOK method: called if a reverse port forwarding request has been denied.
@@ -1005,7 +1015,8 @@ class X2goSession(object):
                 try:
                     self.session_name = self.terminal_session.session_info.name
                 except AttributeError:
-                    raise X2goSessionException('start of new X2go session failed')
+                    self.HOOK_session_startup_failed()
+                    return False
 
             if self.has_terminal_session() and not self.faulty:
 


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