mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-11-01 06:58:22 +00:00
fchownat: remove setuid and setgid bits on a chown
This commit is contained in:
@@ -63,12 +63,11 @@ syscallret_t syscall_fchownat(context_t *, int fd, char *upath, uid_t owner, gid
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO retain set uid and set gid bits if an auth access was ok
|
|
||||||
attr.uid = owner;
|
attr.uid = owner;
|
||||||
attr.gid = group;
|
attr.gid = group;
|
||||||
attr.mode = (attr.mode) & ~(V_ATTR_MODE_SGID | V_ATTR_MODE_SUID);
|
attr.mode = (attr.mode) & ~(V_ATTR_MODE_SGID | V_ATTR_MODE_SUID);
|
||||||
|
|
||||||
ret.errno = VOP_SETATTR(node, &attr, ((owner == -1) ? 0 : V_ATTR_UID) | ((group == -1) ? 0 : V_ATTR_GID), &_cpu()->thread->proc->cred);
|
ret.errno = VOP_SETATTR(node, &attr, ((owner == -1) ? 0 : V_ATTR_UID) | ((group == -1) ? 0 : V_ATTR_GID) | ((group + owner == -2) ? 0 : V_ATTR_MODE), &_cpu()->thread->proc->cred);
|
||||||
ret.ret = ret.errno ? -1 : 0;
|
ret.ret = ret.errno ? -1 : 0;
|
||||||
|
|
||||||
VOP_UNLOCK(node);
|
VOP_UNLOCK(node);
|
||||||
|
|||||||
Reference in New Issue
Block a user