Consider snapshots as descendants via zfs allow -d

OpenSolaris onnv changeset:	9847:2f3ba86e857a

Approved by:	pjd, delphij (mentor)
Obtained from:	OpenSolaris (Bug ID 6809340)
MFC after:	1 week
This commit is contained in:
Martin Matuska 2010-07-24 22:28:29 +00:00
parent a37175df1d
commit 34f56898a1

View File

@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@ -66,8 +66,6 @@
* The ZAP OBJ is referred to as the jump object.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/dmu.h>
#include <sys/dmu_objset.h>
#include <sys/dmu_tx.h>
@ -540,7 +538,7 @@ dsl_deleg_access(const char *dsname, const char *perm, cred_t *cr)
dsl_pool_t *dp;
void *cookie;
int error;
char checkflag = ZFS_DELEG_LOCAL;
char checkflag;
objset_t *mos;
avl_tree_t permsets;
perm_set_t *setnode;
@ -563,6 +561,16 @@ dsl_deleg_access(const char *dsname, const char *perm, cred_t *cr)
return (EPERM);
}
if (dsl_dataset_is_snapshot(ds)) {
/*
* Snapshots are treated as descendents only,
* local permissions do not apply.
*/
checkflag = ZFS_DELEG_DESCENDENT;
} else {
checkflag = ZFS_DELEG_LOCAL;
}
avl_create(&permsets, perm_set_compare, sizeof (perm_set_t),
offsetof(perm_set_t, p_node));