]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
misc-progs: backupctrl: Use new run() function
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 6 Jan 2021 11:17:53 +0000 (11:17 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 27 Jan 2021 21:06:57 +0000 (21:06 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/misc-progs/backupctrl.c

index 00c8d5b86e21a40a80ae2dd2051119417da07053..0a85141ca228daded21db0671a3005ce522ad670 100644 (file)
@@ -5,40 +5,11 @@
  *
  */
 
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <fcntl.h>
 #include "setuid.h"
 
-int main(int argc, char *argv[]) {
-       int i;
-       char command[STRING_SIZE] = "/var/ipfire/backup/bin/backup.pl";
-       char temp[STRING_SIZE];
-
-       if (!(initsetuid()))
+int main(int argc, char** argv) {
+       if (!initsetuid())
                exit(1);
 
-       for (i = 1; i < argc; i++) {
-               if (strstr(argv[i], "&&")){
-                       fprintf (stderr, "Bad Argument!\n");
-                       exit (1);
-
-               } else if (strstr(argv[i], "|")) {
-                       fprintf (stderr, "Bad Argument!\n");
-                       exit (1);
-
-               } else if (argc > 3) {
-                       fprintf (stderr, "Too Many Arguments!\n");
-                       exit (1);
-
-               } else {
-                       snprintf(temp, STRING_SIZE, "%s %s", command, argv[i]);
-                       snprintf(command, STRING_SIZE, "%s", temp);
-               }
-       }
-
-       return safe_system(command);
+       return run("/var/ipfire/backup/bin/backup.pl", argv);
 }