diff options
author | Leah Neukirchen <leah@vuxu.org> | 2022-02-12 22:49:00 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2022-02-12 22:49:00 +0100 |
commit | 95d3c6b054ef733531487e63bde4b9e388d427b5 (patch) | |
tree | 84c689ed4c95e78699e8e5dd3448011b873ea47f | |
parent | 82ba3e6771d3b8eeea24a732f3042e88170bf6b7 (diff) | |
download | rvnit-95d3c6b054ef733531487e63bde4b9e388d427b5.tar.gz rvnit-95d3c6b054ef733531487e63bde4b9e388d427b5.tar.xz rvnit-95d3c6b054ef733531487e63bde4b9e388d427b5.zip |
rvnitctl: validate command
-rw-r--r-- | rvnitctl.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/rvnitctl.c b/rvnitctl.c index 7cc8bde..9920f30 100644 --- a/rvnitctl.c +++ b/rvnitctl.c @@ -9,7 +9,23 @@ int main(int argc, char *argv[]) { - if (argc < 2) { + if (argc < 2 || ( + strcmp(argv[1], "l") != 0 && strcmp(argv[1], "level") != 0 && + strcmp(argv[1], "s") != 0 && strcmp(argv[1], "status") != 0 && + strcmp(argv[1], "d") != 0 && strcmp(argv[1], "down") != 0 && + strcmp(argv[1], "u") != 0 && strcmp(argv[1], "up") != 0 && + strcmp(argv[1], "p") != 0 && strcmp(argv[1], "pause") != 0 && + strcmp(argv[1], "c") != 0 && strcmp(argv[1], "cont") != 0 && + strcmp(argv[1], "h") != 0 && strcmp(argv[1], "hup") != 0 && + strcmp(argv[1], "a") != 0 && strcmp(argv[1], "alarm") != 0 && + strcmp(argv[1], "i") != 0 && strcmp(argv[1], "interrupt") != 0 && + strcmp(argv[1], "q") != 0 && strcmp(argv[1], "quit") != 0 && + strcmp(argv[1], "t") != 0 && strcmp(argv[1], "term") != 0 && + strcmp(argv[1], "k") != 0 && strcmp(argv[1], "kill") != 0 && + strcmp(argv[1], "1") != 0 && + strcmp(argv[1], "2") != 0 && + strcmp(argv[1], "Restart") != 0 && + strcmp(argv[1], "Shutdown") != 0)) { dprintf(2, "usage: rvnitctl COMMAND [SERVICE]\n"); exit(2); } |