diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-03-11 22:16:02 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-03-11 22:16:02 +0000 |
commit | 1203c9bf2f63938f7766a3022a9659b25712824f (patch) | |
tree | 162a5019d61ce2403466754ab0ee727e04f1563b /libbb | |
parent | baca1759129945fcd03d96ccc840892401b5a1af (diff) | |
download | busybox-w32-1203c9bf2f63938f7766a3022a9659b25712824f.tar.gz busybox-w32-1203c9bf2f63938f7766a3022a9659b25712824f.tar.bz2 busybox-w32-1203c9bf2f63938f7766a3022a9659b25712824f.zip |
next portion of selinux updates: chcon, runcon. From
Yuichi Nakamura <himainu-ynakam@miomio.jp>
KaiGai Kohei <busybox@kaigai.gr.jp>
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/Kbuild | 1 | ||||
-rw-r--r-- | libbb/selinux_common.c | 30 |
2 files changed, 31 insertions, 0 deletions
diff --git a/libbb/Kbuild b/libbb/Kbuild index a53b17f44..ffded6a68 100644 --- a/libbb/Kbuild +++ b/libbb/Kbuild | |||
@@ -106,6 +106,7 @@ lib-$(CONFIG_SU) += correct_password.o | |||
106 | lib-$(CONFIG_LOGIN) += correct_password.o | 106 | lib-$(CONFIG_LOGIN) += correct_password.o |
107 | lib-$(CONFIG_DF) += find_mount_point.o | 107 | lib-$(CONFIG_DF) += find_mount_point.o |
108 | lib-$(CONFIG_MKFS_MINIX) += find_mount_point.o | 108 | lib-$(CONFIG_MKFS_MINIX) += find_mount_point.o |
109 | lib-$(CONFIG_SELINUX) += selinux_common.o | ||
109 | 110 | ||
110 | # We shouldn't build xregcomp.c if we don't need it - this ensures we don't | 111 | # We shouldn't build xregcomp.c if we don't need it - this ensures we don't |
111 | # require regex.h to be in the include dir even if we don't need it thereby | 112 | # require regex.h to be in the include dir even if we don't need it thereby |
diff --git a/libbb/selinux_common.c b/libbb/selinux_common.c new file mode 100644 index 000000000..70d63a465 --- /dev/null +++ b/libbb/selinux_common.c | |||
@@ -0,0 +1,30 @@ | |||
1 | /* | ||
2 | * libbb/selinux_common.c | ||
3 | * -- common SELinux utility functions | ||
4 | * | ||
5 | * Copyright 2007 KaiGai Kohei <kaigai@kaigai.gr.jp> | ||
6 | */ | ||
7 | #include "busybox.h" | ||
8 | #include <selinux/context.h> | ||
9 | |||
10 | context_t set_security_context_component(security_context_t cur_context, | ||
11 | char *user, char *role, char *type, char *range) | ||
12 | { | ||
13 | context_t con = context_new(cur_context); | ||
14 | if (!con) | ||
15 | return NULL; | ||
16 | |||
17 | if (user && context_user_set(con, user)) | ||
18 | goto error; | ||
19 | if (type && context_type_set(con, type)) | ||
20 | goto error; | ||
21 | if (range && context_range_set(con, range)) | ||
22 | goto error; | ||
23 | if (role && context_role_set(con, role)) | ||
24 | goto error; | ||
25 | return con; | ||
26 | |||
27 | error: | ||
28 | context_free(con); | ||
29 | return NULL; | ||
30 | } | ||