From: Alan Cox Date: Fri, 25 Mar 2016 20:24:41 +0000 (+0000) Subject: syscall_fs2: chown rules X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=14d0604ac749c8cadd9d91ade6c61401c4931b76;p=FUZIX.git syscall_fs2: chown rules Under non-historic unix you don't get to chown a file to a group you are not a member of --- diff --git a/Kernel/syscall_fs2.c b/Kernel/syscall_fs2.c index 3ef77639..41cd1c70 100644 --- a/Kernel/syscall_fs2.c +++ b/Kernel/syscall_fs2.c @@ -244,7 +244,8 @@ arg_t _fchmod(void) static int chown_op(inoptr ino) { - if (ino->c_node.i_uid != udata.u_euid && esuper()) + if ((ino->c_node.i_uid != udata.u_euid || + (group != udata.u_gid && !in_group(group))) && esuper()) return (-1); if (ino->c_flags & CRDONLY) { udata.u_error = EROFS;