From d936971f6ad684d511f81600cbd2bd21b20ae9a7 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Sat, 15 Oct 2011 00:09:25 +0200 Subject: [PATCH] [eit.commands.command] add support for unprivileged commands execution --- server/eit/commands/command.py | 2 ++ server/eit/main.py | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/server/eit/commands/command.py b/server/eit/commands/command.py index b347fdc04..54b49d50a 100644 --- a/server/eit/commands/command.py +++ b/server/eit/commands/command.py @@ -31,6 +31,8 @@ class EitCommand(object): ALIASES = [] # Set this to True if command is a catch-all (fallback) CATCH_ALL = False + # Allow unprivileged access ? + ALLOW_UNPRIVILEGED = False def __init__(self, args): self._args = args diff --git a/server/eit/main.py b/server/eit/main.py index b51de1eec..90a19fc82 100644 --- a/server/eit/main.py +++ b/server/eit/main.py @@ -69,8 +69,9 @@ def main(): allowed = True if os.getuid() != 0 and \ cmd_class is not catch_all: - cmd_class = catch_all - allowed = False + if not cmd_class.ALLOW_UNPRIVILEGED: + cmd_class = catch_all + allowed = False cmd_obj = cmd_class(args) func, func_args = cmd_obj.parse()