source: MondoRescue/branches/2.2.5/mindi-busybox/libbb/selinux_common.c

Last change on this file was 1765, checked in by Bruno Cornec, 16 years ago

Update to busybox 1.7.2

  • Property svn:eol-style set to native
File size: 946 bytes
Line 
1/*
2 * libbb/selinux_common.c
3 * -- common SELinux utility functions
4 *
5 * Copyright 2007 KaiGai Kohei <kaigai@kaigai.gr.jp>
6 */
7#include "libbb.h"
8#include <selinux/context.h>
9
10context_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
27error:
28 context_free(con);
29 return NULL;
30}
31
32void setfscreatecon_or_die(security_context_t scontext)
33{
34 if (setfscreatecon(scontext) < 0) {
35 /* Can be NULL. All known printf implementations
36 * display "(null)", "<null>" etc */
37 bb_perror_msg_and_die("cannot set default "
38 "file creation context to %s", scontext);
39 }
40}
Note: See TracBrowser for help on using the repository browser.