From 522db2ce4c505ad0f7b2acb52155fce8711504b3 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 14 Aug 2016 12:53:49 +0530 Subject: [PATCH] dynamicdns: Allow Plinth to run as non-root When invoking actions, invoke them using sudo so that Plinth itself can run as non-root. Most operations require superuser previlage. Those that don't require superuser should not be part of the action script and can be moved to Plinth main. --- CHANGELOG.md | 3 +++ plinth/modules/dynamicdns/dynamicdns.py | 9 ++------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a57482988..577ff3afa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file. ### Fixed - users: Fixed checking restricted usernames. +### Changed +- dynamicdns: Allowed Plinth to run as non-root. + ## [0.10.0] - 2016-08-12 ### Added - Added Disks module to show free space of mounted partitions and diff --git a/plinth/modules/dynamicdns/dynamicdns.py b/plinth/modules/dynamicdns/dynamicdns.py index 6111b3a2a..e3249b2e7 100644 --- a/plinth/modules/dynamicdns/dynamicdns.py +++ b/plinth/modules/dynamicdns/dynamicdns.py @@ -366,11 +366,6 @@ def _apply_changes(request, old_status, new_status): logger.info('Nothing changed') -def _run(arguments, superuser=False, input=None): +def _run(arguments, input=None): """Run a given command and raise exception if there was an error.""" - command = 'dynamicdns' - - if superuser: - return actions.superuser_run(command, arguments, input=input) - else: - return actions.run(command, arguments, input=input) + return actions.superuser_run('dynamicdns', arguments, input=input)