anitazha / rpms / systemd

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