xref: /freebsd/lib/libc/posix1e/acl_copy.c (revision 7bd44e92236dee951d8c692333f2508155592550)
14bf60dfaSChris D. Faulhaber /*
24bf60dfaSChris D. Faulhaber  * Copyright (c) 2001 Chris D. Faulhaber
34bf60dfaSChris D. Faulhaber  * All rights reserved.
44bf60dfaSChris D. Faulhaber  *
54bf60dfaSChris D. Faulhaber  * Redistribution and use in source and binary forms, with or without
64bf60dfaSChris D. Faulhaber  * modification, are permitted provided that the following conditions
74bf60dfaSChris D. Faulhaber  * are met:
84bf60dfaSChris D. Faulhaber  * 1. Redistributions of source code must retain the above copyright
94bf60dfaSChris D. Faulhaber  *    notice, this list of conditions and the following disclaimer.
104bf60dfaSChris D. Faulhaber  * 2. Redistributions in binary form must reproduce the above copyright
114bf60dfaSChris D. Faulhaber  *    notice, this list of conditions and the following disclaimer in the
124bf60dfaSChris D. Faulhaber  *    documentation and/or other materials provided with the distribution.
134bf60dfaSChris D. Faulhaber  *
144bf60dfaSChris D. Faulhaber  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
154bf60dfaSChris D. Faulhaber  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
164bf60dfaSChris D. Faulhaber  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
174bf60dfaSChris D. Faulhaber  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE
184bf60dfaSChris D. Faulhaber  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
194bf60dfaSChris D. Faulhaber  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
204bf60dfaSChris D. Faulhaber  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
214bf60dfaSChris D. Faulhaber  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
224bf60dfaSChris D. Faulhaber  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
234bf60dfaSChris D. Faulhaber  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
244bf60dfaSChris D. Faulhaber  * POSSIBILITY OF SUCH DAMAGE.
254bf60dfaSChris D. Faulhaber  *
264bf60dfaSChris D. Faulhaber  * $FreeBSD$
274bf60dfaSChris D. Faulhaber  */
284bf60dfaSChris D. Faulhaber 
294bf60dfaSChris D. Faulhaber #include <sys/types.h>
307bd44e92SThomas Moestl #include "namespace.h"
314bf60dfaSChris D. Faulhaber #include <sys/acl.h>
327bd44e92SThomas Moestl #include "un-namespace.h"
334bf60dfaSChris D. Faulhaber 
344bf60dfaSChris D. Faulhaber #include <errno.h>
354bf60dfaSChris D. Faulhaber #include <string.h>
364bf60dfaSChris D. Faulhaber 
374bf60dfaSChris D. Faulhaber /*
384bf60dfaSChris D. Faulhaber  * acl_copy_entry() - copy the contents of ACL entry src_d to
394bf60dfaSChris D. Faulhaber  * ACL entry dest_d
404bf60dfaSChris D. Faulhaber  */
414bf60dfaSChris D. Faulhaber int
424bf60dfaSChris D. Faulhaber acl_copy_entry(acl_entry_t dest_d, acl_entry_t src_d)
434bf60dfaSChris D. Faulhaber {
444bf60dfaSChris D. Faulhaber 
454bf60dfaSChris D. Faulhaber 	if (!src_d || !dest_d || (src_d == dest_d)) {
464bf60dfaSChris D. Faulhaber 		errno = EINVAL;
474bf60dfaSChris D. Faulhaber 		return -1;
484bf60dfaSChris D. Faulhaber 	}
494bf60dfaSChris D. Faulhaber 
504bf60dfaSChris D. Faulhaber 	dest_d->ae_tag  = src_d->ae_tag;
514bf60dfaSChris D. Faulhaber 	dest_d->ae_id   = src_d->ae_id;
524bf60dfaSChris D. Faulhaber 	dest_d->ae_perm = src_d->ae_perm;
534bf60dfaSChris D. Faulhaber 
544bf60dfaSChris D. Faulhaber 	return 0;
554bf60dfaSChris D. Faulhaber }
564bf60dfaSChris D. Faulhaber 
574bf60dfaSChris D. Faulhaber ssize_t
584bf60dfaSChris D. Faulhaber acl_copy_ext(void *buf_p, acl_t acl, ssize_t size)
594bf60dfaSChris D. Faulhaber {
604bf60dfaSChris D. Faulhaber 
614bf60dfaSChris D. Faulhaber 	errno = ENOSYS;
624bf60dfaSChris D. Faulhaber 	return -1;
634bf60dfaSChris D. Faulhaber }
644bf60dfaSChris D. Faulhaber 
654bf60dfaSChris D. Faulhaber acl_t
664bf60dfaSChris D. Faulhaber acl_copy_int(const void *buf_p)
674bf60dfaSChris D. Faulhaber {
684bf60dfaSChris D. Faulhaber 
694bf60dfaSChris D. Faulhaber 	errno = ENOSYS;
704bf60dfaSChris D. Faulhaber 	return NULL;
714bf60dfaSChris D. Faulhaber }
72