acl_entry.c revision 75185
1223328Sgavin/* 2223328Sgavin * Copyright (c) 2001 Chris D. Faulhaber 3116424Smikeh * All rights reserved. 4116424Smikeh * 5223328Sgavin * Redistribution and use in source and binary forms, with or without 6116424Smikeh * modification, are permitted provided that the following conditions 7116424Smikeh * are met: 8116424Smikeh * 1. Redistributions of source code must retain the above copyright 9116424Smikeh * notice, this list of conditions and the following disclaimer. 10116424Smikeh * 2. Redistributions in binary form must reproduce the above copyright 11116424Smikeh * notice, this list of conditions and the following disclaimer in the 12116424Smikeh * documentation and/or other materials provided with the distribution. 13116424Smikeh * 14116424Smikeh * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15116424Smikeh * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16116424Smikeh * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17116424Smikeh * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18116424Smikeh * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19116424Smikeh * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20116424Smikeh * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21116424Smikeh * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22116424Smikeh * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23116424Smikeh * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24116424Smikeh * SUCH DAMAGE. 25116424Smikeh * 26116424Smikeh * $FreeBSD: head/lib/libc/posix1e/acl_entry.c 75185 2001-04-04 18:00:52Z tmm $ 27116424Smikeh */ 28116424Smikeh 29116424Smikeh#include <sys/types.h> 30116424Smikeh#include "namespace.h" 31116424Smikeh#include <sys/acl.h> 32116424Smikeh#include "un-namespace.h" 33116424Smikeh 34116424Smikeh#include <errno.h> 35116424Smikeh#include <stdlib.h> 36116424Smikeh 37116424Smikeh#define ACL_UNDEFINED_ID -1 38116424Smikeh#define ACL_UNDEFINED_TAG -1 39116424Smikeh 40116424Smikehint 41116424Smikehacl_create_entry(acl_t *acl_p, acl_entry_t *entry_p) 42116424Smikeh{ 43116424Smikeh acl_t acl; 44116424Smikeh struct acl_entry newentry; 45116424Smikeh 46116424Smikeh if (!acl_p || !*acl_p || ((*acl_p)->acl_cnt >= ACL_MAX_ENTRIES) || 47116424Smikeh ((*acl_p)->acl_cnt < 0)) { 48116424Smikeh errno = EINVAL; 49116424Smikeh return -1; 50116424Smikeh } 51116424Smikeh 52116424Smikeh entry_p = malloc(sizeof(acl_entry_t)); 53116424Smikeh if (!entry_p) 54116424Smikeh return -1; 55128671Smikeh *entry_p = malloc(sizeof(struct acl_entry)); 56116424Smikeh if (!*entry_p) 57116424Smikeh return -1; 58116424Smikeh 59116424Smikeh acl = *acl_p; 60116424Smikeh 61116424Smikeh **entry_p = acl->acl_entry[acl->acl_cnt]; 62116424Smikeh 63223328Sgavin (**entry_p).ae_tag = ACL_UNDEFINED_TAG; 64116424Smikeh (**entry_p).ae_id = ACL_UNDEFINED_ID; 65116424Smikeh (**entry_p).ae_perm = ACL_PERM_NONE; 66116424Smikeh 67116424Smikeh acl->acl_entry[acl->acl_cnt] = newentry; 68116424Smikeh acl->acl_cnt++; 69116424Smikeh 70116424Smikeh **entry_p = newentry; 71116424Smikeh 72116424Smikeh /* XXX - ok? */ 73116424Smikeh free(*entry_p); 74116424Smikeh free(entry_p); 75116424Smikeh 76116424Smikeh return 0; 77116424Smikeh} 78116424Smikeh 79116424Smikehint 80116424Smikehacl_get_entry(acl_t acl, int entry_id, acl_entry_t *entry_p) 81116424Smikeh{ 82116424Smikeh 83116424Smikeh errno = ENOSYS; 84116424Smikeh return -1; 85116424Smikeh} 86116424Smikeh