xref: /freebsd-src/lib/libc/posix1e/acl_delete.c (revision 559a218c9b257775fb249b67945fe4a05b7a6b9f)
1515d7c92SRobert Watson /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
3d915a14eSPedro F. Giffuni  *
46394f703SRobert Watson  * Copyright (c) 1999, 2000, 2001, 2002 Robert N. M. Watson
5515d7c92SRobert Watson  * All rights reserved.
6515d7c92SRobert Watson  *
76394f703SRobert Watson  * This software was developed by Robert Watson for the TrustedBSD Project.
86394f703SRobert Watson  *
9515d7c92SRobert Watson  * Redistribution and use in source and binary forms, with or without
10515d7c92SRobert Watson  * modification, are permitted provided that the following conditions
11515d7c92SRobert Watson  * are met:
12515d7c92SRobert Watson  * 1. Redistributions of source code must retain the above copyright
13515d7c92SRobert Watson  *    notice, this list of conditions and the following disclaimer.
14515d7c92SRobert Watson  * 2. Redistributions in binary form must reproduce the above copyright
15515d7c92SRobert Watson  *    notice, this list of conditions and the following disclaimer in the
16515d7c92SRobert Watson  *    documentation and/or other materials provided with the distribution.
17515d7c92SRobert Watson  *
18515d7c92SRobert Watson  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
19515d7c92SRobert Watson  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20515d7c92SRobert Watson  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21515d7c92SRobert Watson  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22515d7c92SRobert Watson  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23515d7c92SRobert Watson  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24515d7c92SRobert Watson  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25515d7c92SRobert Watson  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26515d7c92SRobert Watson  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27515d7c92SRobert Watson  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28515d7c92SRobert Watson  * SUCH DAMAGE.
29515d7c92SRobert Watson  */
30515d7c92SRobert Watson /*
31515d7c92SRobert Watson  * acl_delete_def_file -- remove a default acl from a file
32515d7c92SRobert Watson  */
33515d7c92SRobert Watson 
34515d7c92SRobert Watson #include <sys/types.h>
357bd44e92SThomas Moestl #include "namespace.h"
36515d7c92SRobert Watson #include <sys/acl.h>
377bd44e92SThomas Moestl #include "un-namespace.h"
38515d7c92SRobert Watson #include <sys/errno.h>
39515d7c92SRobert Watson 
40ae1add4eSEdward Tomasz Napierala #include "acl_support.h"
41ae1add4eSEdward Tomasz Napierala 
42515d7c92SRobert Watson int
acl_delete_def_file(const char * path_p)433b563f6bSRobert Watson acl_delete_def_file(const char *path_p)
44515d7c92SRobert Watson {
45515d7c92SRobert Watson 
46d3352316SRobert Watson 	return (__acl_delete_file(path_p, ACL_TYPE_DEFAULT));
47515d7c92SRobert Watson }
48515d7c92SRobert Watson 
496394f703SRobert Watson int
acl_delete_def_link_np(const char * path_p)506394f703SRobert Watson acl_delete_def_link_np(const char *path_p)
516394f703SRobert Watson {
526394f703SRobert Watson 
536394f703SRobert Watson 	return (__acl_delete_link(path_p, ACL_TYPE_DEFAULT));
546394f703SRobert Watson }
55515d7c92SRobert Watson 
56515d7c92SRobert Watson int
acl_delete_file_np(const char * path_p,acl_type_t type)578f45e8c0SRobert Watson acl_delete_file_np(const char *path_p, acl_type_t type)
58515d7c92SRobert Watson {
59515d7c92SRobert Watson 
60ae1add4eSEdward Tomasz Napierala 	type = _acl_type_unold(type);
61d3352316SRobert Watson 	return (__acl_delete_file(path_p, type));
62515d7c92SRobert Watson }
63515d7c92SRobert Watson 
646394f703SRobert Watson int
acl_delete_link_np(const char * path_p,acl_type_t type)656394f703SRobert Watson acl_delete_link_np(const char *path_p, acl_type_t type)
666394f703SRobert Watson {
676394f703SRobert Watson 
68ae1add4eSEdward Tomasz Napierala 	type = _acl_type_unold(type);
696394f703SRobert Watson 	return (__acl_delete_link(path_p, type));
706394f703SRobert Watson }
716394f703SRobert Watson 
72515d7c92SRobert Watson int
acl_delete_fd_np(int filedes,acl_type_t type)738f45e8c0SRobert Watson acl_delete_fd_np(int filedes, acl_type_t type)
74515d7c92SRobert Watson {
75515d7c92SRobert Watson 
76ae1add4eSEdward Tomasz Napierala 	type = _acl_type_unold(type);
777bd44e92SThomas Moestl 	return (___acl_delete_fd(filedes, type));
78515d7c92SRobert Watson }
79