Re: [PATCH] utime(s): Honour CAP_FOWNER when times==NULL

From: Al Viro
Date: Mon Jul 16 2007 - 16:45:37 EST


On Tue, Jul 17, 2007 at 01:00:42AM +0530, Satyam Sharma wrote:
> > if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
> >
> > test is a rather common test, and in fact, arguably, every time you see
> > one part of it, you should probably see the other. Would it make sense to
> > make a helper inline function to do this, and replace all users? Doing a
> >
> > git grep 'fsuid.*\<i_uid\>'
> >
> > seems to show quite a few cases of this pattern..
>
> Yes, I thought of writing a helper function for this myself. The semantics
> of CAP_FOWNER sort of justify that, but probably better to get Al's views
> on this first.

Helper makes sense (and most of these places will become its call), but...
E.g. IIRC the change of UID requires CAP_CHOWN; CAP_FOWNER is not enough.
Ditto for change of GID. setlease() is using CAP_LEASE and that appears
to be intentional (no idea what relevant standards say here)...

I'd suggest converting the obvious cases with new helper and taking the
rest one-by-one after that. Some of those might want CAP_FOWNER added,
some not...
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/