]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
confile: fix lxc.namespace.share.[identifier] 3764/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Fri, 2 Apr 2021 10:04:22 +0000 (12:04 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Fri, 2 Apr 2021 10:05:58 +0000 (12:05 +0200)
Link: https://github.com/lxc/lxc/pull/3763/files#r606089660
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/confile.c

index a07572dc5bd3b07c868556e9aa88c06d93d24ee9..a679d235d224d8f90f3abe0ffeb587b6dad4bd14 100644 (file)
@@ -226,7 +226,7 @@ static struct lxc_config_t config_jump_table[] = {
        { "lxc.mount.fstab",                true,  set_config_mount_fstab,                get_config_mount_fstab,                clr_config_mount_fstab,                },
        { "lxc.namespace.clone",            true,  set_config_namespace_clone,            get_config_namespace_clone,            clr_config_namespace_clone,            },
        { "lxc.namespace.keep",             true,  set_config_namespace_keep,             get_config_namespace_keep,             clr_config_namespace_keep,             },
-       { "lxc.namespace.share",            true,  set_config_namespace_share,            get_config_namespace_share,            clr_config_namespace_share,            },
+       { "lxc.namespace.share.",           false, set_config_namespace_share,            get_config_namespace_share,            clr_config_namespace_share,            },
        { "lxc.time.offset.boot",           true,  set_config_time_offset_boot,           get_config_time_offset_boot,           clr_config_time_offset_boot,           },
        { "lxc.time.offset.monotonic",      true,  set_config_time_offset_monotonic,      get_config_time_offset_monotonic,      clr_config_time_offset_monotonic,      },
        { "lxc.net.",                       false, set_config_jump_table_net,             get_config_jump_table_net,             clr_config_jump_table_net,             },
@@ -2915,6 +2915,9 @@ static int set_config_namespace_share(const char *key, const char *value,
                return clr_config_namespace_share(key, lxc_conf, data);
 
        namespace = key + STRLITERALLEN("lxc.namespace.share.");
+       if (is_empty_string(namespace))
+               return ret_errno(EINVAL);
+
        ns_idx = lxc_namespace_2_ns_idx(namespace);
        if (ns_idx < 0)
                return ns_idx;
@@ -4663,6 +4666,9 @@ static int get_config_namespace_share(const char *key, char *retv, int inlen,
                memset(retv, 0, inlen);
 
        namespace = key + STRLITERALLEN("lxc.namespace.share.");
+       if (is_empty_string(namespace))
+               return ret_errno(EINVAL);
+
        ns_idx = lxc_namespace_2_ns_idx(namespace);
        if (ns_idx < 0)
                return ns_idx;
@@ -5200,6 +5206,9 @@ static int clr_config_namespace_share(const char *key,
        const char *namespace;
 
        namespace = key + STRLITERALLEN("lxc.namespace.share.");
+       if (is_empty_string(namespace))
+               return ret_errno(EINVAL);
+
        ns_idx = lxc_namespace_2_ns_idx(namespace);
        if (ns_idx < 0)
                return ns_idx;