On Sat, Apr 06, 2002 at 04:10:40PM -0900, Ethan Benson wrote:
> On Sat, Apr 06, 2002 at 06:28:42PM +0200, Andreas Gruenbacher wrote:
> > > 1) some sort of mount options to change xattr semantecs, for example
> >
> > This does not address the real problem, and therefore makes no sense.
>
> i agree, i was mainly looking for options to let me close this hole as
> fast as possible.
I'm proposing this patch. As Andreas pointed out it doesn't make much sense
to set ACLs on symlinks or special devices. I still allow it for root.
Not allowing them for symlinks could be a problem for some other non ACL
uses of EAs (e.g. if a GUI fs browser wanted to store an icon in there), but
this is probably not a too big problem right now.
Of course this makes the existence of l{get,list,remove}attr a bit
questionable, but then at least root can do something with them still.
-Andi
--- linux-work/fs/xattr.c-o Thu Mar 21 18:15:26 2002
+++ linux-work/fs/xattr.c Sun Apr 7 13:03:06 2002
@@ -67,6 +67,11 @@
if (flags & ~(XATTR_CREATE|XATTR_REPLACE))
return -EINVAL;
+ /* Do not allow creation of EAs on special files and symlinks. */
+ if (!S_ISREG(d->d_inode->i_mode) && !S_ISDIR(d->d_inode->i_mode) &&
+ !capable(CAP_SYS_ADMIN))
+ return -EPERM;
+
error = strncpy_from_user(kname, name, sizeof(kname));
if (error == 0 || error == sizeof(kname))
error = -ERANGE;
|