static void atalk_add_to_list(name_compare_entry **list) { int i, count = 0; name_compare_entry *new_list = 0; name_compare_entry *cur_list = 0; cur_list = *list; if (cur_list) { for (i = 0, count = 0; cur_list[i].name; i ++, count ++) { if (strstr(cur_list[i].name, APPLEDOUBLE)) return; } } if (!(new_list = SMB_CALLOC_ARRAY(name_compare_entry, (count == 0 ? 1 : count + 1)))) return; for (i = 0; i < count; i ++) { new_list[i].name = SMB_STRDUP(cur_list[i].name); new_list[i].is_wild = cur_list[i].is_wild; } new_list[i].name = SMB_STRDUP(APPLEDOUBLE); new_list[i].is_wild = False; free_namearray(*list); *list = new_list; new_list = 0; cur_list = 0; }
/* add an ACE to a list of ACEs in a SEC_ACL */ static bool add_ace(TALLOC_CTX *mem_ctx, SEC_ACL **the_acl, SEC_ACE *ace) { SEC_ACL *new_ace; SEC_ACE *aces; if (! *the_acl) { return (((*the_acl) = make_sec_acl(mem_ctx, 3, 1, ace)) != NULL); } if (!(aces = SMB_CALLOC_ARRAY(SEC_ACE, 1+(*the_acl)->num_aces))) { return False; } memcpy(aces, (*the_acl)->aces, (*the_acl)->num_aces * sizeof(SEC_ACE)); memcpy(aces+(*the_acl)->num_aces, ace, sizeof(SEC_ACE)); new_ace = make_sec_acl(mem_ctx,(*the_acl)->revision,1+(*the_acl)->num_aces, aces); SAFE_FREE(aces); (*the_acl) = new_ace; return True; }
/* initialise (ie. allocate) the prefix cache */ static BOOL cache_init(void) { if (prefix_cache) { return True; } prefix_cache = SMB_CALLOC_ARRAY(char *,MANGLE_CACHE_SIZE); if (!prefix_cache) { return False; } prefix_cache_hashes = SMB_CALLOC_ARRAY(u32, MANGLE_CACHE_SIZE); if (!prefix_cache_hashes) { return False; } return True; }