From 16f4917ddfa117d93635d86ab5d0cc9f9bf6b51c Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Sat, 30 Mar 2024 18:41:58 -0400 Subject: [PATCH] passwd: Don't traverse symlinks when querying metadata I hit this when experimenting with: - dnf --installroot - rpm-ostree compose commit --- rust/src/passwd.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/src/passwd.rs b/rust/src/passwd.rs index 821497d82d..99004ac4d5 100644 --- a/rust/src/passwd.rs +++ b/rust/src/passwd.rs @@ -232,7 +232,7 @@ fn dir_contains_uid_gid(dir: &Dir, uid: &Option, gid: &Option) -> Resu let subdir = dir.open_dir(dir_entry.file_name())?; dir_contains_uid_gid(&subdir, uid, gid)? } else { - let metadata = dir.metadata(dir_entry.file_name())?; + let metadata = dir_entry.metadata()?; compare_uid_gid(metadata, uid, gid) };