summaryrefslogtreecommitdiffstats
path: root/remote/modules/run-virt/fwtool/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'remote/modules/run-virt/fwtool/main.c')
-rw-r--r--remote/modules/run-virt/fwtool/main.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/remote/modules/run-virt/fwtool/main.c b/remote/modules/run-virt/fwtool/main.c
new file mode 100644
index 00000000..9e272384
--- /dev/null
+++ b/remote/modules/run-virt/fwtool/main.c
@@ -0,0 +1,32 @@
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+int main(int argc, char **argv)
+{
+ if (argc < 2) {
+ puts("Nee\n");
+ return 1;
+ }
+ char * const nargv[] = {
+ "bash",
+ "/opt/openslx/vmchooser/scripts/set-firewall",
+ argv[1],
+ 0
+ };
+ char * const nenv[] = {
+ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/openslx/sbin:/opt/openslx/bin",
+ "HOME=/root",
+ "LC_ALL=C",
+ "LANG=C",
+ 0
+ };
+
+ setresuid(0, 0, 0);
+ setregid(0, 0);
+
+ execve("/bin/bash", nargv, nenv);
+}
+