Commit 41ca8908 by Dwight Engen Committed by Serge Hallyn

add lsm op for getting name of enabled lsm

parent 3d460a38
...@@ -62,13 +62,20 @@ void lsm_init(void) ...@@ -62,13 +62,20 @@ void lsm_init(void)
INFO("Initialized LSM security driver %s", drv->name); INFO("Initialized LSM security driver %s", drv->name);
} }
int lsm_enabled() int lsm_enabled(void)
{ {
if (drv) if (drv)
return drv->enabled(); return drv->enabled();
return 0; return 0;
} }
const char *lsm_name(void)
{
if (drv)
return drv->name;
return "none";
}
char *lsm_process_label_get(pid_t pid) char *lsm_process_label_get(pid_t pid)
{ {
if (!drv) { if (!drv) {
......
...@@ -39,6 +39,7 @@ struct lsm_drv { ...@@ -39,6 +39,7 @@ struct lsm_drv {
#if HAVE_APPARMOR || HAVE_SELINUX #if HAVE_APPARMOR || HAVE_SELINUX
void lsm_init(void); void lsm_init(void);
int lsm_enabled(void); int lsm_enabled(void);
const char *lsm_name(void);
char *lsm_process_label_get(pid_t pid); char *lsm_process_label_get(pid_t pid);
int lsm_process_label_set(const char *label, int use_default); int lsm_process_label_set(const char *label, int use_default);
int lsm_proc_mount(struct lxc_conf *lxc_conf); int lsm_proc_mount(struct lxc_conf *lxc_conf);
...@@ -46,6 +47,7 @@ void lsm_proc_unmount(struct lxc_conf *lxc_conf); ...@@ -46,6 +47,7 @@ void lsm_proc_unmount(struct lxc_conf *lxc_conf);
#else #else
static inline void lsm_init(void) { } static inline void lsm_init(void) { }
static inline int lsm_enabled(void) { 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 char *lsm_process_label_get(pid_t pid) { return NULL; }
static inline int lsm_process_label_set(char *label, int use_default) { return 0; } static inline int lsm_process_label_set(char *label, int use_default) { return 0; }
static inline int lsm_proc_mount(struct lxc_conf *lxc_conf) { return 0; } static inline int lsm_proc_mount(struct lxc_conf *lxc_conf) { return 0; }
......
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