The branch, twofactorauth has been updated via c86fe24bf4a4dd7e5dae5720ec9bfbc0d10bfc10 (commit) from ae260e32c971d9d1e9425f0b20500e4ddbbaa127 (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 ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: x2go/proxy.py | 4 +++- x2go/session.py | 32 ++++++++++++++++++++------------ 2 files changed, 23 insertions(+), 13 deletions(-) The diff of changes is: diff --git a/x2go/proxy.py b/x2go/proxy.py index 85d0691..6c99c3c 100644 --- a/x2go/proxy.py +++ b/x2go/proxy.py @@ -25,7 +25,9 @@ __NAME__ = 'x2goproxy-pylib' # modules import subprocess -import os, sys, types +import os +import sys +import types import time import copy diff --git a/x2go/session.py b/x2go/session.py index 6687105..4fc920f 100644 --- a/x2go/session.py +++ b/x2go/session.py @@ -343,7 +343,7 @@ class X2goSession(paramiko.SSHClient): _session_auth_rsakey = None _remote_home = None - _remote_x2gousers = None + _remote_group = {} def __init__(self, geometry="800x600", depth=24, link="adsl", pack="16m-jpeg-9", @@ -448,7 +448,7 @@ class X2goSession(paramiko.SSHClient): self.logger('sFTP-put: %s -> %s:%s' % (local_path, self.session_info.hostname, remote_path), loglevel=log.loglevel_DEBUG) self.sftp_client.put(local_path, remote_path) - def _x2go_sftp_write(self, remote_path, content, loglevel=log.loglevel_INFO): + def _x2go_sftp_write(self, remote_path, content): self.logger('sFTP-write: opening remote file %s on host %s for writing' % (remote_path, self.session_info.hostname), loglevel=log.loglevel_DEBUG) remote_fileobj = self.sftp_client.open(remote_path, 'w') @@ -472,16 +472,15 @@ class X2goSession(paramiko.SSHClient): else: return self._remote_home - @property - def _x2go_remote_x2gousers(self): + def _x2go_remote_group(self, group): - if self._remote_x2gousers is None: - (stdin, stdout, stderr) = self._x2go_exec_command('getent group x2gousers | cut -d":" -f4') - self._remote_x2gousers = stdout.read().split('\n')[0].split(',') - self.logger('remote x2gousers group: %s' % self._remote_x2gousers, loglevel=log.loglevel_DEBUG) - return self._remote_x2gousers + if not self._remote_group.has_key(group): + (stdin, stdout, stderr) = self._x2go_exec_command('getent group %s | cut -d":" -f4' % group) + self._remote_group[group] = stdout.read().split('\n')[0].split(',') + self.logger('remote %s group: %s' % (group, self._remote_group[group]), loglevel=log.loglevel_DEBUG) + return self._remote_group[group] else: - return self._remote_x2gousers + return self._remote_group[group] @property def _x2go_session_auth_rsakey(self): @@ -619,7 +618,7 @@ class X2goSession(paramiko.SSHClient): self.params.update(kwargs) _remote_username = self.get_transport().get_username() - if _remote_username not in self._x2go_remote_x2gousers: + if _remote_username not in self._x2go_remote_group('x2gousers'): raise x2go_exceptions.X2goSessionException('remote user %s is not member of X2go server group x2gousers' % _remote_username) setkbd = "0" @@ -656,7 +655,6 @@ class X2goSession(paramiko.SSHClient): self.proxy = self.proxy_class(session_info=self.session_info, ssh_transport=self.get_transport(), logger=self.logger) self.proxy_subprocess = self.proxy.start() - self.associated = True return self.ok() @@ -775,6 +773,9 @@ class X2goSession(paramiko.SSHClient): Initialize X2go print spooling. """ + if self.session_info.username not in self._x2go_remote_group('x2goprint'): + return None + spool_dir = '%s/spool' % self.session_info.local_container if not os.path.exists(spool_dir): os.mkdir(spool_dir) @@ -818,6 +819,9 @@ class X2goSession(paramiko.SSHClient): @rtype: bool """ + if self.session_info.username not in self._x2go_remote_group('fuse'): + raise x2go_exceptions.X2goSessionException('remote user %s is not member of X2go server group fuse' % self.session_info.username) + if folder_name is None: self.logger('no folder name given...', log.loglevel_WARN) return False @@ -1023,6 +1027,10 @@ class X2goSession(paramiko.SSHClient): """ if self.associated: + + if self.session_info.username not in self._x2go_remote_group('x2gousers'): + raise x2go_exceptions.X2goSessionException('remote user %s is not member of X2go server group x2gousers' % self.session_info.username) + self.params.update(kwargs) # if the session is still running, suspend it first 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).