[X2go-Commits] python-x2go.git - release/0.1.1.x (branch) updated: 0.1.1.4-5-gec38cb4

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


The branch, release/0.1.1.x has been updated
       via  ec38cb41810c72bd8e4c5b3013250492a7ce7b17 (commit)
       via  7b0ef4d68690a9d764e2b8215588ff760dffd97b (commit)
       via  c4d4625165114c0812dde514f7f3cab2cc98da0d (commit)
      from  86ad124c31b84e50f436583f5c66d3f54af567ef (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 ec38cb41810c72bd8e4c5b3013250492a7ce7b17
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Wed Jul 20 19:38:50 2011 +0200

    changelog update

commit 7b0ef4d68690a9d764e2b8215588ff760dffd97b
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 c4d4625165114c0812dde514f7f3cab2cc98da0d
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                  |    3 ++-
 x2go/backends/terminal/_stdout.py |   19 ++++++++++++++++---
 x2go/client.py                    |    7 +++++++
 x2go/session.py                   |   13 ++++++++++++-
 4 files changed, 37 insertions(+), 5 deletions(-)

The diff of changes is:
diff --git a/debian/changelog b/debian/changelog
index 163e46b..a4a7278 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,7 +1,8 @@
 python-x2go (0.1.1.5-0~x2go3) UNRELEASED; urgency=low
 
   * New upstream version (0.1.1.5), bugfix release for 0.1.1.x series:
-    - nothing yet
+    - 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
 
diff --git a/x2go/backends/terminal/_stdout.py b/x2go/backends/terminal/_stdout.py
index 88ff516..b8e7852 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 d7e6fb1..396757b 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 11f0cdd..0954e4a 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