13#ifndef __DAOS_SECURITY_H__
14#define __DAOS_SECURITY_H__
16#if defined(__cplusplus)
29#define DAOS_ACL_VERSION (1)
35#define DAOS_ACL_MAX_PRINCIPAL_LEN (255)
37#define DAOS_ACL_MAX_PRINCIPAL_BUF_LEN (DAOS_ACL_MAX_PRINCIPAL_LEN + 1)
40#define DAOS_ACL_PRINCIPAL_OWNER "OWNER@"
42#define DAOS_ACL_PRINCIPAL_OWNER_GRP "GROUP@"
44#define DAOS_ACL_PRINCIPAL_EVERYONE "EVERYONE@"
49#define DAOS_ACL_MAX_ACE_LEN (65536)
55#define DAOS_ACL_MAX_ACE_STR_LEN (DAOS_ACL_MAX_PRINCIPAL_LEN + 64)
93 DAOS_ACL_ACCESS_ALLOW = (1U << 0),
101#define DAOS_ACL_ACCESS_ALL (DAOS_ACL_ACCESS_ALLOW | \
102 DAOS_ACL_ACCESS_AUDIT | \
103 DAOS_ACL_ACCESS_ALARM)
122#define DAOS_ACL_FLAG_ALL (DAOS_ACL_FLAG_GROUP | \
123 DAOS_ACL_FLAG_POOL_INHERIT | \
124 DAOS_ACL_FLAG_ACCESS_FAIL | \
125 DAOS_ACL_FLAG_ACCESS_SUCCESS)
131 DAOS_ACL_PERM_READ = (1U << 0),
132 DAOS_ACL_PERM_WRITE = (1U << 1),
133 DAOS_ACL_PERM_CREATE_CONT = (1U << 2),
134 DAOS_ACL_PERM_DEL_CONT = (1U << 3),
135 DAOS_ACL_PERM_GET_PROP = (1U << 4),
136 DAOS_ACL_PERM_SET_PROP = (1U << 5),
137 DAOS_ACL_PERM_GET_ACL = (1U << 6),
138 DAOS_ACL_PERM_SET_ACL = (1U << 7),
139 DAOS_ACL_PERM_SET_OWNER = (1U << 8),
145#define DAOS_ACL_PERM_POOL_ALL (DAOS_ACL_PERM_READ | \
146 DAOS_ACL_PERM_GET_PROP | \
147 DAOS_ACL_PERM_WRITE | \
148 DAOS_ACL_PERM_CREATE_CONT | \
149 DAOS_ACL_PERM_DEL_CONT)
154#define DAOS_ACL_PERM_CONT_ALL (DAOS_ACL_PERM_READ | \
155 DAOS_ACL_PERM_WRITE | \
156 DAOS_ACL_PERM_DEL_CONT | \
157 DAOS_ACL_PERM_GET_PROP | \
158 DAOS_ACL_PERM_SET_PROP | \
159 DAOS_ACL_PERM_GET_ACL | \
160 DAOS_ACL_PERM_SET_ACL | \
161 DAOS_ACL_PERM_SET_OWNER)
166#define DAOS_ACL_PERM_ALL (DAOS_ACL_PERM_POOL_ALL | \
167 DAOS_ACL_PERM_CONT_ALL)
272 const char *principal,
struct daos_ace **ace);
313 const char *principal_name);
601#if defined(__cplusplus)
int daos_acl_from_strs(const char **ace_strs, size_t ace_nr, struct daos_acl **acl)
@ DAOS_ACL_FLAG_ACCESS_SUCCESS
@ DAOS_ACL_FLAG_POOL_INHERIT
@ DAOS_ACL_FLAG_ACCESS_FAIL
struct daos_acl * daos_acl_create(struct daos_ace *aces[], uint16_t num_aces)
int daos_acl_principal_to_gid(const char *principal, gid_t *gid)
int daos_acl_principal_to_uid(const char *principal, uid_t *uid)
int daos_ace_to_str(struct daos_ace *ace, char *buf, size_t buf_len)
ssize_t daos_acl_get_size(struct daos_acl *acl)
const char * daos_ace_get_principal_str(struct daos_ace *ace)
struct daos_ace * daos_ace_create(enum daos_acl_principal_type type, const char *principal_name)
void daos_acl_free(struct daos_acl *acl)
int daos_ace_str_get_verbose(const char *ace_str, char *buf, size_t buf_len)
int daos_acl_to_stream(FILE *stream, struct daos_acl *acl, bool verbose)
void daos_acl_dump(struct daos_acl *acl)
int daos_acl_add_ace(struct daos_acl **acl, struct daos_ace *new_ace)
int daos_acl_principal_from_str(const char *principal_str, enum daos_acl_principal_type *type, char **name)
ssize_t daos_ace_get_size(struct daos_ace *ace)
struct daos_ace * daos_acl_get_next_ace(struct daos_acl *acl, struct daos_ace *current_ace)
int daos_acl_get_ace_for_principal(struct daos_acl *acl, enum daos_acl_principal_type type, const char *principal, struct daos_ace **ace)
void daos_ace_dump(struct daos_ace *ace, uint32_t tabs)
bool daos_acl_principal_is_valid(const char *name)
bool daos_ace_is_valid(struct daos_ace *ace)
int daos_acl_validate(struct daos_acl *acl)
int daos_acl_uid_to_principal(uid_t uid, char **name)
struct daos_acl * daos_acl_dup(struct daos_acl *acl)
int daos_acl_to_strs(struct daos_acl *acl, char ***ace_strs, size_t *ace_nr)
int daos_acl_gid_to_principal(gid_t gid, char **name)
int daos_acl_remove_ace(struct daos_acl **acl, enum daos_acl_principal_type type, const char *principal_name)
int daos_ace_from_str(const char *str, struct daos_ace **ace)
void daos_ace_free(struct daos_ace *ace)
uint16_t dae_access_flags
uint16_t dae_principal_len
uint8_t dae_principal_type