FreeBSD/sys/ufs/ufs/ufs_acl.c
/*
 * Read POSIX.1e ACL from an EA.  Return error if its not found
 * or if any other error has occurred.
 */
Read POSIX.1e ACL from an EA.  Return error if its not found
or if any other error has occurred.
Read POSIX . 1e ACL from an EA . Return error if its not found or if any other error has occurred .
static int
ufs_get_oldacl(acl_type_t type, struct oldacl *old, struct vnode *vp,
    struct thread *td)
{
	int error, len;
	struct inode *ip = VTOI(vp);
	len = sizeof(*old);
	switch (type) {
	case ACL_TYPE_ACCESS:
		error = vn_extattr_get(vp, IO_NODELOCKED,
		    POSIX1E_ACL_ACCESS_EXTATTR_NAMESPACE,
		    POSIX1E_ACL_ACCESS_EXTATTR_NAME, &len, (char *) old,
		    td);
		break;
	case ACL_TYPE_DEFAULT:
		if (vp->v_type != VDIR)
			return (EINVAL);
		error = vn_extattr_get(vp, IO_NODELOCKED,
		    POSIX1E_ACL_DEFAULT_EXTATTR_NAMESPACE,
		    POSIX1E_ACL_DEFAULT_EXTATTR_NAME, &len, (char *) old,
		    td);
		break;
	default:
		return (EINVAL);
	}
	if (error != 0)
		return (error);
	if (len != sizeof(*old)) {
		printf("ufs_get_oldacl(): Loaded invalid ACL "
		    "(len = %d), inumber %ju on %s\n", len,
		    (uintmax_t)ip->i_number, ip->i_fs->fs_fsmnt);
		return (EPERM);
	}
	return (0);
}
static int ufs_get_oldacl ( acl_type_t type , struct oldacl * old , struct vnode * vp , struct thread * td ) { int error , len ; struct inode * ip = VTOI ( vp ) ; len = sizeof ( * old ) ; switch ( type ) { case ACL_TYPE_ACCESS : error = vn_extattr_get ( vp , IO_NODELOCKED , POSIX1E_ACL_ACCESS_EXTATTR_NAMESPACE , POSIX1E_ACL_ACCESS_EXTATTR_NAME , & len , ( char * ) old , td ) ; break ; case ACL_TYPE_DEFAULT : if ( vp -> v_type != VDIR ) return ( EINVAL ) ; error = vn_extattr_get ( vp , IO_NODELOCKED , POSIX1E_ACL_DEFAULT_EXTATTR_NAMESPACE , POSIX1E_ACL_DEFAULT_EXTATTR_NAME , & len , ( char * ) old , td ) ; break ; default : return ( EINVAL ) ; } if ( error != 0 ) return ( error ) ; if ( len != sizeof ( * old ) ) { printf ( " " " \n " , len , ( uintmax_t ) ip -> i_number , ip -> i_fs -> fs_fsmnt ) ; return ( EPERM ) ; } return ( 0 ) ; }
Read POSIX.1e ACL from an EA.
Read POSIX . 1e ACL from an EA .
/*
		 * A short (or long) read, meaning that for some reason
		 * the ACL is corrupted.  Return EPERM since the object
		 * DAC protections are unsafe.
		 */