nfs4acl.c (aa07c713ecfc0522916f3cd57ac628ea6127c0ec) nfs4acl.c (ecc7455d8eb1860f5aa6b9ad82a9a81f93eb11d1)
1/*
2 * Common NFSv4 ACL handling code.
3 *
4 * Copyright (c) 2002, 2003 The Regents of the University of Michigan.
5 * All rights reserved.
6 *
7 * Marius Aamodt Eriksen <marius@umich.edu>
8 * Jeff Sedlak <jsedlak@umich.edu>

--- 22 unchanged lines hidden (view full) ---

31 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
32 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
33 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#include <linux/slab.h>
38#include <linux/nfs_fs.h>
1/*
2 * Common NFSv4 ACL handling code.
3 *
4 * Copyright (c) 2002, 2003 The Regents of the University of Michigan.
5 * All rights reserved.
6 *
7 * Marius Aamodt Eriksen <marius@umich.edu>
8 * Jeff Sedlak <jsedlak@umich.edu>

--- 22 unchanged lines hidden (view full) ---

31 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
32 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
33 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 */
36
37#include <linux/slab.h>
38#include <linux/nfs_fs.h>
39#include <linux/export.h>
40#include "nfsfh.h"
41#include "nfsd.h"
42#include "acl.h"
43#include "vfs.h"
44
45#define NFS4_ACL_TYPE_DEFAULT 0x01
46#define NFS4_ACL_DIR 0x02
47#define NFS4_ACL_OWNER 0x04

--- 349 unchanged lines hidden (view full) ---

397
398static void
399sort_pacl(struct posix_acl *pacl)
400{
401 /* posix_acl_valid requires that users and groups be in order
402 * by uid/gid. */
403 int i, j;
404
39#include "nfsfh.h"
40#include "nfsd.h"
41#include "acl.h"
42#include "vfs.h"
43
44#define NFS4_ACL_TYPE_DEFAULT 0x01
45#define NFS4_ACL_DIR 0x02
46#define NFS4_ACL_OWNER 0x04

--- 349 unchanged lines hidden (view full) ---

396
397static void
398sort_pacl(struct posix_acl *pacl)
399{
400 /* posix_acl_valid requires that users and groups be in order
401 * by uid/gid. */
402 int i, j;
403
405 /* no users or groups */
406 if (!pacl || pacl->a_count <= 4)
407 return;
408
404 if (pacl->a_count <= 4)
405 return; /* no users or groups */
409 i = 1;
410 while (pacl->a_entries[i].e_tag == ACL_USER)
411 i++;
412 sort_pacl_range(pacl, 1, i-1);
413
414 BUG_ON(pacl->a_entries[i].e_tag != ACL_GROUP_OBJ);
415 j = ++i;
416 while (pacl->a_entries[j].e_tag == ACL_GROUP)

--- 110 unchanged lines hidden (view full) ---

527{
528 struct posix_acl_entry *pace;
529 struct posix_acl *pacl;
530 int nace;
531 int i, error = 0;
532
533 /*
534 * ACLs with no ACEs are treated differently in the inheritable
406 i = 1;
407 while (pacl->a_entries[i].e_tag == ACL_USER)
408 i++;
409 sort_pacl_range(pacl, 1, i-1);
410
411 BUG_ON(pacl->a_entries[i].e_tag != ACL_GROUP_OBJ);
412 j = ++i;
413 while (pacl->a_entries[j].e_tag == ACL_GROUP)

--- 110 unchanged lines hidden (view full) ---

524{
525 struct posix_acl_entry *pace;
526 struct posix_acl *pacl;
527 int nace;
528 int i, error = 0;
529
530 /*
531 * ACLs with no ACEs are treated differently in the inheritable
535 * and effective cases: when there are no inheritable ACEs,
536 * calls ->set_acl with a NULL ACL structure.
532 * and effective cases: when there are no inheritable ACEs, we
533 * set a zero-length default posix acl:
537 */
534 */
538 if (state->empty && (flags & NFS4_ACL_TYPE_DEFAULT))
539 return NULL;
540
535 if (state->empty && (flags & NFS4_ACL_TYPE_DEFAULT)) {
536 pacl = posix_acl_alloc(0, GFP_KERNEL);
537 return pacl ? pacl : ERR_PTR(-ENOMEM);
538 }
541 /*
542 * When there are no effective ACEs, the following will end
543 * up setting a 3-element effective posix ACL with all
544 * permissions zero.
545 */
546 if (!state->users->n && !state->groups->n)
547 nace = 3;
548 else /* Note we also include a MASK ACE in this case: */

--- 393 unchanged lines hidden ---
539 /*
540 * When there are no effective ACEs, the following will end
541 * up setting a 3-element effective posix ACL with all
542 * permissions zero.
543 */
544 if (!state->users->n && !state->groups->n)
545 nace = 3;
546 else /* Note we also include a MASK ACE in this case: */

--- 393 unchanged lines hidden ---