tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: genfs_can_chtimes() (more duplicate code)



On Thu, Apr 30, 2009 at 4:07 AM, Elad Efrat <elad%netbsd.org@localhost> wrote:
> On Thu, Apr 30, 2009 at 2:54 AM, YAMAMOTO Takashi
> <yamt%mwd.biglobe.ne.jp@localhost> wrote:
>
>>>     1113 if (!issuperuser) {
>>>     1114      if (euid != uid)
>>>     1115              return EPERM;
>>>     1116      if ((setattrflags & VA_UTIMES_NULL) == 0) {
>>>     1117              error = VOP_ACCESS(vp, VWRITE, cred);
>>>     1118              if (error)
>>>     1119                      return error;
>>>     1120      }
>>>     1121 }
>>>
>>> ...only much uglier, in file-systems that are not udf. :)
>>
>> have you read "uglier" ones?
>> at least ufs's one seems different and more correct.
>
> What's different with the ufs version? that it doesn't rely on VA_UTIMES_NULL?
>
>    588 if (kauth_cred_geteuid(cred) != ip->i_uid &&
>    589     (error = kauth_authorize_generic(cred,
>    590     KAUTH_GENERIC_ISSUSER, NULL)) &&
>    591     ((vap->va_vaflags & VA_UTIMES_NULL) == 0 ||
>    592     (error = VOP_ACCESS(vp, VWRITE, cred))))
>    593         goto out;

I would like to commit this change, with an adjustment that makes
genfs_can_chtimes() use the logic in ufs -- after a quick grep it does
look like it's what's in all file-systems but udf.

Please let me know if there are any objections.

Thanks,

-e.


Home | Main Index | Thread Index | Old Index