*store_size = PAI_V2_ENTRIES_BASE +
((num_entries + num_def_entries)*PAI_V2_ENTRY_LENGTH);
- pai_buf = (char *)SMB_MALLOC(*store_size);
+ pai_buf = talloc_array(talloc_tos(), char, *store_size);
if (!pai_buf) {
return NULL;
}
pai_buf, store_size, 0);
}
- SAFE_FREE(pai_buf);
+ TALLOC_FREE(pai_buf);
DEBUG(10,("store_inheritance_attribute: type 0x%x for file %s\n",
(unsigned int)sd_type,
struct pai_entry *paie, *paie_next;
for (paie = pal->entry_list; paie; paie = paie_next) {
paie_next = paie->next;
- SAFE_FREE(paie);
+ TALLOC_FREE(paie);
}
for (paie = pal->def_entry_list; paie; paie = paie_next) {
paie_next = paie->next;
- SAFE_FREE(paie);
+ TALLOC_FREE(paie);
}
- SAFE_FREE(pal);
+ TALLOC_FREE(pal);
}
}
int i;
for (i = 0; i < paiv->num_entries; i++) {
- struct pai_entry *paie = SMB_MALLOC_P(struct pai_entry);
+ struct pai_entry *paie = talloc(talloc_tos(), struct pai_entry);
if (!paie) {
return NULL;
}
paie->ace_flags = SEC_ACE_FLAG_INHERITED_ACE;
if (!get_pai_owner_type(paie, entry_offset)) {
- SAFE_FREE(paie);
+ TALLOC_FREE(paie);
return NULL;
}
return NULL;
}
- paiv = SMB_MALLOC_P(struct pai_val);
+ paiv = talloc(talloc_tos(), struct pai_val);
if (!paiv) {
return NULL;
}
unsigned int i;
for (i = 0; i < num_entries; i++) {
- struct pai_entry *paie = SMB_MALLOC_P(struct pai_entry);
+ struct pai_entry *paie = talloc(talloc_tos(), struct pai_entry);
if (!paie) {
return NULL;
}
paie->ace_flags = CVAL(entry_offset,0);
if (!get_pai_owner_type(paie, entry_offset+1)) {
- SAFE_FREE(paie);
+ TALLOC_FREE(paie);
return NULL;
}
if (!def_entry) {
return NULL;
}
- paiv = SMB_MALLOC_P(struct pai_val);
+ paiv = talloc(talloc_tos(), struct pai_val);
if (!paiv) {
return NULL;
}
return NULL;
}
- if ((pai_buf = (char *)SMB_MALLOC(pai_buf_size)) == NULL) {
+ if ((pai_buf = talloc_array(talloc_tos(), char, pai_buf_size)) == NULL) {
return NULL;
}
}
/* Buffer too small - enlarge it. */
pai_buf_size *= 2;
- SAFE_FREE(pai_buf);
+ TALLOC_FREE(pai_buf);
if (pai_buf_size > 1024*1024) {
return NULL; /* Limit malloc to 1mb. */
}
- if ((pai_buf = (char *)SMB_MALLOC(pai_buf_size)) == NULL)
+ if ((pai_buf = talloc_array(talloc_tos(), char, pai_buf_size)) == NULL)
return NULL;
}
} while (ret == -1);
if (errno != ENOSYS)
DEBUG(10,("load_inherited_info: Error %s\n", strerror(errno) ));
#endif
- SAFE_FREE(pai_buf);
+ TALLOC_FREE(pai_buf);
return NULL;
}
(unsigned int)paiv->sd_type, fsp_str_dbg(fsp)));
}
- SAFE_FREE(pai_buf);
+ TALLOC_FREE(pai_buf);
return paiv;
}
return NULL;
}
- if ((pai_buf = (char *)SMB_MALLOC(pai_buf_size)) == NULL) {
+ if ((pai_buf = talloc_array(talloc_tos(), char, pai_buf_size)) == NULL) {
return NULL;
}
}
/* Buffer too small - enlarge it. */
pai_buf_size *= 2;
- SAFE_FREE(pai_buf);
+ TALLOC_FREE(pai_buf);
if (pai_buf_size > 1024*1024) {
return NULL; /* Limit malloc to 1mb. */
}
- if ((pai_buf = (char *)SMB_MALLOC(pai_buf_size)) == NULL)
+ if ((pai_buf = talloc_array(talloc_tos(), char, pai_buf_size)) == NULL)
return NULL;
}
} while (ret == -1);
if (errno != ENOSYS)
DEBUG(10,("load_inherited_info: Error %s\n", strerror(errno) ));
#endif
- SAFE_FREE(pai_buf);
+ TALLOC_FREE(pai_buf);
return NULL;
}
fname));
}
- SAFE_FREE(pai_buf);
+ TALLOC_FREE(pai_buf);
return paiv;
}
for (list = l_head; list; list = next) {
next = list->next;
DLIST_REMOVE(l_head, list);
- SAFE_FREE(list);
+ TALLOC_FREE(list);
}
}
static canon_ace *dup_canon_ace( canon_ace *src_ace)
{
- canon_ace *dst_ace = SMB_MALLOC_P(canon_ace);
+ canon_ace *dst_ace = talloc(talloc_tos(), canon_ace);
if (dst_ace == NULL)
return NULL;
curr_ace_outer->perms |= curr_ace->perms;
curr_ace_outer->ace_flags |= curr_ace->ace_flags;
DLIST_REMOVE(l_head, curr_ace);
- SAFE_FREE(curr_ace);
+ TALLOC_FREE(curr_ace);
curr_ace_outer_next = curr_ace_outer->next; /* We may have deleted the link. */
}
}
*/
DLIST_REMOVE(l_head, curr_ace);
- SAFE_FREE(curr_ace);
+ TALLOC_FREE(curr_ace);
curr_ace_outer_next = curr_ace_outer->next; /* We may have deleted the link. */
} else {
*/
DLIST_REMOVE(l_head, curr_ace_outer);
- SAFE_FREE(curr_ace_outer);
+ TALLOC_FREE(curr_ace_outer);
break;
}
}
}
if (!got_user) {
- if ((pace = SMB_MALLOC_P(canon_ace)) == NULL) {
+ if ((pace = talloc(talloc_tos(), canon_ace)) == NULL) {
DEBUG(0,("ensure_canon_entry_valid: malloc fail.\n"));
return False;
}
}
if (!got_grp) {
- if ((pace = SMB_MALLOC_P(canon_ace)) == NULL) {
+ if ((pace = talloc(talloc_tos(), canon_ace)) == NULL) {
DEBUG(0,("ensure_canon_entry_valid: malloc fail.\n"));
return False;
}
}
if (!got_other) {
- if ((pace = SMB_MALLOC_P(canon_ace)) == NULL) {
+ if ((pace = talloc(talloc_tos(), canon_ace)) == NULL) {
DEBUG(0,("ensure_canon_entry_valid: malloc fail.\n"));
return False;
}
* Create a canon_ace entry representing this NT DACL ACE.
*/
- if ((current_ace = SMB_MALLOC_P(canon_ace)) == NULL) {
+ if ((current_ace = talloc(talloc_tos(), canon_ace)) == NULL) {
free_canon_ace_list(file_ace);
free_canon_ace_list(dir_ace);
DEBUG(0,("create_canon_ace_lists: malloc fail.\n"));
DEBUG(10, ("create_canon_ace_lists: ignoring "
"non-mappable SID %s\n",
sid_string_dbg(&psa->trustee)));
- SAFE_FREE(current_ace);
+ TALLOC_FREE(current_ace);
continue;
}
DEBUG(10, ("create_canon_ace_lists: ignoring "
"unknown or foreign SID %s\n",
sid_string_dbg(&psa->trustee)));
- SAFE_FREE(current_ace);
+ TALLOC_FREE(current_ace);
continue;
}
DEBUG(0, ("create_canon_ace_lists: unable to map SID "
"%s to uid or gid.\n",
sid_string_dbg(¤t_ace->trustee)));
- SAFE_FREE(current_ace);
+ TALLOC_FREE(current_ace);
return False;
}
* Free if ACE was not added.
*/
- SAFE_FREE(current_ace);
+ TALLOC_FREE(current_ace);
}
if (fsp->is_directory && all_aces_are_inherit_only) {
* Add this entry to the list.
*/
- if ((ace = SMB_MALLOC_P(canon_ace)) == NULL)
+ if ((ace = talloc(talloc_tos(), canon_ace)) == NULL)
goto fail;
ZERO_STRUCTP(ace);
ace = canon_ace_entry_for(dir_ace, SMB_ACL_OTHER, NULL);
if (ace && !ace->perms) {
DLIST_REMOVE(dir_ace, ace);
- SAFE_FREE(ace);
+ TALLOC_FREE(ace);
ace = canon_ace_entry_for(file_ace, SMB_ACL_OTHER, NULL);
if (ace && !ace->perms) {
DLIST_REMOVE(file_ace, ace);
- SAFE_FREE(ace);
+ TALLOC_FREE(ace);
}
}
ace = canon_ace_entry_for(dir_ace, SMB_ACL_GROUP_OBJ, NULL);
if (ace && !ace->perms) {
DLIST_REMOVE(dir_ace, ace);
- SAFE_FREE(ace);
+ TALLOC_FREE(ace);
}
#endif
ace = canon_ace_entry_for(file_ace, SMB_ACL_GROUP_OBJ, NULL);
if (ace && !ace->perms) {
DLIST_REMOVE(file_ace, ace);
- SAFE_FREE(ace);
+ TALLOC_FREE(ace);
}
}
num_def_acls = count_canon_ace_list(dir_ace);
/* Allocate the ace list. */
- if ((nt_ace_list = SMB_MALLOC_ARRAY(struct security_ace,num_acls + num_profile_acls + num_def_acls)) == NULL) {
+ if ((nt_ace_list = talloc_array(talloc_tos(), struct security_ace,num_acls + num_profile_acls + num_def_acls)) == NULL) {
DEBUG(0,("get_nt_acl: Unable to malloc space for nt_ace_list.\n"));
goto done;
}
free_canon_ace_list(file_ace);
free_canon_ace_list(dir_ace);
free_inherited_info(pal);
- SAFE_FREE(nt_ace_list);
+ TALLOC_FREE(nt_ace_list);
return NT_STATUS_OK;
}