remove remote filter lists

This commit is contained in:
chrys 2018-09-08 20:05:59 +02:00
parent 45921a4487
commit a0beb42e89
8 changed files with 16 additions and 52 deletions

View File

@ -198,12 +198,8 @@ port=22447
socketpath=/tmp/ socketpath=/tmp/
# allow settings to overwrite # allow settings to overwrite
enableSettingsRemote=True enableSettingsRemote=True
# permitted settings
allowSettings=barrier#enabled
# allow commands to be executed # allow commands to be executed
enableCommandRemote=True enableCommandRemote=True
# permitted commands
allowCommands=say,interrupt,window,resetwindow
[barrier] [barrier]
enabled=True enabled=True

View File

@ -208,12 +208,8 @@ port=22447
socketpath=/tmp/ socketpath=/tmp/
# allow settings to overwrite # allow settings to overwrite
enableSettingsRemote=True enableSettingsRemote=True
# permitted settings
allowSettings=barrier#enabled
# allow commands to be executed # allow commands to be executed
enableCommandRemote=True enableCommandRemote=True
# permitted commands
allowCommands=say,interrupt,window,resetwindow
[barrier] [barrier]
enabled=True enabled=True

View File

@ -209,12 +209,8 @@ port=22447
socketpath=/tmp/ socketpath=/tmp/
# allow settings to overwrite # allow settings to overwrite
enableSettingsRemote=True enableSettingsRemote=True
# permitted settings
allowSettings=barrier#enabled
# allow commands to be executed # allow commands to be executed
enableCommandRemote=True enableCommandRemote=True
# permitted commands
allowCommands=say,interrupt,window,resetwindow
[barrier] [barrier]
enabled=True enabled=True

View File

@ -154,12 +154,8 @@ port=22447
socketpath=/tmp/ socketpath=/tmp/
# allow settings to overwrite # allow settings to overwrite
enableSettingsRemote=True enableSettingsRemote=True
# permitted settings
allowSettings=barrier#enabled
# allow commands to be executed # allow commands to be executed
enableCommandRemote=True enableCommandRemote=True
# permitted commands
allowCommands=say,interrupt,window,resetwindow
[barrier] [barrier]
enabled=True enabled=True

View File

@ -208,12 +208,8 @@ port=22447
socketpath=/tmp/ socketpath=/tmp/
# allow settings to overwrite # allow settings to overwrite
enableSettingsRemote=True enableSettingsRemote=True
# permitted settings
allowSettings=barrier#enabled
# allow commands to be executed # allow commands to be executed
enableCommandRemote=True enableCommandRemote=True
# permitted commands
allowCommands=say,interrupt,window,resetwindow
[barrier] [barrier]
enabled=True enabled=True

View File

@ -138,14 +138,9 @@ class remoteManager():
def handleCommandExecution(self, commandText): def handleCommandExecution(self, commandText):
if not self.env['runtime']['settingsManager'].getSettingAsBool('remote', 'enableCommandRemote'): if not self.env['runtime']['settingsManager'].getSettingAsBool('remote', 'enableCommandRemote'):
return return
allowCommands = self.env['runtime']['settingsManager'].getSetting('remote', 'allowCommands').upper().split(',')
upperCommandText = commandText.upper() upperCommandText = commandText.upper()
allowed = False
for a in allowCommands:
if upperCommandText.startswith(a):
allowed = True
if not allowed:
return
# say # say
if upperCommandText.startswith(self.sayConst): if upperCommandText.startswith(self.sayConst):
parameterText = commandText[len(self.sayConst):] parameterText = commandText[len(self.sayConst):]
@ -184,9 +179,7 @@ class remoteManager():
def resetSettings(self): def resetSettings(self):
self.env['runtime']['settingsManager'].resetSettingArgDict() self.env['runtime']['settingsManager'].resetSettingArgDict()
def setSettings(self, settingsArgs): def setSettings(self, settingsArgs):
allowSettings = self.env['runtime']['settingsManager'].getSetting('remote', 'allowSettings').upper().split(',') self.env['runtime']['settingsManager'].parseSettingArgs(settingsArgs)
self.env['runtime']['settingsManager'].parseSettingArgs(settingsArgs, allowSettings)
def handleRemoteIncomming(self, eventData): def handleRemoteIncomming(self, eventData):
if not eventData: if not eventData:
return return

View File

@ -86,9 +86,7 @@ settingsData = {
'port': 22447, 'port': 22447,
'socketpath':'/tmp/', 'socketpath':'/tmp/',
'enableSettingsRemote': True, 'enableSettingsRemote': True,
'allowSettings': 'barrier#enabled',
'enableCommandRemote': True, 'enableCommandRemote': True,
'allowCommands': 'say,interrupt,window,resetwindow',
}, },
'barrier':{ 'barrier':{
'enabled': True, 'enabled': True,

View File

@ -186,19 +186,12 @@ class settingsManager():
self.settingArgDict[section] = {} self.settingArgDict[section] = {}
self.settingArgDict[section][option] = str(value) self.settingArgDict[section][option] = str(value)
def parseSettingArgs(self, settingArgs, allowSettings = None): def parseSettingArgs(self, settingArgs):
for optionElem in settingArgs.split(';'): for optionElem in settingArgs.split(';'):
if len(optionElem.split('#',1)) != 2: if len(optionElem.split('#',1)) != 2:
continue continue
if len(optionElem.split('#',1)[1].split('=',1)) != 2: if len(optionElem.split('#',1)[1].split('=',1)) != 2:
continue continue
allowed = False
if allowSettings:
for a in allowSettings:
if a in optionElem:
allowed = True
if not allowed:
continue
section = str(optionElem.split('#',1)[0]).lower() section = str(optionElem.split('#',1)[0]).lower()
option = str(optionElem.split('#',1)[1].split('=',1)[0]).lower() option = str(optionElem.split('#',1)[1].split('=',1)[0]).lower()