lsm: non-functional changes

parent 95220ee6
...@@ -172,7 +172,7 @@ static bool aa_needs_transition(char *curlabel) ...@@ -172,7 +172,7 @@ static bool aa_needs_transition(char *curlabel)
* Notes: This relies on /proc being available. * Notes: This relies on /proc being available.
*/ */
static int apparmor_process_label_set(const char *inlabel, struct lxc_conf *conf, static int apparmor_process_label_set(const char *inlabel, struct lxc_conf *conf,
int use_default, int on_exec) bool use_default, bool on_exec)
{ {
const char *label = inlabel ? inlabel : conf->lsm_aa_profile; const char *label = inlabel ? inlabel : conf->lsm_aa_profile;
char *curlabel; char *curlabel;
......
...@@ -86,7 +86,7 @@ char *lsm_process_label_get(pid_t pid) ...@@ -86,7 +86,7 @@ char *lsm_process_label_get(pid_t pid)
} }
int lsm_process_label_set(const char *label, struct lxc_conf *conf, int lsm_process_label_set(const char *label, struct lxc_conf *conf,
int use_default, int on_exec) bool use_default, bool on_exec)
{ {
if (!drv) { if (!drv) {
ERROR("LSM driver not inited"); ERROR("LSM driver not inited");
......
...@@ -28,29 +28,52 @@ struct lxc_conf; ...@@ -28,29 +28,52 @@ struct lxc_conf;
#include <sys/types.h> #include <sys/types.h>
#include "../utils.h"
#define LXC_LSMATTRLEN (5 + (LXC_NUMSTRLEN64) + 7 + 1)
struct lsm_drv { struct lsm_drv {
const char *name; const char *name;
int (*enabled)(void); int (*enabled)(void);
char *(*process_label_get)(pid_t pid); char *(*process_label_get)(pid_t pid);
int (*process_label_set)(const char *label, struct lxc_conf *conf, int (*process_label_set)(const char *label, struct lxc_conf *conf,
int use_default, int on_exec); bool use_default, bool on_exec);
}; };
#if HAVE_APPARMOR || HAVE_SELINUX #if HAVE_APPARMOR || HAVE_SELINUX
void lsm_init(void); extern void lsm_init(void);
int lsm_enabled(void); extern int lsm_enabled(void);
const char *lsm_name(void); extern const char *lsm_name(void);
char *lsm_process_label_get(pid_t pid); extern char *lsm_process_label_get(pid_t pid);
int lsm_process_label_set(const char *label, struct lxc_conf *conf, extern int lsm_process_label_set(const char *label, struct lxc_conf *conf,
int use_default, int on_exec); bool use_default, bool on_exec);
#else #else
static inline void lsm_init(void) { } static inline void lsm_init(void)
static inline int lsm_enabled(void) { return 0; } {
static inline const char *lsm_name(void) { return "none"; } return;
static inline char *lsm_process_label_get(pid_t pid) { return NULL; } }
static inline int lsm_process_label_set(const char *label,
struct lxc_conf *conf, int use_default, int on_exec) { return 0; } static inline int lsm_enabled(void) {
return 0;
}
static inline const char *lsm_name(void)
{
return "none";
}
static inline char *lsm_process_label_get(pid_t pid)
{
return NULL;
}
static inline int lsm_process_label_set(const char *label,
struct lxc_conf *conf, bool use_default,
bool on_exec)
{
return 0;
}
#endif #endif
#endif #endif
...@@ -30,7 +30,7 @@ static char *nop_process_label_get(pid_t pid) ...@@ -30,7 +30,7 @@ static char *nop_process_label_get(pid_t pid)
} }
static int nop_process_label_set(const char *label, struct lxc_conf *conf, static int nop_process_label_set(const char *label, struct lxc_conf *conf,
int use_default, int on_exec) bool use_default, bool on_exec)
{ {
return 0; return 0;
} }
......
...@@ -72,7 +72,7 @@ static char *selinux_process_label_get(pid_t pid) ...@@ -72,7 +72,7 @@ static char *selinux_process_label_get(pid_t pid)
* Notes: This relies on /proc being available. * Notes: This relies on /proc being available.
*/ */
static int selinux_process_label_set(const char *inlabel, struct lxc_conf *conf, static int selinux_process_label_set(const char *inlabel, struct lxc_conf *conf,
int use_default, int on_exec) bool use_default, bool on_exec)
{ {
const char *label = inlabel ? inlabel : conf->lsm_se_context; const char *label = inlabel ? inlabel : conf->lsm_se_context;
if (!label) { if (!label) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment