summaryrefslogtreecommitdiffstats
path: root/core/modules/run-virt/fwtool/main.c
blob: aa6e70f3c1714b17520e8c23c79eafee19f99d2b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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.UTF-8",
		"LANG=C.UTF-8",
		0
	};

	setresuid(0, 0, 0);
	setregid(0, 0);

	execve("/bin/bash", nargv, nenv);
}