1/*- 2 * Copyright (c) 1999-2001 Robert N. M. Watson 3 * All rights reserved. 4 * 5 * This software was developed by Robert Watson for the TrustedBSD Project. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 11 unchanged lines hidden (view full) --- 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * |
28 * $FreeBSD: head/sys/kern/vfs_acl.c 91406 2002-02-27 18:32:23Z jhb $ |
29 */ 30/* 31 * Developed by the TrustedBSD Project. 32 * Support for POSIX.1e access control lists. 33 */ 34 35#include "opt_cap.h" 36 --- 537 unchanged lines hidden (view full) --- 574 int error; 575 576 error = copyin(aclp, &inkernacl, sizeof(struct acl)); 577 if (error) 578 return(error); 579 error = vn_start_write(vp, &mp, V_WAIT | PCATCH); 580 if (error != 0) 581 return (error); |
582 VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE); |
583 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); |
584 error = VOP_SETACL(vp, type, &inkernacl, td->td_ucred, td); |
585 VOP_UNLOCK(vp, 0, td); 586 vn_finished_write(mp); 587 return(error); 588} 589 590/* 591 * Given a vnode, get its ACL. 592 */ 593static int 594vacl_get_acl(struct thread *td, struct vnode *vp, acl_type_t type, 595 struct acl *aclp) 596{ 597 struct acl inkernelacl; 598 int error; 599 |
600 VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE); |
601 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); |
602 error = VOP_GETACL(vp, type, &inkernelacl, td->td_ucred, td); |
603 VOP_UNLOCK(vp, 0, td); 604 if (error == 0) 605 error = copyout(&inkernelacl, aclp, sizeof(struct acl)); 606 return (error); 607} 608 609/* 610 * Given a vnode, delete its ACL. 611 */ 612static int 613vacl_delete(struct thread *td, struct vnode *vp, acl_type_t type) 614{ 615 struct mount *mp; 616 int error; 617 618 error = vn_start_write(vp, &mp, V_WAIT | PCATCH); 619 if (error) 620 return (error); |
621 VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE); |
622 vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); |
623 error = VOP_SETACL(vp, ACL_TYPE_DEFAULT, 0, td->td_ucred, td); |
624 VOP_UNLOCK(vp, 0, td); 625 vn_finished_write(mp); 626 return (error); 627} 628 629/* 630 * Given a vnode, check whether an ACL is appropriate for it 631 */ 632static int 633vacl_aclcheck(struct thread *td, struct vnode *vp, acl_type_t type, 634 struct acl *aclp) 635{ 636 struct acl inkernelacl; 637 int error; 638 639 error = copyin(aclp, &inkernelacl, sizeof(struct acl)); 640 if (error) 641 return(error); |
642 error = VOP_ACLCHECK(vp, type, &inkernelacl, td->td_ucred, td); |
643 return (error); 644} 645 646/* 647 * syscalls -- convert the path/fd to a vnode, and call vacl_whatever. 648 * Don't need to lock, as the vacl_ code will get/release any locks 649 * required. 650 */ --- 179 unchanged lines hidden --- |