]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
add lsm op for getting name of enabled lsm
authorDwight Engen <dwight.engen@oracle.com>
Fri, 18 Oct 2013 17:44:56 +0000 (13:44 -0400)
committerSerge Hallyn <serge.hallyn@ubuntu.com>
Fri, 18 Oct 2013 18:57:33 +0000 (13:57 -0500)
Signed-off-by: Dwight Engen <dwight.engen@oracle.com>
Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
src/lxc/lsm/lsm.c
src/lxc/lsm/lsm.h

index f022de980adc523903911d74aba6874c6cd57e05..066102bb54b8e03362c664d3847bea4c1e2cb07a 100644 (file)
@@ -62,13 +62,20 @@ void lsm_init(void)
        INFO("Initialized LSM security driver %s", drv->name);
 }
 
-int lsm_enabled()
+int lsm_enabled(void)
 {
        if (drv)
                return drv->enabled();
        return 0;
 }
 
+const char *lsm_name(void)
+{
+       if (drv)
+               return drv->name;
+       return "none";
+}
+
 char *lsm_process_label_get(pid_t pid)
 {
        if (!drv) {
index ee093da09c896f8b1370af0137344399ec9cab6c..621e1af0afd87ed1af8f2abdb3f56f15c4de6445 100644 (file)
@@ -37,19 +37,21 @@ struct lsm_drv {
 };
 
 #if HAVE_APPARMOR || HAVE_SELINUX
-void  lsm_init(void);
-int   lsm_enabled(void);
-char *lsm_process_label_get(pid_t pid);
-int   lsm_process_label_set(const char *label, int use_default);
-int   lsm_proc_mount(struct lxc_conf *lxc_conf);
-void  lsm_proc_unmount(struct lxc_conf *lxc_conf);
+void        lsm_init(void);
+int         lsm_enabled(void);
+const char *lsm_name(void);
+char       *lsm_process_label_get(pid_t pid);
+int         lsm_process_label_set(const char *label, int use_default);
+int         lsm_proc_mount(struct lxc_conf *lxc_conf);
+void        lsm_proc_unmount(struct lxc_conf *lxc_conf);
 #else
-static inline void  lsm_init(void) { }
-static inline int   lsm_enabled(void) { return 0; }
-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_proc_mount(struct lxc_conf *lxc_conf) { return 0; }
-static inline void  lsm_proc_unmount(struct lxc_conf *lxc_conf) { }
+static inline void        lsm_init(void) { }
+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(char *label, int use_default) { return 0; }
+static inline int         lsm_proc_mount(struct lxc_conf *lxc_conf) { return 0; }
+static inline void        lsm_proc_unmount(struct lxc_conf *lxc_conf) { }
 #endif
 
 #endif