while (list_head) {
canon_ace *old_head = list_head;
DLIST_REMOVE(list_head, list_head);
- free(old_head);
+ SAFE_FREE(old_head);
}
}
curr_ace_outer->perms |= curr_ace->perms;
DLIST_REMOVE(list_head, curr_ace);
- free(curr_ace);
+ SAFE_FREE(curr_ace);
curr_ace_outer_next = curr_ace_outer->next; /* We may have deleted the link. */
}
}
*/
DLIST_REMOVE(list_head, curr_ace);
- free(curr_ace);
+ SAFE_FREE(curr_ace);
curr_ace_outer_next = curr_ace_outer->next; /* We may have deleted the link. */
} else {
*/
DLIST_REMOVE(list_head, curr_ace_outer);
- free(curr_ace_outer);
+ SAFE_FREE(curr_ace_outer);
}
}
if(security_info_sent == 0) {
DEBUG(0,("unpack_nt_owners: no security info sent !\n"));
- return False;
+ return True;
}
/*
if (security_info_sent & OWNER_SECURITY_INFORMATION) {
sid_copy(&owner_sid, psd->owner_sid);
- if (!sid_to_uid( &owner_sid, puser, &sid_type))
+ if (!sid_to_uid( &owner_sid, puser, &sid_type)) {
DEBUG(3,("unpack_nt_owners: unable to validate owner sid.\n"));
+ return False;
+ }
}
/*
if (security_info_sent & GROUP_SECURITY_INFORMATION) {
sid_copy(&grp_sid, psd->grp_sid);
- if (!sid_to_gid( &grp_sid, pgrp, &sid_type))
+ if (!sid_to_gid( &grp_sid, pgrp, &sid_type)) {
DEBUG(3,("unpack_nt_owners: unable to validate group sid.\n"));
+ return False;
+ }
}
DEBUG(5,("unpack_nt_owners: owner_sids validated.\n"));
free_canon_ace_list(file_ace);
free_canon_ace_list(dir_ace);
- free(current_ace);
+ SAFE_FREE(current_ace);
DEBUG(0,("create_canon_ace_lists: unable to map SID %s to uid or gid.\n",
sid_to_string(str, ¤t_ace->sid) ));
return False;
Deny entry after Allow entry. Failing to set on file %s.\n", fsp->fsp_name ));
free_canon_ace_list(file_ace);
free_canon_ace_list(dir_ace);
- free(current_ace);
+ SAFE_FREE(current_ace);
return False;
}
Deny entry after Allow entry. Failing to set on file %s.\n", fsp->fsp_name ));
free_canon_ace_list(file_ace);
free_canon_ace_list(dir_ace);
- free(current_ace);
+ SAFE_FREE(current_ace);
return False;
}
* Free if ACE was not added.
*/
- if (current_ace)
- free(current_ace);
+ SAFE_FREE(current_ace);
}
if (fsp->is_directory && all_aces_are_inherit_only) {
sys_acl_free_acl(dir_acl);
free_canon_ace_list(file_ace);
free_canon_ace_list(dir_ace);
- if (nt_ace_list)
- free(nt_ace_list);
+ SAFE_FREE(nt_ace_list);
return sd_size;
}
}
/*
- * If this is a simple 3 element ACL then it's a standard
+ * If this is a simple 3 element ACL or no elements then it's a standard
* UNIX permission set. Just use chmod...
*/
- if (num_entries == 3)
+ if ((num_entries == 3) || (num_entries == 0))
return -1;
return 0;