diff options
author | Denis Vlasenko | 2007-03-11 22:16:02 +0000 |
---|---|---|
committer | Denis Vlasenko | 2007-03-11 22:16:02 +0000 |
commit | 1203c9bf2f63938f7766a3022a9659b25712824f (patch) | |
tree | 162a5019d61ce2403466754ab0ee727e04f1563b /libbb/selinux_common.c | |
parent | baca1759129945fcd03d96ccc840892401b5a1af (diff) | |
download | busybox-1203c9bf2f63938f7766a3022a9659b25712824f.zip busybox-1203c9bf2f63938f7766a3022a9659b25712824f.tar.gz |
next portion of selinux updates: chcon, runcon. From
Yuichi Nakamura <himainu-ynakam@miomio.jp>
KaiGai Kohei <busybox@kaigai.gr.jp>
Diffstat (limited to 'libbb/selinux_common.c')
-rw-r--r-- | libbb/selinux_common.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/libbb/selinux_common.c b/libbb/selinux_common.c new file mode 100644 index 0000000..70d63a4 --- /dev/null +++ b/libbb/selinux_common.c @@ -0,0 +1,30 @@ +/* + * libbb/selinux_common.c + * -- common SELinux utility functions + * + * Copyright 2007 KaiGai Kohei <kaigai@kaigai.gr.jp> + */ +#include "busybox.h" +#include <selinux/context.h> + +context_t set_security_context_component(security_context_t cur_context, + char *user, char *role, char *type, char *range) +{ + context_t con = context_new(cur_context); + if (!con) + return NULL; + + if (user && context_user_set(con, user)) + goto error; + if (type && context_type_set(con, type)) + goto error; + if (range && context_range_set(con, range)) + goto error; + if (role && context_role_set(con, role)) + goto error; + return con; + +error: + context_free(con); + return NULL; +} |