* Given a vnode, set its ACL. */
| 225 | * Given a vnode, set its ACL. |
| 226 | */ |
| 227 | static int |
| 228 | vacl_set_acl(struct thread *td, struct vnode *vp, acl_type_t type, |
| 229 | const struct acl *aclp) |
| 230 | { |
| 231 | struct acl *inkernelacl; |
| 232 | struct mount *mp; |
| 233 | int error; |
| 234 | |
| 235 | AUDIT_ARG_VALUE(type); |
| 236 | inkernelacl = acl_alloc(M_WAITOK); |
| 237 | error = acl_copyin(aclp, inkernelacl, type); |
| 238 | if (error != 0) |
| 239 | goto out; |
| 240 | error = vn_start_write(vp, &mp, V_WAIT | PCATCH); |
| 241 | if (error != 0) |
| 242 | goto out; |
| 243 | vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); |
| 244 | AUDIT_ARG_VNODE1(vp); |
| 245 | #ifdef MAC |
| 246 | error = mac_vnode_check_setacl(td->td_ucred, vp, type, inkernelacl); |
| 247 | if (error != 0) |
| 248 | goto out_unlock; |
| 249 | #endif |
| 250 | error = VOP_SETACL(vp, acl_type_unold(type), inkernelacl, |
| 251 | td->td_ucred, td); |
| 252 | #ifdef MAC |
| 253 | out_unlock: |
| 254 | #endif |
| 255 | VOP_UNLOCK(vp); |
| 256 | vn_finished_write(mp); |
| 257 | out: |
| 258 | acl_free(inkernelacl); |
| 259 | return (error); |
| 260 | } |
| 261 | |
| 262 | /* |
| 263 | * Given a vnode, get its ACL. |
no test coverage detected