Skip to content

Commit

Permalink
Fixes ZFS compilation with real secpolicy_vnode_setids_setgids function.
Browse files Browse the repository at this point in the history
secpolicy_vnode_setids_setgids is called with parameter "gid" which is not defined (as we don't HAVE_KSID).
Previously secpolicy_vnode_setids_setgids was a macro definition to zero so reference to gid variable was removed by the preprocessor.

That block of code also used zfs_fuid_create_cred which didn't have a linux fallback code without KSID.
Copied relevant portions from the function body.

Signed-off-by: Massimo Maggi <massimo@mmmm.it>
  • Loading branch information
maxximino committed Mar 18, 2012
1 parent 897bc35 commit b2f0012
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 0 additions & 4 deletions module/zfs/zfs_acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1725,9 +1725,7 @@ zfs_acl_ids_create(znode_t *dzp, int flag, vattr_t *vap, cred_t *cr,
int error;
zfs_sb_t *zsb = ZTOZSB(dzp);
zfs_acl_t *paclp;
#ifdef HAVE_KSID
gid_t gid;
#endif /* HAVE_KSID */
boolean_t need_chmod = B_TRUE;
boolean_t inherited = B_FALSE;

Expand All @@ -1741,7 +1739,6 @@ zfs_acl_ids_create(znode_t *dzp, int flag, vattr_t *vap, cred_t *cr,

acl_ids->z_fuid = vap->va_uid;
acl_ids->z_fgid = vap->va_gid;
#ifdef HAVE_KSID
/*
* Determine uid and gid.
*/
Expand Down Expand Up @@ -1793,7 +1790,6 @@ zfs_acl_ids_create(znode_t *dzp, int flag, vattr_t *vap, cred_t *cr,
}
}
}
#endif /* HAVE_KSID */

/*
* If we're creating a directory, and the parent directory has the
Expand Down
12 changes: 10 additions & 2 deletions module/zfs/zfs_fuid.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,6 @@ 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
*
Expand All @@ -501,6 +500,7 @@ uint64_t
zfs_fuid_create_cred(zfs_sb_t *zsb, zfs_fuid_type_t type,
cred_t *cr, zfs_fuid_info_t **fuidp)
{
#ifdef HAVE_KSID
uint64_t idx;
ksid_t *ksid;
uint32_t rid;
Expand Down Expand Up @@ -540,8 +540,16 @@ zfs_fuid_create_cred(zfs_sb_t *zsb, zfs_fuid_type_t type,
zfs_fuid_node_add(fuidp, kdomain, rid, idx, id, type);

return (FUID_ENCODE(idx, rid));
}
#else
uid_t id;

VERIFY(type == ZFS_OWNER || type == ZFS_GROUP);

id = (type == ZFS_OWNER) ? crgetuid(cr) : crgetgid(cr);

return ((uint64_t)id);
#endif /* HAVE_KSID */
}

/*
* Create a file system FUID for an ACL ace
Expand Down

0 comments on commit b2f0012

Please sign in to comment.