dynamicdns: Allow reading status as non-root

Recently dynamic DNS module was fixed to use root ownership and limited
permissions for configuration and status files to avoid other users
reading dynmaic DNS account details.  This caused a regression when
Plinth is being run as non-root user.  This patch runs the commands to
read the current configuration as root user.
This commit is contained in:
Sunil Mohan Adapa 2016-10-03 09:16:52 +05:30 committed by James Valleroy
parent e28f3963c7
commit 5c75eb9649
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
2 changed files with 5 additions and 4 deletions

View File

@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file.
- Upstream patch from Debian bug #837206 to fix DB and log file
permissions. Also switch to new setup command.
- Include module static files in build, required for Debian package build.
- dynamicdns: Allow reading status as non-root.
### Changed
- repro: Use firewalld provided SIP services.

View File

@ -215,12 +215,12 @@ def configure(request):
def statuspage(request):
"""Serve the status page."""
check_nat = actions.run('dynamicdns', ['get-nat'])
last_update = actions.run('dynamicdns', ['get-last-success'])
check_nat = _run(['get-nat'])
last_update = _run(['get-last-success'])
no_nat = check_nat.strip() == 'no'
nat_unchecked = check_nat.strip() == 'unknown'
timer = actions.run('dynamicdns', ['get-timer'])
timer = _run(['get-timer'])
if no_nat:
logger.info('Not behind a NAT')
@ -241,7 +241,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 = _run(['status'])
details = output.split()
status['enabled'] = (output.split()[0] == 'enabled')