mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
Handle arguments to actions properly
- Don't allow strings to be sent as arguments. The mixup with lists/tuples could be dangerous. - Don't escape arguments. subprocess.Popen takes care that arguments are passed on nicely to the actions. - Update tests.
This commit is contained in:
1 parent
4e42486822
commit
b62f6746f4
6 files changed
+100
-82
No files matched your search
@@ -195,7 +195,7 @@ def set_hostname(hostname):
|
||||
new_hostname=hostname)
|
||||
|
||||
LOGGER.info('Changing hostname to - %s', hostname)
|
||||
actions.superuser_run('hostname-change', hostname)
|
||||
actions.superuser_run('hostname-change', [hostname])
|
||||
|
||||
post_hostname_change.send_robust(sender='config',
|
||||
old_hostname=old_hostname,
|
||||
@@ -210,7 +210,7 @@ def set_domainname(domainname):
|
||||
domainname = str(domainname)
|
||||
|
||||
LOGGER.info('Changing domain name to - %s', domainname)
|
||||
actions.superuser_run('domainname-change', domainname)
|
||||
actions.superuser_run('domainname-change', [domainname])
|
||||
|
||||
domainname_change.send_robust(sender='config',
|
||||
old_domainname=old_domainname,
|
||||
|
||||
@@ -257,7 +257,7 @@ def get_status():
|
||||
"""Return the current status"""
|
||||
"""ToDo: use key/value instead of hard coded value list"""
|
||||
status = {}
|
||||
output = actions.run('dynamicdns', 'status')
|
||||
output = actions.run('dynamicdns', ['status'])
|
||||
details = output.split()
|
||||
status['enabled'] = (output.split()[0] == 'enabled')
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ def index(request):
|
||||
|
||||
def get_status():
|
||||
"""Return the current status"""
|
||||
output = actions.run('owncloud-setup', 'status')
|
||||
output = actions.run('owncloud-setup', ['status'])
|
||||
return {'enabled': 'enable' in output.split()}
|
||||
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ def configure(request):
|
||||
|
||||
def get_status():
|
||||
"""Return the current status"""
|
||||
output = actions.run('xmpp-setup', 'status')
|
||||
output = actions.run('xmpp-setup', ['status'])
|
||||
return {'inband_enabled': 'inband_enable' in output.split()}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user