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.
This commit is contained in:
Jean-Pierre André 2020-03-07 11:35:48 +01:00
parent 314b5396bd
commit aa7af7d53b

View File

@ -3048,12 +3048,12 @@ BOOL ntfs_allowed_as_owner(struct SECURITY_CONTEXT *scx, ntfs_inode *ni)
free(oldattr); free(oldattr);
} }
} }
allowed = FALSE;
if (gotowner) {
/* TODO : use CAP_FOWNER process capability */ /* TODO : use CAP_FOWNER process capability */
if (!processuid || (processuid == uid)) if (gotowner
&& (!processuid || (processuid == uid)))
allowed = TRUE; allowed = TRUE;
else else {
allowed = FALSE;
errno = EPERM; errno = EPERM;
} }
} }