Handle KAUTH_{U,G}ID_NONE and mode -1 in fchmod_extended

These are actually accepted and allowed by Darwin.
This commit is contained in:
Ariel Abreu 2021-04-30 09:30:11 -04:00
parent 1c3749bf8a
commit e360419d3b
No known key found for this signature in database
GPG Key ID: BB20848279B910AC

View File

@ -3,10 +3,18 @@
#include "../errno.h"
#include <linux-syscalls/linux.h>
#include <sys/types.h>
#include <sys/kauth.h>
long sys_fchmod_extended(int fd, int uid, int gid, int mode, void* xsec)
{
int ret;
// apparently, these are supposed to go through successfully
if (uid == KAUTH_UID_NONE || gid == KAUTH_GID_NONE || mode == -1) {
return 0;
}
ret = LINUX_SYSCALL2(__NR_fchmod, fd, mode);
if (ret < 0)
return errno_linux_to_bsd(ret);