]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
resolved: create stub-resolv.conf symlink with correct security label
authorOndrej Mosnacek <omosnace@redhat.com>
Mon, 14 Dec 2020 15:36:27 +0000 (16:36 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 15 Dec 2020 13:12:08 +0000 (14:12 +0100)
Use symlink_atomic_label() instead of symlink_atomic() as the symlink
may need a different label than the parent directory.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
src/resolve/resolved-resolv-conf.c

index 33fc435a9a374f9a870e590cfdeacba9e7075771..029d5c93ed19d9da3338a95ac47600c357585b92 100644 (file)
@@ -10,6 +10,7 @@
 #include "fd-util.h"
 #include "fileio.h"
 #include "fs-util.h"
+#include "label.h"
 #include "ordered-set.h"
 #include "resolved-conf.h"
 #include "resolved-dns-server.h"
@@ -364,7 +365,7 @@ int manager_write_resolv_conf(Manager *m) {
                         log_error_errno(r, "Failed to move new %s into place: %m", PRIVATE_STUB_RESOLV_CONF);
 
         } else {
-                r = symlink_atomic(basename(PRIVATE_UPLINK_RESOLV_CONF), PRIVATE_STUB_RESOLV_CONF);
+                r = symlink_atomic_label(basename(PRIVATE_UPLINK_RESOLV_CONF), PRIVATE_STUB_RESOLV_CONF);
                 if (r < 0)
                         log_error_errno(r, "Failed to symlink %s: %m", PRIVATE_STUB_RESOLV_CONF);
         }