aboutsummaryrefslogtreecommitdiff
blob: b2d62a71901b95df385cbcd9c38571163593eb35 (plain)
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
33
34
/*
 * sb_method.c
 *
 * Util functions for sandbox method settings.
 *
 * Copyright 2021 Gentoo Foundation
 * Licensed under the GPL-2
 */

#include "headers.h"
#include "sbutil.h"

sandbox_method_t parse_sandbox_method(const char *method)
{
	if (method == NULL || streq(method, "") || streq(method, "any"))
		return SANDBOX_METHOD_ANY;

	if (streq(method, "preload"))
		return SANDBOX_METHOD_PRELOAD;

	return SANDBOX_METHOD_ANY;
}

const char *str_sandbox_method(sandbox_method_t method)
{
	switch (method) {
		case SANDBOX_METHOD_PRELOAD:
			return "preload";
		case SANDBOX_METHOD_ANY:
			return "any";
		default:
			return "";
	}
}