2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A#ifndef _ACLUTILS_H
2N/A#define _ACLUTILS_H
2N/A
2N/A#include <sys/types.h>
2N/A#include <sys/acl.h>
2N/A#include <strings.h>
2N/A#include <locale.h>
2N/A#include <ctype.h>
2N/A#include <grp.h>
2N/A#include <pwd.h>
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A#define ACL_REMOVE_ALL 0x0
2N/A#define ACL_REMOVE_FIRST 0x1
2N/A
2N/A/*
2N/A * Hint for whether acl_totext() should use
2N/A * mnemonics:
2N/A * read_data/list_directory
2N/A * write_data/add_file or
2N/A * append_data/add_subdirectory
2N/A * when object of ACL is known.
2N/A */
2N/A
2N/A#define PERM_TYPE_ACE 0x1 /* permissions are of ACE type */
2N/A#define PERM_TYPE_UNKNOWN 0x2 /* permission type not yet known */
2N/A#define PERM_TYPE_EMPTY 0x4 /* no permissions are specified */
2N/A
2N/Astruct acl_perm_type {
2N/A int perm_style; /* type of perm style, see above */
2N/A char *perm_str; /* string value being returned */
2N/A uint32_t perm_val; /* numeric value being returned */
2N/A};
2N/A
2N/A/*
2N/A * Textual representation of ace_t's access mask
2N/A */
2N/A#define READ_DATA_TXT "read_data/"
2N/A#define WRITE_DATA_TXT "write_data/"
2N/A#define EXECUTE_TXT "execute/"
2N/A#define READ_XATTR_TXT "read_xattr/"
2N/A#define WRITE_XATTR_TXT "write_xattr/"
2N/A#define READ_ATTRIBUTES_TXT "read_attributes/"
2N/A#define WRITE_ATTRIBUTES_TXT "write_attributes/"
2N/A#define DELETE_TXT "delete/"
2N/A#define DELETE_CHILD_TXT "delete_child/"
2N/A#define WRITE_OWNER_TXT "write_owner/"
2N/A#define READ_ACL_TXT "read_acl/"
2N/A#define WRITE_ACL_TXT "write_acl/"
2N/A#define APPEND_DATA_TXT "append_data/"
2N/A#define READ_DIR_TXT "list_directory/read_data/"
2N/A#define ADD_DIR_TXT "add_subdirectory/append_data/"
2N/A#define ADD_FILE_TXT "add_file/write_data/"
2N/A#define SYNCHRONIZE_TXT "synchronize/"
2N/A
2N/A/*
2N/A * ace_t's entry types
2N/A */
2N/A#define OWNERAT_TXT "owner@:"
2N/A#define GROUPAT_TXT "group@:"
2N/A#define EVERYONEAT_TXT "everyone@:"
2N/A#define GROUP_TXT "group:"
2N/A#define USER_TXT "user:"
2N/A#define USERSID_TXT "usersid:"
2N/A#define GROUPSID_TXT "groupsid:"
2N/A
2N/A/*
2N/A * ace_t's access types
2N/A */
2N/A#define ALLOW_TXT "allow"
2N/A#define DENY_TXT "deny"
2N/A#define ALARM_TXT "alarm"
2N/A#define AUDIT_TXT "audit"
2N/A#define UNKNOWN_TXT "unknown"
2N/A
2N/A/*
2N/A * ace_t's inheritance types
2N/A */
2N/A
2N/A#define FILE_INHERIT_TXT "file_inherit/"
2N/A#define DIR_INHERIT_TXT "dir_inherit/"
2N/A#define NO_PROPAGATE_TXT "no_propagate/"
2N/A#define INHERIT_ONLY_TXT "inherit_only/"
2N/A#define INHERITED_ACE_TXT "inherited/"
2N/A#define SUCCESSFUL_ACCESS_TXT "successful_access/"
2N/A#define FAILED_ACCESS_TXT "failed_access/"
2N/A
2N/Aextern char *yybuf;
2N/Aextern acl_t *yyacl;
2N/A
2N/Aextern int yyerror(const char *);
2N/Aextern int get_id(int entry_type, char *name, uid_t *id);
2N/Aextern int get_id_nofail(int entry_type, char *name);
2N/Aextern int ace_entry_type(int entry_type);
2N/Aextern int aclent_entry_type(int type, int owning, int *ret);
2N/Aextern int ace_perm_mask(struct acl_perm_type *, uint32_t *mask);
2N/Aextern int compute_aclent_perms(char *str, o_mode_t *mask);
2N/Aextern int compute_ace_inherit(char *str, uint32_t *imask);
2N/Aextern int acl_addentries(acl_t *, acl_t *, int);
2N/Aextern int acl_removeentries(acl_t *, acl_t *, int, int);
2N/Aextern int acl_modifyentries(acl_t *, acl_t *, int);
2N/Aextern void acl_printacl(acl_t *, int, int);
2N/Aextern char *acl_strerror(int);
2N/Aextern acl_t *acl_dup(acl_t *);
2N/Aextern int acl_type(acl_t *);
2N/Aextern int acl_cnt(acl_t *);
2N/Aextern int acl_flags(acl_t *);
2N/Aextern void *acl_data(acl_t *);
2N/Aextern void acl_error(const char *, ...);
2N/Aextern int acl_parse(const char *, acl_t **);
2N/Aextern int yyparse(void);
2N/Aextern void yyreset(void);
2N/Aextern void yycleanup(void);
2N/Aextern acl_t *acl_to_aclp(enum acl_type, void *, int);
2N/Aextern int sid_to_id(char *, boolean_t, uid_t *);
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _ACLUTILS_H */