From owner-freebsd-hackers@FreeBSD.ORG Mon Jan 12 15:45:44 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F11C51065674; Mon, 12 Jan 2009 15:45:44 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id CAA8B8FC0A; Mon, 12 Jan 2009 15:45:44 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 6B33246B17; Mon, 12 Jan 2009 10:45:44 -0500 (EST) Date: Mon, 12 Jan 2009 15:45:44 +0000 (GMT) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Tim Kientzle In-Reply-To: <496ABD9A.8080006@freebsd.org> Message-ID: References: <49692659.2030306@freebsd.org> <49696C24.8010601@freebsd.org> <496AA714.1090904@freebsd.org> <496ABD9A.8080006@freebsd.org> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-hackers@freebsd.org, pluknet Subject: Re: extattr problems? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jan 2009 15:45:45 -0000 On Sun, 11 Jan 2009, Tim Kientzle wrote: > I think this one is a bug. It appears that extattr_set_fd() obeys the > permissions on the file, not the permissions of the descriptor. In > particular, I see this on FreeBSD 6.3: Hmm. Not clear. EAs live in a slightly hazy world between data and meta-data. Normally you can perform operations like fchmod(2), which are strictly meta-data operations, regardless of the flags of the file descriptor they are performed on, subject to ownership/permissions. With NFSv4 ACLs, where the right to change ACLs can be delegated, this only becomes more true. I've chosen to generally treat EAs as meta-data in this regard, where the file descriptor simply names the object rather than as an access method as occurs with write(), etc. How do other systems handle this -- for example, Linux, with its notion of user vs. system namespaces? Robert N M Watson Computer Laboratory University of Cambridge > > [tim@dark /tmp]$ ./extattr_test > fd=3 > extattr_set_fd() = -1 > errno = 13 (Permission denied) > [tim@dark /tmp]$ cat extattr_test.c > #include > #include > #include > #include > #include > > int > main(int argc, char **argv) > { > int n, fd; > > fd = open("/tmp/test12345", O_RDWR | O_CREAT | O_EXCL, 0000); > printf("fd=%d\n", fd); > n = extattr_set_fd(fd, EXTATTR_NAMESPACE_USER, > "testattr", "1234", 4); > printf("extattr_set_fd() = %d\n", n); > if (n != 0) > printf("errno = %d (%s)\n", > errno, strerror(errno)); > exit(0); > } > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" >