diff options
author | Balint Reczey <balint@balintreczey.hu> | 2022-11-05 11:14:01 +0100 |
---|---|---|
committer | Balint Reczey <balint@balintreczey.hu> | 2022-11-05 14:46:09 +0100 |
commit | 8f8e8c66d6da62cb952ad67290296368b7dd8f41 (patch) | |
tree | 217d8aa6c0e0fe1c3219b492ce03e200eb0086d8 | |
parent | 9351646a5370e5e81b7ade2dcd01be321448486d (diff) | |
download | shadow-8f8e8c66d6da62cb952ad67290296368b7dd8f41.tar.gz |
Fix tree copying regressions introduced in 4.12.2.
Closes: #1023132
-rw-r--r-- | debian/patches/0002-copy_tree-use-fchmodat-instead-of-chmod.patch | 27 | ||||
-rw-r--r-- | debian/patches/0003-copy_tree-do-not-block-on-fifos.patch | 53 | ||||
-rw-r--r-- | debian/patches/series | 2 |
3 files changed, 82 insertions, 0 deletions
diff --git a/debian/patches/0002-copy_tree-use-fchmodat-instead-of-chmod.patch b/debian/patches/0002-copy_tree-use-fchmodat-instead-of-chmod.patch new file mode 100644 index 00000000..5bc79ce3 --- /dev/null +++ b/debian/patches/0002-copy_tree-use-fchmodat-instead-of-chmod.patch @@ -0,0 +1,27 @@ +From f3bdb28e57e5e38c1e89347976c7d61a181eec32 Mon Sep 17 00:00:00 2001 +From: Samanta Navarro <ferivoz@riseup.net> +Date: Sun, 4 Sep 2022 11:54:19 +0000 +Subject: [PATCH 1/2] copy_tree: use fchmodat instead of chmod + +Fixes regression introduced in faeab50e710131816b261de66141524898c2c487 +for setups configured without acl support. +--- + libmisc/copydir.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libmisc/copydir.c b/libmisc/copydir.c +index 5605f6fe..b6025f4c 100644 +--- a/libmisc/copydir.c ++++ b/libmisc/copydir.c +@@ -529,7 +529,7 @@ static int copy_dir (const struct path_info *src, const struct path_info *dst, + || ( (perm_copy_path (src, dst, &ctx) != 0) + && (errno != 0)) + #else /* !WITH_ACL */ +- || (chmod (dst, statp->st_mode) != 0) ++ || (fchmodat (dst->dirfd, dst->name, statp->st_mode & 07777, AT_SYMLINK_NOFOLLOW) != 0) + #endif /* !WITH_ACL */ + #ifdef WITH_ATTR + /* +-- +2.34.1 + diff --git a/debian/patches/0003-copy_tree-do-not-block-on-fifos.patch b/debian/patches/0003-copy_tree-do-not-block-on-fifos.patch new file mode 100644 index 00000000..68ed93e6 --- /dev/null +++ b/debian/patches/0003-copy_tree-do-not-block-on-fifos.patch @@ -0,0 +1,53 @@ +From 10cd68e0f04b48363eb32d2c6e168b358fb27810 Mon Sep 17 00:00:00 2001 +From: Samanta Navarro <ferivoz@riseup.net> +Date: Sun, 4 Sep 2022 11:58:03 +0000 +Subject: [PATCH 2/2] copy_tree: do not block on fifos + +Fixes regression introduced in faeab50e710131816b261de66141524898c2c487. + +If a directory contains fifos, then openat blocks until the other side +of the fifo is connected as well. + +This means that users can prevent "usermod -m" from completing if their +home directories contain at least one fifo. +--- + libmisc/copydir.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/libmisc/copydir.c b/libmisc/copydir.c +index b6025f4c..5fb47da0 100644 +--- a/libmisc/copydir.c ++++ b/libmisc/copydir.c +@@ -126,12 +126,12 @@ static int perm_copy_path(const struct path_info *src, + { + int src_fd, dst_fd, ret; + +- src_fd = openat(src->dirfd, src->name, O_RDONLY | O_NOFOLLOW | O_CLOEXEC); ++ src_fd = openat(src->dirfd, src->name, O_RDONLY | O_NOFOLLOW | O_NONBLOCK | O_CLOEXEC); + if (src_fd < 0) { + return -1; + } + +- dst_fd = openat(dst->dirfd, dst->name, O_RDONLY | O_NOFOLLOW | O_CLOEXEC); ++ dst_fd = openat(dst->dirfd, dst->name, O_RDONLY | O_NOFOLLOW | O_NONBLOCK | O_CLOEXEC); + if (dst_fd < 0) { + (void) close (src_fd); + return -1; +@@ -152,12 +152,12 @@ static int attr_copy_path(const struct path_info *src, + { + int src_fd, dst_fd, ret; + +- src_fd = openat(src->dirfd, src->name, O_RDONLY | O_NOFOLLOW | O_CLOEXEC); ++ src_fd = openat(src->dirfd, src->name, O_RDONLY | O_NOFOLLOW | O_NONBLOCK | O_CLOEXEC); + if (src_fd < 0) { + return -1; + } + +- dst_fd = openat(dst->dirfd, dst->name, O_RDONLY | O_NOFOLLOW | O_CLOEXEC); ++ dst_fd = openat(dst->dirfd, dst->name, O_RDONLY | O_NOFOLLOW | O_NONBLOCK | O_CLOEXEC); + if (dst_fd < 0) { + (void) close (src_fd); + return -1; +-- +2.34.1 + diff --git a/debian/patches/series b/debian/patches/series index 78ea73e4..3d7e73cd 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -3,6 +3,8 @@ #901_testsuite_gcov 0001-chage-Fix-regression-in-print_date.patch +0002-copy_tree-use-fchmodat-instead-of-chmod.patch +0003-copy_tree-do-not-block-on-fifos.patch 008_login_log_failure_in_FTMP 301_lastlog_faillog_do_not_reset_non-existent_data 401_cppw_src.dpatch |