174667Sjedgar/*
290781Sjedgar * Copyright (c) 2001-2002 Chris D. Faulhaber
374667Sjedgar * All rights reserved.
474667Sjedgar *
574667Sjedgar * Redistribution and use in source and binary forms, with or without
674667Sjedgar * modification, are permitted provided that the following conditions
774667Sjedgar * are met:
874667Sjedgar * 1. Redistributions of source code must retain the above copyright
974667Sjedgar *    notice, this list of conditions and the following disclaimer.
1074667Sjedgar * 2. Redistributions in binary form must reproduce the above copyright
1174667Sjedgar *    notice, this list of conditions and the following disclaimer in the
1274667Sjedgar *    documentation and/or other materials provided with the distribution.
1374667Sjedgar *
1474667Sjedgar * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1574667Sjedgar * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1674667Sjedgar * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17184607Simp * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
18184607Simp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19184607Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20184607Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21184607Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22184607Simp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23184607Simp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24184607Simp * SUCH DAMAGE.
2574667Sjedgar */
2674667Sjedgar
2792986Sobrien#include <sys/cdefs.h>
2892986Sobrien__FBSDID("$FreeBSD$");
2992986Sobrien
3074667Sjedgar#include <sys/types.h>
3175185Stmm#include "namespace.h"
3274667Sjedgar#include <sys/acl.h>
3375185Stmm#include "un-namespace.h"
3474667Sjedgar
3574667Sjedgar#include <errno.h>
3674667Sjedgar#include <string.h>
3774667Sjedgar
38194955Strasz#include "acl_support.h"
39194955Strasz
4074667Sjedgar/*
4175928Sjedgar * acl_copy_entry() (23.4.4): copy the contents of ACL entry src_d to
4274667Sjedgar * ACL entry dest_d
4374667Sjedgar */
4474667Sjedgarint
4574667Sjedgaracl_copy_entry(acl_entry_t dest_d, acl_entry_t src_d)
4674667Sjedgar{
4774667Sjedgar
4890781Sjedgar	if (src_d == NULL || dest_d == NULL || src_d == dest_d) {
4974667Sjedgar		errno = EINVAL;
5090781Sjedgar		return (-1);
5174667Sjedgar	}
5274667Sjedgar
53194955Strasz	/*
54194955Strasz	 * Can we brand the new entry the same as the source entry?
55194955Strasz	 */
56194955Strasz	if (!_entry_brand_may_be(dest_d, _entry_brand(src_d))) {
57194955Strasz		errno = EINVAL;
58194955Strasz		return (-1);
59194955Strasz	}
60194955Strasz
61194955Strasz	_entry_brand_as(dest_d, _entry_brand(src_d));
62194955Strasz
63194955Strasz	dest_d->ae_tag = src_d->ae_tag;
64194955Strasz	dest_d->ae_id = src_d->ae_id;
6574667Sjedgar	dest_d->ae_perm = src_d->ae_perm;
66194955Strasz	dest_d->ae_entry_type = src_d->ae_entry_type;
67194955Strasz	dest_d->ae_flags = src_d->ae_flags;
6874667Sjedgar
6990781Sjedgar	return (0);
7074667Sjedgar}
7174667Sjedgar
7274667Sjedgarssize_t
7374667Sjedgaracl_copy_ext(void *buf_p, acl_t acl, ssize_t size)
7474667Sjedgar{
7574667Sjedgar
7674667Sjedgar	errno = ENOSYS;
7790781Sjedgar	return (-1);
7874667Sjedgar}
7974667Sjedgar
8074667Sjedgaracl_t
8174667Sjedgaracl_copy_int(const void *buf_p)
8274667Sjedgar{
8374667Sjedgar
8474667Sjedgar	errno = ENOSYS;
8590781Sjedgar	return (NULL);
8674667Sjedgar}
87