X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=module%2Fzfs%2Fzfs_fuid.c;h=a5741185a960ca1bc0e280f95d4c904fe7ca5033;hb=cb28b3494e88e0e43c43588fccfa6526344b9a64;hp=8c0424e84b7bc726c07ca6439e3f65666b5e4bf1;hpb=428870ff734fdaccc342b33fc53cf94724409a46;p=zfs.git diff --git a/module/zfs/zfs_fuid.c b/module/zfs/zfs_fuid.c index 8c0424e..a574118 100644 --- a/module/zfs/zfs_fuid.c +++ b/module/zfs/zfs_fuid.c @@ -168,12 +168,12 @@ zfs_fuid_table_destroy(avl_tree_t *idx_tree, avl_tree_t *domain_tree) void *cookie; cookie = NULL; - while (domnode = avl_destroy_nodes(domain_tree, &cookie)) + while ((domnode = avl_destroy_nodes(domain_tree, &cookie))) ksiddomain_rele(domnode->f_ksid); avl_destroy(domain_tree); cookie = NULL; - while (domnode = avl_destroy_nodes(idx_tree, &cookie)) + while ((domnode = avl_destroy_nodes(idx_tree, &cookie))) kmem_free(domnode, sizeof (fuid_domain_t)); avl_destroy(idx_tree); } @@ -388,32 +388,15 @@ zfs_fuid_find_by_idx(zfsvfs_t *zfsvfs, uint32_t idx) void zfs_fuid_map_ids(znode_t *zp, cred_t *cr, uid_t *uidp, uid_t *gidp) { - uint64_t fuid, fgid; - sa_bulk_attr_t bulk[2]; - int count = 0; - - if (IS_EPHEMERAL(zp->z_uid) || IS_EPHEMERAL(zp->z_gid)) { - SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_UID(zp->z_zfsvfs), - NULL, &fuid, 8); - SA_ADD_BULK_ATTR(bulk, count, SA_ZPL_GID(zp->z_zfsvfs), - NULL, &fgid, 8); - VERIFY(0 == sa_bulk_lookup(zp->z_sa_hdl, bulk, count)); - } - if (IS_EPHEMERAL(zp->z_uid)) - *uidp = zfs_fuid_map_id(zp->z_zfsvfs, zp->z_uid, cr, ZFS_OWNER); - else - *uidp = zp->z_uid; - if (IS_EPHEMERAL(zp->z_gid)) - *gidp = zfs_fuid_map_id(zp->z_zfsvfs, - zp->z_gid, cr, ZFS_GROUP); - else - *gidp = zp->z_gid; + *uidp = zfs_fuid_map_id(zp->z_zfsvfs, zp->z_uid, cr, ZFS_OWNER); + *gidp = zfs_fuid_map_id(zp->z_zfsvfs, zp->z_gid, cr, ZFS_GROUP); } uid_t zfs_fuid_map_id(zfsvfs_t *zfsvfs, uint64_t fuid, cred_t *cr, zfs_fuid_type_t type) { +#ifdef HAVE_KSID uint32_t index = FUID_INDEX(fuid); const char *domain; uid_t id; @@ -432,6 +415,12 @@ zfs_fuid_map_id(zfsvfs_t *zfsvfs, uint64_t fuid, FUID_RID(fuid), &id); } return (id); +#else + if(type == ZFS_OWNER || type == ZFS_ACE_USER) + return (crgetuid(cr)); + else + return (crgetgid(cr)); +#endif /* HAVE_KSID */ } /* @@ -500,6 +489,7 @@ zfs_fuid_node_add(zfs_fuid_info_t **fuidpp, const char *domain, uint32_t rid, } } +#ifdef HAVE_KSID /* * Create a file system FUID, based on information in the users cred * @@ -552,6 +542,7 @@ zfs_fuid_create_cred(zfsvfs_t *zfsvfs, zfs_fuid_type_t type, return (FUID_ENCODE(idx, rid)); } +#endif /* HAVE_KSID */ /* * Create a file system FUID for an ACL ace @@ -569,6 +560,7 @@ uint64_t zfs_fuid_create(zfsvfs_t *zfsvfs, uint64_t id, cred_t *cr, zfs_fuid_type_t type, zfs_fuid_info_t **fuidpp) { +#ifdef HAVE_KSID const char *domain; char *kdomain; uint32_t fuid_idx = FUID_INDEX(id); @@ -647,6 +639,12 @@ zfs_fuid_create(zfsvfs_t *zfsvfs, uint64_t id, cred_t *cr, kmem_free(zfuid, sizeof (zfs_fuid_t)); } return (FUID_ENCODE(idx, rid)); +#else + if (type == ZFS_OWNER) + return crgetuid(cr); + else + return crgetgid(cr); +#endif } void @@ -714,6 +712,7 @@ zfs_fuid_info_free(zfs_fuid_info_t *fuidp) boolean_t zfs_groupmember(zfsvfs_t *zfsvfs, uint64_t id, cred_t *cr) { +#ifdef HAVE_KSID ksid_t *ksid = crgetsid(cr, KSID_GROUP); ksidlist_t *ksidlist = crgetsidlist(cr); uid_t gid; @@ -755,6 +754,9 @@ zfs_groupmember(zfsvfs_t *zfsvfs, uint64_t id, cred_t *cr) */ gid = zfs_fuid_map_id(zfsvfs, id, cr, ZFS_GROUP); return (groupmember(gid, cr)); +#else + return (B_TRUE); +#endif } void