anitazha / rpms / systemd

Forked from rpms/systemd 3 years ago
Clone

Blame SOURCES/0199-Fix-permissions-on-run-systemd-nspawn-locks.patch

1ff636
From b0a6aa4de054e69213d0902094a1ae85fe2c5e58 Mon Sep 17 00:00:00 2001
1ff636
From: Seth Jennings <sjenning@redhat.com>
1ff636
Date: Tue, 5 May 2015 13:31:01 -0500
1ff636
Subject: [PATCH] Fix permissions on /run/systemd/nspawn/locks
1ff636
1ff636
machined is getting an EACCES when trying to create the lock file for
1ff636
images because the mode on /run/systemd/nspawn/locks is 0600.
1ff636
1ff636
mkdir("/run/systemd/nspawn/locks", 0600) = -1 EEXIST (File exists)
1ff636
stat("/run/systemd/nspawn/locks", {st_mode=S_IFDIR|0600, st_size=40, ...}) = 0
1ff636
open("/run/systemd/nspawn/locks/inode-41:256", O_RDWR|O_CREAT|O_NOCTTY|O_NOFOLLOW|O_CLOEXEC, 0600) = -1 EACCES (Permission denied)
1ff636
1ff636
This commit adjusts the mode to 0700 to correct the issue.
1ff636
1ff636
(cherry picked from commit 7e7cddb22493642dad826ec42ac00979f40b2d17)
1ff636
1ff636
Cherry-picked from: 7e7cddb
1ff636
Resolves: #1222517
1ff636
---
1ff636
 src/shared/machine-image.c | 4 ++--
1ff636
 1 file changed, 2 insertions(+), 2 deletions(-)
1ff636
1ff636
diff --git a/src/shared/machine-image.c b/src/shared/machine-image.c
1ff636
index 8d61507..c02ee81 100644
1ff636
--- a/src/shared/machine-image.c
1ff636
+++ b/src/shared/machine-image.c
1ff636
@@ -601,7 +601,7 @@ int image_path_lock(const char *path, int operation, LockFile *global, LockFile
1ff636
                 return r;
1ff636
 
1ff636
         if (p) {
1ff636
-                mkdir_p("/run/systemd/nspawn/locks", 0600);
1ff636
+                mkdir_p("/run/systemd/nspawn/locks", 0700);
1ff636
 
1ff636
                 r = make_lock_file(p, operation, global);
1ff636
                 if (r < 0) {
1ff636
@@ -628,7 +628,7 @@ int image_name_lock(const char *name, int operation, LockFile *ret) {
1ff636
         if (streq(name, ".host"))
1ff636
                 return -EBUSY;
1ff636
 
1ff636
-        mkdir_p("/run/systemd/nspawn/locks", 0600);
1ff636
+        mkdir_p("/run/systemd/nspawn/locks", 0700);
1ff636
         p = strjoina("/run/systemd/nspawn/locks/name-", name);
1ff636
 
1ff636
         return make_lock_file(p, operation, ret);