From: Christian Brauner Date: Fri, 2 Apr 2021 10:04:22 +0000 (+0200) Subject: confile: fix lxc.namespace.share.[identifier] X-Git-Tag: lxc-5.0.0~220^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F3764%2Fhead;p=thirdparty%2Flxc.git confile: fix lxc.namespace.share.[identifier] Link: https://github.com/lxc/lxc/pull/3763/files#r606089660 Signed-off-by: Christian Brauner --- diff --git a/src/lxc/confile.c b/src/lxc/confile.c index a07572dc5..a679d235d 100644 --- a/src/lxc/confile.c +++ b/src/lxc/confile.c @@ -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;