Lines Matching refs:vap

217 		struct vnode_attr *vap, uint32_t flags, int fmode, uint32_t *statusp, vfs_context_t ctx);
218 static int vnode_authattr_new_internal(vnode_t dvp, struct vnode_attr *vap, int noauth, uint32_t *defaulted_fieldsp, vfs_context_t ctx);
5094 vn_create_reg(vnode_t dvp, vnode_t *vpp, struct nameidata *ndp, struct vnode_attr *vap, uint32_t flags, int fmode, uint32_t *statusp, vfs_context_t ctx)
5099 return VNOP_COMPOUND_OPEN(dvp, vpp, ndp, VNOP_COMPOUND_OPEN_DO_CREATE, fmode, statusp, vap, ctx);
5101 return VNOP_CREATE(dvp, vpp, &ndp->ni_cnd, vap, ctx);
5116 * vap Pointer to the vnode_attr structure
5129 * *vap May be modified by the underlying VFS.
5136 * Notes: The kauth_filesec_t in 'vap', if any, is in host byte order.
5138 * Modification of '*cnp' and '*vap' by the underlying VFS is
5147 vn_create(vnode_t dvp, vnode_t *vpp, struct nameidata *ndp, struct vnode_attr *vap, uint32_t flags, int fmode, uint32_t *statusp, vfs_context_t ctx)
5162 vap->va_vaflags |= VA_NOINHERIT;
5164 vap->va_vaflags |= VA_NOAUTH;
5166 * Handle ACL inheritance, initialize vap.
5168 error = vn_attribute_prepare(dvp, vap, &defaulted, ctx);
5173 if (vap->va_type != VREG && (fmode != 0 || (flags & VN_CREATE_DOOPEN) || statusp)) {
5183 switch(vap->va_type) {
5185 error = vn_create_reg(dvp, vpp, ndp, vap, flags, fmode, statusp, ctx);
5188 error = vn_mkdir(dvp, vpp, ndp, vap, ctx);
5194 error = VNOP_MKNOD(dvp, vpp, cnp, vap, ctx);
5197 panic("vnode_create: unknown vtype %d", vap->va_type);
5219 if (!VATTR_ALL_SUPPORTED(vap) && *vpp) {
5220 KAUTH_DEBUG(" CREATE - doing fallback with ACL %p", vap->va_acl);
5221 error = vnode_setattr_fallback(*vpp, vap, ctx);
5229 if (batched && (old_error == 0) && (vap->va_type == VREG)) {
5241 vn_attribute_cleanup(vap, defaulted);
5254 struct vnode_attr *vap;
5277 vn_attribute_prepare(vnode_t dvp, struct vnode_attr *vap, uint32_t *defaulted_fieldsp, vfs_context_t ctx)
5285 if (!(vap->va_vaflags & VA_NOINHERIT) && vfs_extendedsecurity(dvp->v_mount)) {
5287 if (VATTR_IS_ACTIVE(vap, va_acl)) {
5288 oacl = vap->va_acl;
5291 vap->va_acl = NULL;
5295 vap->va_type == VDIR,
5306 VATTR_CLEAR_ACTIVE(vap, va_acl);
5308 vap->va_base_acl = oacl;
5309 VATTR_SET(vap, va_acl, nacl);
5313 error = vnode_authattr_new_internal(dvp, vap, (vap->va_vaflags & VA_NOAUTH), defaulted_fieldsp, ctx);
5315 vn_attribute_cleanup(vap, *defaulted_fieldsp);
5322 vn_attribute_cleanup(struct vnode_attr *vap, uint32_t defaulted_fields)
5325 * If the caller supplied a filesec in vap, it has been replaced
5331 if (VATTR_IS_ACTIVE(vap, va_acl)) {
5332 nacl = vap->va_acl;
5333 oacl = vap->va_base_acl;
5336 VATTR_SET(vap, va_acl, oacl);
5337 vap->va_base_acl = NULL;
5339 VATTR_CLEAR_ACTIVE(vap, va_acl);
5348 VATTR_CLEAR_ACTIVE(vap, va_mode);
5351 VATTR_CLEAR_ACTIVE(vap, va_gid);
5354 VATTR_CLEAR_ACTIVE(vap, va_uid);
5483 vn_authorize_create(vnode_t dvp, struct componentname *cnp, struct vnode_attr *vap, vfs_context_t ctx, void *reserved)
5503 error = mac_vnode_check_create(ctx, dvp, cnp, vap);
5648 vn_authorize_mkdir(vnode_t dvp, struct componentname *cnp, struct vnode_attr *vap, vfs_context_t ctx, void *reserved)
5669 dvp, cnp, vap);
5767 vnode_immutable(struct vnode_attr *vap, int append, int ignore)
5788 KAUTH_DEBUG("IMMUTABLE - file flags 0x%x mask 0x%x append = %d ignore = %d", vap->va_flags, mask, append, ignore);
5789 if ((vap->va_flags & mask) != 0)
5795 vauth_node_owner(struct vnode_attr *vap, kauth_cred_t cred)
5805 if (vap && VATTR_IS_SUPPORTED(vap, va_uid)) {
5806 result = (vap->va_uid == kauth_cred_getuid(cred)) ? 1 : 0;
5818 * Parameters: vap vnode attribute
5819 * vap->va_gid group owner of vnode object
5830 vauth_node_group(struct vnode_attr *vap, kauth_cred_t cred, int *ismember, int idontknow)
5844 if (vap && VATTR_IS_SUPPORTED(vap, va_gid)) {
5845 error = kauth_cred_ismember_gid(cred, vap->va_gid, &result);
5889 result = vauth_node_owner(vcp->vap, vcp->ctx->vc_ucred);
5912 * vcp->vap File vnode attributes
5934 error = vauth_node_group(vcp->vap, vcp->ctx->vc_ucred, ismember, idontknow);
6018 * Test the posix permissions in (vap) to determine whether (credential)
6024 struct vnode_attr *vap;
6035 vap = vcp->dvap;
6037 vap = vcp->vap;
6056 owner_ok = (needed & vap->va_mode) == needed;
6066 group_ok = (needed & vap->va_mode) == needed;
6076 world_ok = (needed & vap->va_mode) == needed;
6150 (vap->va_mode & S_IRUSR) ? "r" : "-",
6151 (vap->va_mode & S_IWUSR) ? "w" : "-",
6152 (vap->va_mode & S_IXUSR) ? "x" : "-",
6153 (vap->va_mode & S_IRGRP) ? "r" : "-",
6154 (vap->va_mode & S_IWGRP) ? "w" : "-",
6155 (vap->va_mode & S_IXGRP) ? "x" : "-",
6156 (vap->va_mode & S_IROTH) ? "r" : "-",
6157 (vap->va_mode & S_IWOTH) ? "w" : "-",
6158 (vap->va_mode & S_IXOTH) ? "x" : "-",
6160 on_dir ? vcp->dvap->va_uid : vcp->vap->va_uid,
6161 on_dir ? vcp->dvap->va_gid : vcp->vap->va_gid);
6188 struct vnode_attr *vap = vcp->vap;
6248 if (VATTR_IS_NOT(vap, va_acl, NULL)) {
6250 eval.ae_acl = &vap->va_acl->acl_ace[0];
6251 eval.ae_count = vap->va_acl->acl_entrycount;
6301 vcp->vp, cred->cr_posix.cr_uid, vap->va_uid, dvap->va_uid);
6322 struct vnode_attr *vap = vcp->vap;
6354 if (VATTR_IS_NOT(vap, va_acl, NULL)) {
6356 eval.ae_acl = &vap->va_acl->acl_ace[0];
6357 eval.ae_count = vap->va_acl->acl_entrycount;
6506 vnode_authorize_checkimmutable(vnode_t vp, struct vnode_attr *vap, int rights, int ignore)
6560 if ((error = vnode_immutable(vap, append, ignore)) != 0) {
6787 vcp->vap = &va;
7038 vnode_authattr_new(vnode_t dvp, struct vnode_attr *vap, int noauth, vfs_context_t ctx)
7040 return vnode_authattr_new_internal(dvp, vap, noauth, NULL, ctx);
7048 vnode_authattr_new_internal(vnode_t dvp, struct vnode_attr *vap, int noauth, uint32_t *defaulted_fieldsp, vfs_context_t ctx)
7068 (VATTR_IS_ACTIVE(vap, va_acl) || VATTR_IS_ACTIVE(vap, va_uuuid) || VATTR_IS_ACTIVE(vap, va_guuid))) {
7083 VATTR_SET(vap, va_uid, dmp->mnt_fsowner);
7086 if (!VATTR_IS_ACTIVE(vap, va_uid)) {
7088 VATTR_SET(vap, va_uid, kauth_cred_getuid(vfs_context_ucred(ctx)));
7098 VATTR_SET(vap, va_gid, dmp->mnt_fsgroup);
7101 if (!VATTR_IS_ACTIVE(vap, va_gid)) {
7109 VATTR_SET(vap, va_gid, dva.va_gid);
7111 VATTR_SET(vap, va_gid, kauth_cred_getgid(vfs_context_ucred(ctx)));
7117 if (!VATTR_IS_ACTIVE(vap, va_flags))
7118 VATTR_SET(vap, va_flags, 0);
7121 if (!VATTR_IS_ACTIVE(vap, va_mode)) {
7122 VATTR_SET(vap, va_mode, ACCESSPERMS & ~vfs_context_proc(ctx)->p_fd->fd_cmask);
7123 KAUTH_DEBUG("ATTR - defaulting new file mode to %o from umask %o", vap->va_mode, vfs_context_proc(ctx)->p_fd->fd_cmask);
7127 if (!VATTR_IS_ACTIVE(vap, va_create_time)) {
7128 nanotime(&vap->va_create_time);
7129 VATTR_SET_ACTIVE(vap, va_create_time);
7135 if (vap->va_active & ~VNODE_ATTR_NEWOBJ) {
7138 vap->va_active & ~VNODE_ATTR_NEWOBJ);
7162 if (VATTR_IS_ACTIVE(vap, va_flags)) {
7164 if ((vap->va_flags & (UF_SETTABLE | SF_SETTABLE)) != vap->va_flags) {
7170 if ((vap->va_flags & UF_SETTABLE) != vap->va_flags) {
7180 if (!defaulted_mode && VATTR_IS_ACTIVE(vap, va_mode)) {
7182 if (vap->va_mode & S_ISGID) {
7183 if ((error = kauth_cred_ismember_gid(cred, vap->va_gid, &ismember)) != 0) {
7184 KAUTH_DEBUG("ATTR - ERROR: got %d checking for membership in %d", error, vap->va_gid);
7188 KAUTH_DEBUG(" DENIED - can't set SGID bit, not a member of %d", vap->va_gid);
7195 if ((vap->va_mode & S_ISUID) && (vap->va_uid != kauth_cred_getuid(cred))) {
7201 if (!defaulted_owner && (vap->va_uid != kauth_cred_getuid(cred))) {
7202 KAUTH_DEBUG(" DENIED - cannot create new item owned by %d", vap->va_uid);
7207 if ((error = kauth_cred_ismember_gid(cred, vap->va_gid, &ismember)) != 0) {
7208 KAUTH_DEBUG(" ERROR - got %d checking for membership in %d", error, vap->va_gid);
7212 KAUTH_DEBUG(" DENIED - cannot create new item with group %d - not a member", vap->va_gid);
7219 if (VATTR_IS_ACTIVE(vap, va_uuuid)) {
7225 if (!kauth_guid_equal(&vap->va_uuuid, &changer)) {
7231 if (VATTR_IS_ACTIVE(vap, va_guuid)) {
7232 if ((error = kauth_cred_ismember_guid(cred, &vap->va_guuid, &ismember)) != 0) {
7259 * Check that the attribute information in vap can be legally written by the
7269 vnode_authattr(vnode_t vp, struct vnode_attr *vap, kauth_action_t *actionp, vfs_context_t ctx)
7294 if (vap->va_active & VNODE_ATTR_RDONLY) {
7314 if (VATTR_IS_ACTIVE(vap, va_uid) ||
7315 VATTR_IS_ACTIVE(vap, va_gid) ||
7316 VATTR_IS_ACTIVE(vap, va_mode) ||
7317 VATTR_IS_ACTIVE(vap, va_uuuid) ||
7318 VATTR_IS_ACTIVE(vap, va_guuid)) {
7331 if (VATTR_IS_ACTIVE(vap, va_create_time) ||
7332 VATTR_IS_ACTIVE(vap, va_change_time) ||
7333 VATTR_IS_ACTIVE(vap, va_modify_time) ||
7334 VATTR_IS_ACTIVE(vap, va_access_time) ||
7335 VATTR_IS_ACTIVE(vap, va_backup_time)) {
7347 if (VATTR_IS_ACTIVE(vap, va_flags)) {
7355 if (VATTR_IS_ACTIVE(vap, va_acl)) {
7363 if (VATTR_IS_ACTIVE(vap, va_data_size)) {
7384 if (VATTR_IS_ACTIVE(vap, va_data_size)) {
7400 if (VATTR_IS_ACTIVE(vap, va_create_time) ||
7401 VATTR_IS_ACTIVE(vap, va_change_time) ||
7402 VATTR_IS_ACTIVE(vap, va_modify_time) ||
7403 VATTR_IS_ACTIVE(vap, va_access_time) ||
7404 VATTR_IS_ACTIVE(vap, va_backup_time)) {
7415 if (vap->va_vaflags & VA_UTIMES_NULL) {
7429 if (VATTR_IS_ACTIVE(vap, va_mode) && VATTR_IS_SUPPORTED(&ova, va_mode) && (ova.va_mode != vap->va_mode)) {
7430 KAUTH_DEBUG("ATTR - mode change from %06o to %06o", ova.va_mode, vap->va_mode);
7448 if (vap->va_mode & S_ISGID) {
7451 if (VATTR_IS_ACTIVE(vap, va_gid)) {
7452 group = vap->va_gid;
7465 KAUTH_DEBUG("ATTR - ERROR: got %d checking for membership in %d", error, vap->va_gid);
7479 if (vap->va_mode & S_ISUID) {
7482 if (VATTR_IS_ACTIVE(vap, va_uid)) {
7483 owner = vap->va_uid;
7513 if (VATTR_IS_ACTIVE(vap, va_flags)) {
7516 fdelta = vap->va_flags ^ ova.va_flags;
7518 fdelta = vap->va_flags;
7571 * We might want to clear the uid out of vap completely here.
7573 if (VATTR_IS_ACTIVE(vap, va_uid)) {
7574 if (VATTR_IS_SUPPORTED(&ova, va_uid) && (vap->va_uid != ova.va_uid)) {
7575 if (!has_priv_suser && (kauth_cred_getuid(cred) != vap->va_uid)) {
7589 * We might want to clear the gid out of vap completely here.
7591 if (VATTR_IS_ACTIVE(vap, va_gid)) {
7592 if (VATTR_IS_SUPPORTED(&ova, va_gid) && (vap->va_gid != ova.va_gid)) {
7594 if ((error = kauth_cred_ismember_gid(cred, vap->va_gid, &ismember)) != 0) {
7595 KAUTH_DEBUG(" ERROR - got %d checking for membership in %d", error, vap->va_gid);
7600 ova.va_gid, vap->va_gid);
7613 if (VATTR_IS_ACTIVE(vap, va_uuuid)) {
7616 if (kauth_guid_equal(&vap->va_uuuid, &ova.va_uuuid))
7628 kauth_guid_equal(&vap->va_uuuid, &uid_guid))
7646 if (!kauth_guid_equal(&vap->va_uuuid, &changer) &&
7647 !kauth_guid_equal(&vap->va_uuuid, &kauth_null_guid)) {
7660 if (VATTR_IS_ACTIVE(vap, va_guuid)) {
7663 if (kauth_guid_equal(&vap->va_guuid, &ova.va_guuid))
7675 kauth_guid_equal(&vap->va_guuid, &gid_guid))
7689 if (kauth_guid_equal(&vap->va_guuid, &kauth_null_guid))
7691 else if ((error = kauth_cred_ismember_guid(cred, &vap->va_guuid, &ismember)) != 0) {
7723 if (VATTR_IS_ACTIVE(vap, va_mode)) {
7724 newmode = vap->va_mode;
7732 VATTR_SET(vap, va_mode, newmode & ~(S_ISUID | S_ISGID));
7733 KAUTH_DEBUG("CHOWN - masking setugid bits from mode %o to %o", newmode, vap->va_mode);
7741 if (VATTR_IS_ACTIVE(vap, va_acl)) {
7747 if (vap->va_acl != NULL) {
7753 } else if (vap->va_acl == NULL) {
7759 if (vap->va_acl->acl_entrycount != ova.va_acl->acl_entrycount) {
7763 } else if (vap->va_acl->acl_entrycount > 0) {
7765 if (memcmp(&vap->va_acl->acl_ace[0], &ova.va_acl->acl_ace[0],
7766 sizeof(struct kauth_ace) * vap->va_acl->acl_entrycount)) {
7777 if (VATTR_IS_ACTIVE(vap, va_encoding))