From aa7af7d53b32b2937a9406d5fa364a660877bc84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= Date: Sat, 7 Mar 2020 11:35:48 +0100 Subject: [PATCH] Fixed returning EPERM when not allowed as owner For actions which may be allowed depending on the ownership rather than permissions (such as utime()), return EPERM if the owner cannot be determined. --- libntfs-3g/security.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libntfs-3g/security.c b/libntfs-3g/security.c index 1871175a..acee0a5e 100644 --- a/libntfs-3g/security.c +++ b/libntfs-3g/security.c @@ -3048,13 +3048,13 @@ BOOL ntfs_allowed_as_owner(struct SECURITY_CONTEXT *scx, ntfs_inode *ni) free(oldattr); } } - allowed = FALSE; - if (gotowner) { /* TODO : use CAP_FOWNER process capability */ - if (!processuid || (processuid == uid)) - allowed = TRUE; - else - errno = EPERM; + if (gotowner + && (!processuid || (processuid == uid))) + allowed = TRUE; + else { + allowed = FALSE; + errno = EPERM; } } return (allowed);