1*937f807aSGleb Popov /*- 2*937f807aSGleb Popov * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3*937f807aSGleb Popov * 4*937f807aSGleb Popov * Copyright (c) 2021 Gleb Popov 5*937f807aSGleb Popov * All rights reserved. 6*937f807aSGleb Popov * 7*937f807aSGleb Popov * Redistribution and use in source and binary forms, with or without 8*937f807aSGleb Popov * modification, are permitted provided that the following conditions 9*937f807aSGleb Popov * are met: 10*937f807aSGleb Popov * 1. Redistributions of source code must retain the above copyright 11*937f807aSGleb Popov * notice, this list of conditions and the following disclaimer. 12*937f807aSGleb Popov * 2. Redistributions in binary form must reproduce the above copyright 13*937f807aSGleb Popov * notice, this list of conditions and the following disclaimer in the 14*937f807aSGleb Popov * documentation and/or other materials provided with the distribution. 15*937f807aSGleb Popov * 16*937f807aSGleb Popov * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17*937f807aSGleb Popov * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18*937f807aSGleb Popov * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19*937f807aSGleb Popov * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20*937f807aSGleb Popov * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21*937f807aSGleb Popov * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22*937f807aSGleb Popov * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23*937f807aSGleb Popov * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24*937f807aSGleb Popov * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25*937f807aSGleb Popov * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26*937f807aSGleb Popov * SUCH DAMAGE. 27*937f807aSGleb Popov */ 28*937f807aSGleb Popov /* 29*937f807aSGleb Popov * acl_cmp_np: Compare two ACL's. 30*937f807aSGleb Popov */ 31*937f807aSGleb Popov 32*937f807aSGleb Popov #include <sys/cdefs.h> 33*937f807aSGleb Popov __FBSDID("$FreeBSD$"); 34*937f807aSGleb Popov 35*937f807aSGleb Popov #include <sys/acl.h> 36*937f807aSGleb Popov #include <sys/errno.h> 37*937f807aSGleb Popov 38*937f807aSGleb Popov #include "acl_support.h" 39*937f807aSGleb Popov 40*937f807aSGleb Popov /* 41*937f807aSGleb Popov * returns 0 if acl_t's are identical, 1 otherwise 42*937f807aSGleb Popov */ 43*937f807aSGleb Popov int 44*937f807aSGleb Popov acl_cmp_np(acl_t acl1, acl_t acl2) 45*937f807aSGleb Popov { 46*937f807aSGleb Popov if (acl1 == NULL || acl2 == NULL) { 47*937f807aSGleb Popov errno = EINVAL; 48*937f807aSGleb Popov return (-1); 49*937f807aSGleb Popov } 50*937f807aSGleb Popov 51*937f807aSGleb Popov if (_acl_brand(acl1) != _acl_brand(acl2)) 52*937f807aSGleb Popov return (1); 53*937f807aSGleb Popov 54*937f807aSGleb Popov return (_acl_differs(acl1, acl2)); 55*937f807aSGleb Popov } 56