mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-11 05:17:55 +03:00
Merge remote-tracking branch 'origin/v2.2'
This commit is contained in:
commit
3a42fb599c
@ -99,9 +99,9 @@ class AutoAttributes(Serializable):
|
||||
return
|
||||
# We keep original data (maybe incomplete)
|
||||
try:
|
||||
data = encoders.decode_bz2(data)
|
||||
data = encoders.decode(data, 'bz2')
|
||||
except Exception: # With old zip encoding
|
||||
data = encoders.decode_zip(data)
|
||||
data = encoders.decode(data, 'zip')
|
||||
for pair in data.split('\2'):
|
||||
k, v = pair.split('\1')
|
||||
self.dict[k] = pickle.loads(str(v))
|
||||
|
@ -50,6 +50,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class FileStorage(Storage):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self._base_url = getattr(settings, 'FILE_STORAGE', '/files')
|
||||
if self._base_url[-1] != '/':
|
||||
@ -60,6 +61,7 @@ class FileStorage(Storage):
|
||||
try:
|
||||
cache = caches[cacheName]
|
||||
except:
|
||||
logger.info('No cache for FileStorage configured.')
|
||||
cache = None
|
||||
|
||||
self.cache = cache
|
||||
@ -119,7 +121,6 @@ class FileStorage(Storage):
|
||||
return
|
||||
self.cache.delete(self._getKey(name))
|
||||
|
||||
|
||||
def _open(self, name, mode='rb'):
|
||||
f = six.BytesIO(self._dbFileForReadOnly(name).data)
|
||||
f.name = name
|
||||
@ -173,7 +174,9 @@ class FileStorage(Storage):
|
||||
except DBFile.DoesNotExist:
|
||||
return None
|
||||
|
||||
|
||||
class CompressorFileStorage(FileStorage):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
FileStorage.__init__(self, *args, **dict(kwargs, owner='compressor'))
|
||||
|
||||
|
@ -41,14 +41,14 @@ def __toBinary(data):
|
||||
return data
|
||||
|
||||
|
||||
def encode(data, encoder, asText):
|
||||
def encode(data, encoder, asText=False):
|
||||
res = codecs.encode(__toBinary(data), encoder)
|
||||
if asText:
|
||||
return res.decode('utf8')
|
||||
return res
|
||||
|
||||
|
||||
def decode(data, encoder, asText):
|
||||
def decode(data, encoder, asText=False):
|
||||
res = codecs.decode(__toBinary(data), encoder)
|
||||
if asText:
|
||||
return res.decode('utf8')
|
||||
|
@ -56,7 +56,16 @@ class DBFile(UUIDModel):
|
||||
|
||||
@property
|
||||
def data(self):
|
||||
return encoders.decode(encoders.decode(self.content, 'base64'), 'zip')
|
||||
try:
|
||||
return encoders.decode(encoders.decode(self.content, 'base64'), 'zip')
|
||||
except Exception:
|
||||
logger.error('DBFile {} has errors and cannot be used'.format(self.name))
|
||||
try:
|
||||
self.delete() # Autodelete, invalid...
|
||||
except:
|
||||
logger.error('Could not even delete {}!!'.format(self.name))
|
||||
|
||||
return ''
|
||||
|
||||
@data.setter
|
||||
def data(self, value):
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
#
|
||||
# Copyright (c) 2012 Virtual Cable S.L.
|
||||
# Copyright (c) 2011-2017 Virtual Cable S.L.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
@ -28,21 +28,17 @@
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
"""
|
||||
'''
|
||||
Created on Jul 29, 2011
|
||||
|
||||
@author: Adolfo Gómez, dkmaster at dkmon dot com
|
||||
|
||||
"""
|
||||
'''
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from uds.core.util import OsDetector
|
||||
import six
|
||||
import os
|
||||
import urllib
|
||||
|
||||
__updated__ = '2017-09-18'
|
||||
|
||||
|
||||
class RDPFile(object):
|
||||
fullScreen = False
|
||||
@ -93,10 +89,10 @@ class RDPFile(object):
|
||||
|
||||
@property
|
||||
def as_new_xfreerdp_params(self):
|
||||
"""
|
||||
'''
|
||||
Parameters for xfreerdp >= 1.1.0 with self rdp description
|
||||
Note that server is not added
|
||||
"""
|
||||
'''
|
||||
params = ['/t:UDS-Connection', '/cert-ignore'] # , '/sec:rdp']
|
||||
|
||||
if self.enableClipboard:
|
||||
@ -144,13 +140,24 @@ class RDPFile(object):
|
||||
params.append('/h:{}'.format(self.height))
|
||||
|
||||
params.append('/bpp:{}'.format(self.bpp))
|
||||
|
||||
# RDP Security is A MUST if no username nor password is provided
|
||||
# NLA requires USERNAME&PASSWORD previously
|
||||
forceRDPSecurity = False
|
||||
if self.username != '':
|
||||
params.append('/u:{}'.format(self.username))
|
||||
else:
|
||||
forceRDPSecurity = True
|
||||
if self.password != '':
|
||||
params.append('/p:{}'.format(self.password))
|
||||
else:
|
||||
forceRDPSecurity = True
|
||||
if self.domain != '':
|
||||
params.append('/d:{}'.format(self.domain))
|
||||
|
||||
if forceRDPSecurity:
|
||||
params.append('/sec:rdp')
|
||||
|
||||
if self.linuxCustomParameters is not None and self.linuxCustomParameters.strip() != '':
|
||||
params.append(self.linuxCustomParameters.strip())
|
||||
|
||||
@ -158,10 +165,10 @@ class RDPFile(object):
|
||||
|
||||
@property
|
||||
def as_rdesktop_params(self):
|
||||
"""
|
||||
'''
|
||||
Parameters for rdestop with self rdp description
|
||||
Note that server is not added
|
||||
"""
|
||||
'''
|
||||
|
||||
params = ['-TUDS Connection', '-P']
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user