summaryrefslogtreecommitdiffstats
path: root/core/modules/run-virt/fwtool
diff options
context:
space:
mode:
authorJonathan Bauer2016-12-23 13:12:09 +0100
committerJonathan Bauer2016-12-23 13:12:09 +0100
commit6806ae4a850fc7785a8c05304237cf53b5b8f951 (patch)
treeb1dd8413d6c7b9a250251da7f0d49bb52b4ddc57 /core/modules/run-virt/fwtool
parentwrong kernel version variable used (diff)
downloadmltk-6806ae4a850fc7785a8c05304237cf53b5b8f951.tar.gz
mltk-6806ae4a850fc7785a8c05304237cf53b5b8f951.tar.xz
mltk-6806ae4a850fc7785a8c05304237cf53b5b8f951.zip
merge with latest dev version (tm-scripts commit f5a59daf8d70a9027118292cd40b18c221897408)
Diffstat (limited to 'core/modules/run-virt/fwtool')
-rw-r--r--core/modules/run-virt/fwtool/main.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/core/modules/run-virt/fwtool/main.c b/core/modules/run-virt/fwtool/main.c
new file mode 100644
index 00000000..9e272384
--- /dev/null
+++ b/core/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);
+}
+