summaryrefslogtreecommitdiffstats
path: root/src/home
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-09-22 15:51:17 +0200
committerLennart Poettering <lennart@poettering.net>2020-09-23 18:57:36 +0200
commit511a8cfe300662963522cea314e3b2426fc2f3ee (patch)
treed496c0cb8d88bb47552dbf3dc450758671715c6b /src/home
parentmount-util: make sure get_mount_flags() ever follows symlinks (diff)
downloadsystemd-511a8cfe300662963522cea314e3b2426fc2f3ee.tar.xz
systemd-511a8cfe300662963522cea314e3b2426fc2f3ee.zip
mount-util: switch most mount_verbose() code over to not follow symlinks
Diffstat (limited to 'src/home')
-rw-r--r--src/home/homework-directory.c4
-rw-r--r--src/home/homework-luks.c1
-rw-r--r--src/home/homework-mount.c6
3 files changed, 6 insertions, 5 deletions
diff --git a/src/home/homework-directory.c b/src/home/homework-directory.c
index 7d00da214a..49660c7389 100644
--- a/src/home/homework-directory.c
+++ b/src/home/homework-directory.c
@@ -61,11 +61,11 @@ int home_activate_directory(
/* Create a mount point (even if the directory is already placed correctly), as a way to indicate
* this mount point is now "activated". Moreover, we want to set per-user
* MS_NOSUID/MS_NOEXEC/MS_NODEV. */
- r = mount_verbose(LOG_ERR, ip, hd, NULL, MS_BIND, NULL);
+ r = mount_nofollow_verbose(LOG_ERR, ip, hd, NULL, MS_BIND, NULL);
if (r < 0)
return r;
- r = mount_verbose(LOG_ERR, NULL, hd, NULL, MS_BIND|MS_REMOUNT|user_record_mount_flags(h), NULL);
+ r = mount_nofollow_verbose(LOG_ERR, NULL, hd, NULL, MS_BIND|MS_REMOUNT|user_record_mount_flags(h), NULL);
if (r < 0) {
(void) umount_verbose(hd);
return r;
diff --git a/src/home/homework-luks.c b/src/home/homework-luks.c
index b3082f144a..f13f41e612 100644
--- a/src/home/homework-luks.c
+++ b/src/home/homework-luks.c
@@ -5,6 +5,7 @@
#include <poll.h>
#include <sys/file.h>
#include <sys/ioctl.h>
+#include <sys/mount.h>
#include <sys/xattr.h>
#include "blkid-util.h"
diff --git a/src/home/homework-mount.c b/src/home/homework-mount.c
index 51c0a38649..7c94de49cc 100644
--- a/src/home/homework-mount.c
+++ b/src/home/homework-mount.c
@@ -38,7 +38,7 @@ int home_mount_node(const char *node, const char *fstype, bool discard, unsigned
} else
options = discard_option;
- r = mount_verbose(LOG_ERR, node, "/run/systemd/user-home-mount", fstype, flags|MS_RELATIME, strempty(options));
+ r = mount_nofollow_verbose(LOG_ERR, node, "/run/systemd/user-home-mount", fstype, flags|MS_RELATIME, strempty(options));
if (r < 0)
return r;
@@ -52,7 +52,7 @@ int home_unshare_and_mount(const char *node, const char *fstype, bool discard, u
if (unshare(CLONE_NEWNS) < 0)
return log_error_errno(errno, "Couldn't unshare file system namespace: %m");
- r = mount_verbose(LOG_ERR, "/run", "/run", NULL, MS_SLAVE|MS_REC, NULL); /* Mark /run as MS_SLAVE in our new namespace */
+ r = mount_nofollow_verbose(LOG_ERR, "/run", "/run", NULL, MS_SLAVE|MS_REC, NULL); /* Mark /run as MS_SLAVE in our new namespace */
if (r < 0)
return r;
@@ -83,7 +83,7 @@ int home_move_mount(const char *user_name_and_realm, const char *target) {
(void) mkdir_p(target, 0700);
- r = mount_verbose(LOG_ERR, d, target, NULL, MS_BIND, NULL);
+ r = mount_nofollow_verbose(LOG_ERR, d, target, NULL, MS_BIND, NULL);
if (r < 0)
return r;