[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/4] libdiskfs: add permission check to file_chflags
From: |
Samuel Thibault |
Subject: |
Re: [PATCH 3/4] libdiskfs: add permission check to file_chflags |
Date: |
Sat, 14 Jun 2014 21:52:44 +0200 |
User-agent: |
Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30) |
Hello,
Justus Winter, le Wed 11 Jun 2014 13:41:09 +0200, a écrit :
> @@ -25,6 +25,12 @@ diskfs_S_file_chflags (struct protid *cred,
> {
> CHANGE_NODE_FIELD (cred,
> ({
> + if (flags & 0xffff0000
> + && ! idvec_contains (cred->user->uids, 0))
> + /* Only root is allowed to change the high 16
> + bits. */
> + return EPERM;
> +
Mmm, but if a flag was set by root, then a user shouldn't be allowed to
clear it, I guess. So it'd probably rather be something like:
if ((flags & 0xffff0000u) != (np->dn_stat.st_flags & 0xffff0000u)) etc.
Note the needed u in the constant, it is unspecified how negative int
are coded.
Samuel