From 746a11e5938bad3865c6d03fbed3ea6dfc583fb1 Mon Sep 17 00:00:00 2001
From: Stefan Saraev <stefan@saraev.ca>
Date: Thu, 8 Oct 2015 11:59:39 +0300
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 420a246..06bca92 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -6257,6 +6257,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();
@@ -7370,22 +7370,22 @@
                 { "enable",                2,        VERB_ANY, 0,             enable_unit       },
                 { "disable",               2,        VERB_ANY, 0,             enable_unit       },
                 { "is-enabled",            2,        VERB_ANY, 0,             unit_is_enabled   },
-                { "reenable",              2,        VERB_ANY, 0,             enable_unit       },
-                { "preset",                2,        VERB_ANY, 0,             enable_unit       },
-                { "preset-all",            VERB_ANY, 1,        0,             preset_all        },
-                { "mask",                  2,        VERB_ANY, 0,             enable_unit       },
-                { "unmask",                2,        VERB_ANY, 0,             enable_unit       },
-                { "link",                  2,        VERB_ANY, 0,             enable_unit       },
+                { "reenable",              2,        VERB_ANY, 0,             nope              },
+                { "preset",                2,        VERB_ANY, 0,             nope              },
+                { "preset-all",            VERB_ANY, 1,        0,             nope              },
+                { "mask",                  2,        VERB_ANY, 0,             nope              },
+                { "unmask",                2,        VERB_ANY, 0,             nope              },
+                { "link",                  2,        VERB_ANY, 0,             nope              },
                 { "revert",                2,        VERB_ANY, 0,             enable_unit       },
                 { "switch-root",           2,        VERB_ANY, VERB_NOCHROOT, switch_root       },
                 { "list-dependencies",     VERB_ANY, 2,        VERB_NOCHROOT, list_dependencies },
-                { "set-default",           2,        2,        0,             set_default       },
+                { "set-default",           2,        2,        0,             nope              },
                 { "get-default",           VERB_ANY, 1,        0,             get_default,      },
                 { "set-property",          3,        VERB_ANY, VERB_NOCHROOT, set_property      },
                 { "is-system-running",     VERB_ANY, 1,        0,             is_system_running },
-                { "add-wants",             3,        VERB_ANY, 0,             add_dependency    },
-                { "add-requires",          3,        VERB_ANY, 0,             add_dependency    },
-                { "edit",                  2,        VERB_ANY, VERB_NOCHROOT, edit              },
+                { "add-wants",             3,        VERB_ANY, 0,             nope              },
+                { "add-requires",          3,        VERB_ANY, 0,             nope              },
+                { "edit",                  2,        VERB_ANY, 0,             nope              },
                 {}
         };
 
-- 
2.1.4

