mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-28 19:54:35 +00:00
agent: exclude symlinks from recursive ownership change
currently when fsGroup is used with direct-assign, kata agent recursively changes ownership and permission for each file including symlinks. However the problem with symlinks is, the permission of the symlink itself may not be same as the underlying file. So while doing recursive ownership and permission changes we should skip symlinks. Fixes: #7364 Signed-off-by: Alakesh Haloi <a_haloi@apple.com>
This commit is contained in:
parent
7729d82e6e
commit
371a118ad0
@ -725,6 +725,14 @@ pub fn recursive_ownership_change(
|
||||
mask |= EXEC_MASK;
|
||||
mask |= MODE_SETGID;
|
||||
}
|
||||
|
||||
// We do not want to change the permission of the underlying file
|
||||
// using symlink. Hence we skip symlinks from recursive ownership
|
||||
// and permission changes.
|
||||
if path.is_symlink() {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
nix::unistd::chown(path, uid, gid)?;
|
||||
|
||||
if gid.is_some() {
|
||||
|
Loading…
Reference in New Issue
Block a user