]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
confile: add clearer for lxc.se_context
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 31 May 2017 13:03:26 +0000 (15:03 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 31 May 2017 13:10:09 +0000 (15:10 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/confile.c

index 7b0c48ccacaa1b165bda80ccdd7e352243b8c2e0..ca0eb96fb39022a91406eac8d17720ce86bda5a4 100644 (file)
@@ -93,6 +93,7 @@ static int clr_config_lsm_aa_incomplete(const char *, struct lxc_conf *);
 
 static int set_config_lsm_se_context(const char *, const char *, struct lxc_conf *);
 static int get_config_lsm_se_context(const char *, char *, int, struct lxc_conf *);
+static int clr_config_lsm_se_context(const char *, struct lxc_conf *);
 
 static int set_config_cgroup(const char *, const char *, struct lxc_conf *);
 static int get_config_cgroup(const char *, char *, int, struct lxc_conf *);
@@ -227,7 +228,7 @@ static struct lxc_config_t config[] = {
        { "lxc.kmsg",                 set_config_kmsg,                 get_config_kmsg,              clr_config_kmsg,              },
        { "lxc.aa_profile",           set_config_lsm_aa_profile,       get_config_lsm_aa_profile,    clr_config_lsm_aa_profile,    },
        { "lxc.aa_allow_incomplete",  set_config_lsm_aa_incomplete,    get_config_lsm_aa_incomplete, clr_config_lsm_aa_incomplete, },
-       { "lxc.se_context",           set_config_lsm_se_context,       get_config_lsm_se_context,    NULL },
+       { "lxc.se_context",           set_config_lsm_se_context,       get_config_lsm_se_context,    clr_config_lsm_se_context,    },
        { "lxc.cgroup",               set_config_cgroup,               get_config_cgroup,            NULL },
        { "lxc.id_map",               set_config_idmaps,               get_config_idmaps,            NULL },
        { "lxc.loglevel",             set_config_loglevel,             get_config_loglevel,          NULL },
@@ -2830,10 +2831,6 @@ int lxc_clear_config_item(struct lxc_conf *c, const char *key)
                free(c->rootfs.bdev_type);
                c->rootfs.bdev_type = NULL;
 
-       } else if (strcmp(key, "lxc.se_context") == 0) {
-               free(c->lsm_se_context);
-               c->lsm_se_context = NULL;
-
        } else if (strcmp(key, "lxc.seccomp") == 0) {
                free(c->seccomp);
                c->seccomp = NULL;
@@ -4109,3 +4106,10 @@ static inline int clr_config_lsm_aa_incomplete(const char *key,
        c->lsm_aa_allow_incomplete = 0;
        return 0;
 }
+
+static inline int clr_config_lsm_se_context(const char *key, struct lxc_conf *c)
+{
+       free(c->lsm_se_context);
+       c->lsm_se_context = NULL;
+       return 0;
+}