Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37548430
en ru br
Репозитории ALT

Группа :: Эмуляторы
Пакет: kvmtool

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: p9-chown-files-and-dirs-upon-creation.patch
Скачать


From c7734dd626a6d47bb946cfc1611e6c9d1dd67372 Mon Sep 17 00:00:00 2001
From: Graham Whaley <graham.whaley@linux.intel.com>
Date: Thu, 15 Dec 2016 16:24:55 +0000
Subject: [PATCH] kvmtool: p9: chown files and dirs upon creation
The protocol passes in a uid and gid, but we are not chowning
the files to them, just using our default upon creation.
Apply the passed in id's with a chown.
This was found by mounting /tmp over p9 with the S_ISVTX
'sticky' bit set, and finding that files created in /tmp
were not honoring the uid used to create them.
Signed-off-by: Graham Whaley <graham.whaley@intel.com>
---
 virtio/9p.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff --git a/virtio/9p.c b/virtio/9p.c
index 49e7c5c..30100a5 100644
--- a/virtio/9p.c
+++ b/virtio/9p.c
@@ -286,6 +286,9 @@ static void virtio_p9_create(struct p9_dev *p9dev,
 	if (lstat(full_path, &st) < 0)
 		goto err_out;
 
+	if (lchown(full_path, dfid->uid, gid) < 0)
+		goto err_out;
+
 	ret = chmod(full_path, mode & 0777);
 	if (ret < 0)
 		goto err_out;
@@ -326,6 +329,9 @@ static void virtio_p9_mkdir(struct p9_dev *p9dev,
 	if (lstat(full_path, &st) < 0)
 		goto err_out;
 
+	if (lchown(full_path, dfid->uid, gid) < 0)
+		goto err_out;
+
 	ret = chmod(full_path, mode & 0777);
 	if (ret < 0)
 		goto err_out;
-- 
2.7.4
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin