From 719c4c427f7dae08658cff066468712c35744343 Mon Sep 17 00:00:00 2001
From: Stefan Saraev <stefan@saraev.ca>
Date: Thu, 11 Dec 2014 21:36:36 +0200
Subject: [PATCH 8/8] systemctl: disable dangerous options

---
 src/systemctl/systemctl.c |   25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 21cb898..9db08ad 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -6019,6 +6019,11 @@ end:
         return r;
 }
 
+static int nope(sd_bus *bus, char **args) {
+        printf("nope. don't do that\n");
+        return 0;
+}
+
 static void systemctl_help(void) {
 
         pager_open_if_enabled();
@@ -7112,21 +7117,21 @@ static int systemctl_main(sd_bus *bus, int argc, char *argv[], int bus_error) {
                 { "enable",                MORE,  2, enable_unit,      NOBUS },
                 { "disable",               MORE,  2, enable_unit,      NOBUS },
                 { "is-enabled",            MORE,  2, unit_is_enabled,  NOBUS },
-                { "reenable",              MORE,  2, enable_unit,      NOBUS },
-                { "preset",                MORE,  2, enable_unit,      NOBUS },
-                { "preset-all",            EQUAL, 1, preset_all,       NOBUS },
-                { "mask",                  MORE,  2, enable_unit,      NOBUS },
-                { "unmask",                MORE,  2, enable_unit,      NOBUS },
-                { "link",                  MORE,  2, enable_unit,      NOBUS },
+                { "reenable",              MORE,  2, nope,             NOBUS },
+                { "preset",                MORE,  2, nope,             NOBUS },
+                { "preset-all",            EQUAL, 1, nope,             NOBUS },
+                { "mask",                  MORE,  2, nope,             NOBUS },
+                { "unmask",                MORE,  2, nope,             NOBUS },
+                { "link",                  MORE,  2, nope,             NOBUS },
                 { "switch-root",           MORE,  2, switch_root       },
                 { "list-dependencies",     LESS,  2, list_dependencies },
-                { "set-default",           EQUAL, 2, set_default,      NOBUS },
+                { "set-default",           EQUAL, 2, nope,             NOBUS },
                 { "get-default",           EQUAL, 1, get_default,      NOBUS },
                 { "set-property",          MORE,  3, set_property      },
                 { "is-system-running",     EQUAL, 1, is_system_running },
-                { "add-wants",             MORE,  3, add_dependency,   NOBUS },
-                { "add-requires",          MORE,  3, add_dependency,   NOBUS },
-                { "edit",                  MORE,  2, edit,             NOBUS },
+                { "add-wants",             MORE,  3, nope,             NOBUS },
+                { "add-requires",          MORE,  3, nope,             NOBUS },
+                { "edit",                  MORE,  2, nope,             NOBUS },
                 {}
         }, *verb = verbs;
 
-- 
1.7.10.4

