tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: genfs_can_chtimes() (more duplicate code)
hi,
> 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?
"rely on"? i don't understand what you mean.
i guess you misunderstood VA_UTIMES_NULL?
from utimes(2):
If times is NULL, the access and modification times are set to the cur-
rent time. The caller must be the owner of the file, have permission to
write the file, or be the super-user.
If times is non-NULL, it is assumed to point to an array of two timeval
structures. The access time is set to the value of the first element,
<snip>
all three times at once. The caller must be the owner of the file or be
the super-user.
VA_UTIMES_NULL means that "times is NULL" in the above text.
>>
>> 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.
no objection from me, as far as you don't break the check. :-)
YAMAMOTO Takashi
>
> Thanks,
>
> -e.
Home |
Main Index |
Thread Index |
Old Index