} smb_acl_entry;
[public] typedef struct {
- [value(0)] int size;
int count;
[value(0)] int next;
[size_is(count)] smb_acl_entry acl[*];
int sys_acl_add_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
int sys_acl_get_perm(SMB_ACL_PERMSET_T permset_d, SMB_ACL_PERM_T perm);
char *sys_acl_to_text(const struct smb_acl_t *acl_d, ssize_t *len_p);
-SMB_ACL_T sys_acl_init(int count);
+SMB_ACL_T sys_acl_init(void);
int sys_acl_create_entry(SMB_ACL_T *acl_p, SMB_ACL_ENTRY_T *entry_p);
int sys_acl_set_tag_type(SMB_ACL_ENTRY_T entry_d, SMB_ACL_TAG_T tag_type);
int sys_acl_set_qualifier(SMB_ACL_ENTRY_T entry_d, void *qual_p);
return text;
}
-SMB_ACL_T sys_acl_init(int count)
+SMB_ACL_T sys_acl_init(void)
{
SMB_ACL_T a;
- if (count < 0) {
- errno = EINVAL;
- return NULL;
- }
-
if ((a = talloc(NULL, struct smb_acl_t)) == NULL) {
errno = ENOMEM;
return NULL;
}
- a->size = count + 1;
a->count = 0;
a->next = -1;
- a->acl = talloc_array(a, struct smb_acl_entry, count+1);
+ a->acl = talloc_array(a, struct smb_acl_entry, 0);
if (!a->acl) {
TALLOC_FREE(a);
errno = ENOMEM;
{
SMB_ACL_T acl_d;
SMB_ACL_ENTRY_T entry_d;
+ struct smb_acl_entry *acl;
if (acl_p == NULL || entry_p == NULL || (acl_d = *acl_p) == NULL) {
errno = EINVAL;
return -1;
}
- if (acl_d->count >= acl_d->size) {
- errno = ENOSPC;
+ acl = talloc_realloc(acl_d, acl_d->acl, struct smb_acl_entry, acl_d->count+1);
+ if (!acl) {
+ errno = ENOMEM;
return -1;
}
-
- entry_d = &acl_d->acl[acl_d->count++];
+ acl_d->acl = acl;
+ entry_d = &acl_d->acl[acl_d->count];
entry_d->a_type = SMB_ACL_TAG_INVALID;
entry_d->a_perm = 0;
*entry_p = entry_d;
+ acl_d->count++;
return 0;
}
static struct smb_acl_t *smb_acl_to_internal(acl_t acl)
{
- struct smb_acl_t *result = sys_acl_init(0);
+ struct smb_acl_t *result = sys_acl_init();
int entry_id = ACL_FIRST_ENTRY;
acl_entry_t e;
if (result == NULL) {
{
connection_struct *conn = fsp->conn;
bool ret = False;
- SMB_ACL_T the_acl = sys_acl_init(count_canon_ace_list(the_ace) + 1);
+ SMB_ACL_T the_acl = sys_acl_init();
canon_ace *p_ace;
int i;
SMB_ACL_ENTRY_T mask_entry;
static SMB_ACL_T create_posix_acl_from_wire(connection_struct *conn, uint16 num_acls, const char *pdata)
{
unsigned int i;
- SMB_ACL_T the_acl = sys_acl_init(num_acls);
+ SMB_ACL_T the_acl = sys_acl_init();
if (the_acl == NULL) {
return NULL;
SMB_ACL_ENTRY_T entry;
bool ret = False;
/* Create a new ACL with only 3 entries, u/g/w. */
- SMB_ACL_T new_file_acl = sys_acl_init(3);
+ SMB_ACL_T new_file_acl = sys_acl_init();
SMB_ACL_ENTRY_T user_ent = NULL;
SMB_ACL_ENTRY_T group_ent = NULL;
SMB_ACL_ENTRY_T other_ent = NULL;
mode_t mode_other = chmod_mode & 07;
SMB_ACL_ENTRY_T entry;
- SMB_ACL_T acl = sys_acl_init(4);
+ SMB_ACL_T acl = sys_acl_init();
if (!acl) {
return NULL;