lxc/0117-pupulate-device-with-dir-mode-750-and-set-uid-gid.patch

54 lines
1.5 KiB
Diff
Raw Normal View History

From 3d13f72c92b0a40b97cfd708a56d9abaad9c1610 Mon Sep 17 00:00:00 2001
2019-09-30 11:03:07 -04:00
From: LiFeng <lifeng68@huawei.com>
Date: Wed, 31 Jul 2019 05:24:11 -0400
Subject: [PATCH 117/138] pupulate device with dir mode 750 and set uid/gid
2019-09-30 11:03:07 -04:00
Signed-off-by: LiFeng <lifeng68@huawei.com>
---
src/lxc/conf.c | 3 ---
src/lxc/confile.c | 2 ++
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/lxc/conf.c b/src/lxc/conf.c
index d9a7aae..0b10a2d 100644
2019-09-30 11:03:07 -04:00
--- a/src/lxc/conf.c
+++ b/src/lxc/conf.c
@@ -4005,13 +4005,11 @@ static int setup_populate_devs(const struct lxc_rootfs *rootfs, struct lxc_list
int ret = 0;
char *pathdirname = NULL;
char path[MAXPATHLEN];
- mode_t cmask;
mode_t file_mode = 0;
struct lxc_populate_devs *dev_elem = NULL;
struct lxc_list *it = NULL;
INFO("Populating devices into container");
- cmask = umask(S_IXUSR | S_IXGRP | S_IXOTH);
lxc_list_for_each(it, devs) {
dev_elem = it->elem;
@@ -4072,7 +4070,6 @@ static int setup_populate_devs(const struct lxc_rootfs *rootfs, struct lxc_list
return -1;
}
}
- umask(cmask);
INFO("Populated devices into container /dev");
return 0;
diff --git a/src/lxc/confile.c b/src/lxc/confile.c
index 01fc944..3a02e09 100644
2019-09-30 11:03:07 -04:00
--- a/src/lxc/confile.c
+++ b/src/lxc/confile.c
@@ -2335,6 +2335,8 @@ static int set_config_populate_device(const char *key, const char *value,
dev_elem->file_mode = filemode;
dev_elem->maj = major;
dev_elem->min = minor;
+ dev_elem->uid = (uid_t)uid;
+ dev_elem->gid = (gid_t)gid;
lxc_list_add_elem(dev_list, dev_elem);
--
1.8.3.1
2019-09-30 11:03:07 -04:00