1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-03 12:58:35 +03:00

Remove a number of NT_STATUS_HAVE_NO_MEMORY_AND_FREE macros from the codebase.

Following the current coding guidelines, it is considered bad practice to return from
within a macro and change control flow as they look like normal function calls.

Change-Id: I133eb5a699757ae57b87d3bd3ebbcf5b556b0268
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
Garming Sam 2014-02-13 17:51:11 +13:00 committed by Andreas Schneider
parent 1f60aa8ec2
commit 952bc3cad0
18 changed files with 600 additions and 150 deletions

View File

@ -154,7 +154,10 @@ NTSTATUS auth_convert_user_info_dc_saminfo3(TALLOC_CTX *mem_ctx,
sam3->sids = talloc_array(sam, struct netr_SidAttr,
user_info_dc->num_sids);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(sam3->sids, sam3);
if (sam3->sids == NULL) {
TALLOC_FREE(sam3);
return NT_STATUS_NO_MEMORY;
}
/* We don't put the user and group SIDs in there */
for (i=2; i<user_info_dc->num_sids; i++) {
@ -162,7 +165,10 @@ NTSTATUS auth_convert_user_info_dc_saminfo3(TALLOC_CTX *mem_ctx,
continue;
}
sam3->sids[sam3->sidcount].sid = dom_sid_dup(sam3->sids, &user_info_dc->sids[i]);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(sam3->sids[sam3->sidcount].sid, sam3);
if (sam3->sids[sam3->sidcount].sid == NULL) {
TALLOC_FREE(sam3);
return NT_STATUS_NO_MEMORY;
}
sam3->sids[sam3->sidcount].attributes =
SE_GROUP_MANDATORY | SE_GROUP_ENABLED_BY_DEFAULT | SE_GROUP_ENABLED;
sam3->sidcount += 1;
@ -429,7 +435,10 @@ NTSTATUS make_user_info_dc_pac(TALLOC_CTX *mem_ctx,
sidcount = user_info_dc->num_sids + pac_logon_info->res_groups.count;
user_info_dc->sids
= talloc_realloc(user_info_dc, user_info_dc->sids, struct dom_sid, sidcount);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(user_info_dc->sids, user_info_dc);
if (user_info_dc->sids == NULL) {
TALLOC_FREE(user_info_dc);
return NT_STATUS_NO_MEMORY;
}
for (i = 0; pac_logon_info->res_group_dom_sid && i < pac_logon_info->res_groups.count; i++) {
user_info_dc->sids[user_info_dc->num_sids] = *pac_logon_info->res_group_dom_sid;

View File

@ -198,11 +198,17 @@ static NTSTATUS get_dcs_insite(TALLOC_CTX *ctx, struct ldb_context *ldb,
* Search all the object of class server in this site
*/
dc_list = talloc_array(r, const char *, r->count);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(dc_list, r);
if (dc_list == NULL) {
TALLOC_FREE(r);
return NT_STATUS_NO_MEMORY;
}
/* TODO put some random here in the order */
list->names = talloc_realloc(list, list->names, const char *, list->count + r->count);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(list->names, r);
if (list->names == NULL) {
TALLOC_FREE(r);
return NT_STATUS_NO_MEMORY;
}
for (i = 0; i<r->count; i++) {
struct ldb_dn *dn;
@ -230,7 +236,10 @@ static NTSTATUS get_dcs_insite(TALLOC_CTX *ctx, struct ldb_context *ldb,
}
list->names[list->count] = talloc_strdup(list->names, dns);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(list->names[list->count], r);
if (list->names[list->count] == NULL) {
TALLOC_FREE(r);
return NT_STATUS_NO_MEMORY;
}
} else {
char *tmp;
const char *aname = ldb_msg_find_attr_as_string(msg, "sAMAccountName", NULL);
@ -242,7 +251,10 @@ static NTSTATUS get_dcs_insite(TALLOC_CTX *ctx, struct ldb_context *ldb,
}
tmp = talloc_strdup(list->names, aname);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(tmp, r);
if (tmp == NULL) {
TALLOC_FREE(r);
return NT_STATUS_NO_MEMORY;
}
/* Netbios name is also the sAMAccountName for
computer but without the final $ */
@ -335,10 +347,16 @@ static NTSTATUS get_dcs(TALLOC_CTX *ctx, struct ldb_context *ldb,
sitedn = r->msgs[0]->dn;
set_list = talloc_realloc(subctx, set_list, struct dc_set *, current_pos+1);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(set_list, subctx);
if (set_list == NULL) {
TALLOC_FREE(subctx);
return NT_STATUS_NO_MEMORY;
}
set_list[current_pos] = talloc(set_list, struct dc_set);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(set_list[current_pos], subctx);
if (set_list[current_pos] == NULL) {
TALLOC_FREE(subctx);
return NT_STATUS_NO_MEMORY;
}
set_list[current_pos]->names = NULL;
set_list[current_pos]->count = 0;
@ -384,10 +402,16 @@ static NTSTATUS get_dcs(TALLOC_CTX *ctx, struct ldb_context *ldb,
*/
set_list = talloc_realloc(subctx, set_list, struct dc_set *,
current_pos+2);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(set_list, subctx);
if (set_list == NULL) {
TALLOC_FREE(subctx);
return NT_STATUS_NO_MEMORY;
}
set_list[current_pos] = talloc(ctx, struct dc_set);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(set_list[current_pos], subctx);
if (set_list[current_pos] == NULL) {
TALLOC_FREE(subctx);
return NT_STATUS_NO_MEMORY;
}
set_list[current_pos]->names = NULL;
set_list[current_pos]->count = 0;

View File

@ -726,34 +726,58 @@ NTSTATUS gpo_copy(TALLOC_CTX *mem_ctx,
gpo->version = gpo_src->version;
gpo->ds_path = talloc_strdup(gpo, gpo_src->ds_path);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->ds_path, gpo);
if (gpo->ds_path == NULL) {
TALLOC_FREE(gpo);
return NT_STATUS_NO_MEMORY;
}
gpo->file_sys_path = talloc_strdup(gpo, gpo_src->file_sys_path);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->file_sys_path, gpo);
if (gpo->file_sys_path == NULL) {
TALLOC_FREE(gpo);
return NT_STATUS_NO_MEMORY;
}
gpo->display_name = talloc_strdup(gpo, gpo_src->display_name);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->display_name, gpo);
if (gpo->display_name == NULL) {
TALLOC_FREE(gpo);
return NT_STATUS_NO_MEMORY;
}
gpo->name = talloc_strdup(gpo, gpo_src->name);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->name, gpo);
if (gpo->name == NULL) {
TALLOC_FREE(gpo);
return NT_STATUS_NO_MEMORY;
}
gpo->link = talloc_strdup(gpo, gpo_src->link);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->link, gpo);
if (gpo->link == NULL) {
TALLOC_FREE(gpo);
return NT_STATUS_NO_MEMORY;
}
gpo->link_type = gpo_src->link_type;
if (gpo_src->user_extensions) {
gpo->user_extensions = talloc_strdup(gpo, gpo_src->user_extensions);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->user_extensions, gpo);
if (gpo->user_extensions == NULL) {
TALLOC_FREE(gpo);
return NT_STATUS_NO_MEMORY;
}
}
if (gpo_src->machine_extensions) {
gpo->machine_extensions = talloc_strdup(gpo, gpo_src->machine_extensions);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->machine_extensions, gpo);
if (gpo->machine_extensions == NULL) {
TALLOC_FREE(gpo);
return NT_STATUS_NO_MEMORY;
}
}
gpo->security_descriptor = dup_sec_desc(gpo, gpo_src->security_descriptor);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->security_descriptor, gpo);
if (gpo->security_descriptor == NULL) {
TALLOC_FREE(gpo);
return NT_STATUS_NO_MEMORY;
}
gpo->next = gpo->prev = NULL;

View File

@ -72,36 +72,63 @@ NTSTATUS make_user_info(struct auth_usersupplied_info **ret_user_info,
DEBUG(5,("making strings for %s's user_info struct\n", internal_username));
user_info->client.account_name = talloc_strdup(user_info, smb_name);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(user_info->client.account_name, user_info);
if (user_info->client.account_name == NULL) {
TALLOC_FREE(user_info);
return NT_STATUS_NO_MEMORY;
}
user_info->mapped.account_name = talloc_strdup(user_info, internal_username);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(user_info->mapped.account_name, user_info);
if (user_info->mapped.account_name == NULL) {
TALLOC_FREE(user_info);
return NT_STATUS_NO_MEMORY;
}
user_info->mapped.domain_name = talloc_strdup(user_info, domain);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(user_info->mapped.domain_name, user_info);
if (user_info->mapped.domain_name == NULL) {
TALLOC_FREE(user_info);
return NT_STATUS_NO_MEMORY;
}
user_info->client.domain_name = talloc_strdup(user_info, client_domain);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(user_info->client.domain_name, user_info);
if (user_info->client.domain_name == NULL) {
TALLOC_FREE(user_info);
return NT_STATUS_NO_MEMORY;
}
user_info->workstation_name = talloc_strdup(user_info, workstation_name);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(user_info->workstation_name, user_info);
if (user_info->workstation_name == NULL) {
TALLOC_FREE(user_info);
return NT_STATUS_NO_MEMORY;
}
user_info->remote_host = tsocket_address_copy(remote_address, user_info);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(user_info->remote_host, user_info);
if (user_info->remote_host == NULL) {
TALLOC_FREE(user_info);
return NT_STATUS_NO_MEMORY;
}
DEBUG(5,("making blobs for %s's user_info struct\n", internal_username));
if (lm_pwd && lm_pwd->data) {
user_info->password.response.lanman = data_blob_talloc(user_info, lm_pwd->data, lm_pwd->length);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(user_info->password.response.lanman.data, user_info);
if (user_info->password.response.lanman.data == NULL) {
TALLOC_FREE(user_info);
return NT_STATUS_NO_MEMORY;
}
}
if (nt_pwd && nt_pwd->data) {
user_info->password.response.nt = data_blob_talloc(user_info, nt_pwd->data, nt_pwd->length);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(user_info->password.response.nt.data, user_info);
if (user_info->password.response.nt.data == NULL) {
TALLOC_FREE(user_info);
return NT_STATUS_NO_MEMORY;
}
}
if (lm_interactive_pwd) {
user_info->password.hash.lanman = talloc(user_info, struct samr_Password);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(user_info->password.hash.lanman, user_info);
if (user_info->password.hash.lanman == NULL) {
TALLOC_FREE(user_info);
return NT_STATUS_NO_MEMORY;
}
memcpy(user_info->password.hash.lanman->hash, lm_interactive_pwd->hash,
sizeof(user_info->password.hash.lanman->hash));
talloc_set_destructor(user_info->password.hash.lanman, clear_samr_Password);
@ -109,7 +136,10 @@ NTSTATUS make_user_info(struct auth_usersupplied_info **ret_user_info,
if (nt_interactive_pwd) {
user_info->password.hash.nt = talloc(user_info, struct samr_Password);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(user_info->password.hash.nt, user_info);
if (user_info->password.hash.nt == NULL) {
TALLOC_FREE(user_info);
return NT_STATUS_NO_MEMORY;
}
memcpy(user_info->password.hash.nt->hash, nt_interactive_pwd->hash,
sizeof(user_info->password.hash.nt->hash));
talloc_set_destructor(user_info->password.hash.nt, clear_samr_Password);
@ -117,7 +147,10 @@ NTSTATUS make_user_info(struct auth_usersupplied_info **ret_user_info,
if (plaintext_password) {
user_info->password.plaintext = talloc_strdup(user_info, plaintext_password);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(user_info->password.plaintext, user_info);
if (user_info->password.plaintext == NULL) {
TALLOC_FREE(user_info);
return NT_STATUS_NO_MEMORY;
}
talloc_set_destructor(user_info->password.plaintext, clear_string);
}

View File

@ -1172,7 +1172,10 @@ static NTSTATUS pdb_samba_dsdb_enum_group_members(struct pdb_methods *m,
}
*pmembers = members = talloc_array(mem_ctx, uint32_t, num_sids);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(*pmembers, tmp_ctx);
if (*pmembers == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
num_members = 0;
for (i = 0; i < num_sids; i++) {
@ -1392,7 +1395,10 @@ static NTSTATUS pdb_samba_dsdb_mod_groupmem_by_sid(struct pdb_methods *m,
TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
NT_STATUS_HAVE_NO_MEMORY(tmp_ctx);
msg = ldb_msg_new(tmp_ctx);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(msg, tmp_ctx);
if (msg == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
msg->dn = ldb_dn_new_fmt(msg, state->ldb, "<SID=%s>", dom_sid_string(tmp_ctx, groupsid));
if (!msg->dn || !ldb_dn_validate(msg->dn)) {
@ -1441,9 +1447,15 @@ static NTSTATUS pdb_samba_dsdb_mod_groupmem(struct pdb_methods *m,
dom_sid = samdb_domain_sid(state->ldb);
groupsid = dom_sid_add_rid(tmp_ctx, dom_sid, grouprid);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(groupsid, tmp_ctx);
if (groupsid == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
membersid = dom_sid_add_rid(tmp_ctx, dom_sid, memberrid);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(membersid, tmp_ctx);
if (membersid == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
status = pdb_samba_dsdb_mod_groupmem_by_sid(m, tmp_ctx, groupsid, membersid, mod_op);
talloc_free(tmp_ctx);
return status;
@ -1708,10 +1720,16 @@ static NTSTATUS pdb_samba_dsdb_enum_alias_memberships(struct pdb_methods *m,
for (i = 0; i < num_members; i++) {
sid_string = dom_sid_string(tmp_ctx, &members[i]);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(sid_string, tmp_ctx);
if (sid_string == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
sid_dn = talloc_asprintf(tmp_ctx, "<SID=%s>", sid_string);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(sid_dn, tmp_ctx);
if (sid_dn == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
sid_blob = data_blob_string_const(sid_dn);

View File

@ -298,15 +298,24 @@ _PUBLIC_ NTSTATUS authsam_make_user_info_dc(TALLOC_CTX *mem_ctx,
NT_STATUS_HAVE_NO_MEMORY(user_info_dc);
tmp_ctx = talloc_new(user_info_dc);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(user_info_dc, user_info_dc);
if (user_info_dc == NULL) {
TALLOC_FREE(user_info_dc);
return NT_STATUS_NO_MEMORY;
}
sids = talloc_array(user_info_dc, struct dom_sid, 2);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(sids, user_info_dc);
if (sids == NULL) {
TALLOC_FREE(user_info_dc);
return NT_STATUS_NO_MEMORY;
}
num_sids = 2;
account_sid = samdb_result_dom_sid(user_info_dc, msg, "objectSid");
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(account_sid, user_info_dc);
if (account_sid == NULL) {
TALLOC_FREE(user_info_dc);
return NT_STATUS_NO_MEMORY;
}
status = dom_sid_split_rid(tmp_ctx, account_sid, &domain_sid, NULL);
if (!NT_STATUS_IS_OK(status)) {
@ -322,13 +331,22 @@ _PUBLIC_ NTSTATUS authsam_make_user_info_dc(TALLOC_CTX *mem_ctx,
* for builtin groups later, and not include them in the PAC
* on SamLogon validation info */
filter = talloc_asprintf(tmp_ctx, "(&(objectClass=group)(!(groupType:1.2.840.113556.1.4.803:=%u))(groupType:1.2.840.113556.1.4.803:=%u))", GROUP_TYPE_BUILTIN_LOCAL_GROUP, GROUP_TYPE_SECURITY_ENABLED);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(filter, user_info_dc);
if (filter == NULL) {
TALLOC_FREE(user_info_dc);
return NT_STATUS_NO_MEMORY;
}
primary_group_string = dom_sid_string(tmp_ctx, &sids[PRIMARY_GROUP_SID_INDEX]);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(primary_group_string, user_info_dc);
if (primary_group_string == NULL) {
TALLOC_FREE(user_info_dc);
return NT_STATUS_NO_MEMORY;
}
primary_group_dn = talloc_asprintf(tmp_ctx, "<SID=%s>", primary_group_string);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(primary_group_dn, user_info_dc);
if (primary_group_dn == NULL) {
TALLOC_FREE(user_info_dc);
return NT_STATUS_NO_MEMORY;
}
primary_group_blob = data_blob_string_const(primary_group_dn);
@ -377,7 +395,10 @@ _PUBLIC_ NTSTATUS authsam_make_user_info_dc(TALLOC_CTX *mem_ctx,
str = ldb_msg_find_attr_as_string(msg, "displayName", "");
info->full_name = talloc_strdup(info, str);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(info->full_name, user_info_dc);
if (info->full_name == NULL) {
TALLOC_FREE(user_info_dc);
return NT_STATUS_NO_MEMORY;
}
str = ldb_msg_find_attr_as_string(msg, "scriptPath", "");
info->logon_script = talloc_strdup(info, str);
@ -396,7 +417,10 @@ _PUBLIC_ NTSTATUS authsam_make_user_info_dc(TALLOC_CTX *mem_ctx,
str = ldb_msg_find_attr_as_string(msg, "homeDrive", "");
info->home_drive = talloc_strdup(info, str);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(info->home_drive, user_info_dc);
if (info->home_drive == NULL) {
TALLOC_FREE(user_info_dc);
return NT_STATUS_NO_MEMORY;
}
info->logon_server = talloc_strdup(info, netbios_name);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(info->logon_server,
@ -442,7 +466,10 @@ _PUBLIC_ NTSTATUS authsam_make_user_info_dc(TALLOC_CTX *mem_ctx,
user_info_dc->sids,
struct dom_sid,
user_info_dc->num_sids+1);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(user_info_dc->sids, user_info_dc);
if (user_info_dc->sids == NULL) {
TALLOC_FREE(user_info_dc);
return NT_STATUS_NO_MEMORY;
}
user_info_dc->sids[user_info_dc->num_sids] = global_sid_Enterprise_DCs;
user_info_dc->num_sids++;
}
@ -454,7 +481,10 @@ _PUBLIC_ NTSTATUS authsam_make_user_info_dc(TALLOC_CTX *mem_ctx,
user_info_dc->sids,
struct dom_sid,
user_info_dc->num_sids+1);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(user_info_dc->sids, user_info_dc);
if (user_info_dc->sids == NULL) {
TALLOC_FREE(user_info_dc);
return NT_STATUS_NO_MEMORY;
}
user_info_dc->sids[user_info_dc->num_sids] = *domain_sid;
sid_append_rid(&user_info_dc->sids[user_info_dc->num_sids],
DOMAIN_RID_ENTERPRISE_READONLY_DCS);

View File

@ -66,31 +66,52 @@ _PUBLIC_ NTSTATUS auth_generate_session_info(TALLOC_CTX *mem_ctx,
NT_STATUS_HAVE_NO_MEMORY(tmp_ctx);
session_info = talloc_zero(tmp_ctx, struct auth_session_info);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(session_info, tmp_ctx);
if (session_info == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
session_info->info = talloc_reference(session_info, user_info_dc->info);
session_info->torture = talloc_zero(session_info, struct auth_user_info_torture);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(session_info->torture, tmp_ctx);
if (session_info->torture == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
session_info->torture->num_dc_sids = user_info_dc->num_sids;
session_info->torture->dc_sids = talloc_reference(session_info, user_info_dc->sids);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(session_info->torture->dc_sids, tmp_ctx);
if (session_info->torture->dc_sids == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
/* unless set otherwise, the session key is the user session
* key from the auth subsystem */
session_info->session_key = data_blob_talloc(session_info, user_info_dc->user_session_key.data, user_info_dc->user_session_key.length);
if (!session_info->session_key.data && session_info->session_key.length) {
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(session_info->session_key.data, tmp_ctx);
if (session_info->session_key.data == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
}
anonymous_sid = dom_sid_parse_talloc(tmp_ctx, SID_NT_ANONYMOUS);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(anonymous_sid, tmp_ctx);
if (anonymous_sid == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
system_sid = dom_sid_parse_talloc(tmp_ctx, SID_NT_SYSTEM);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(system_sid, tmp_ctx);
if (system_sid == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
sids = talloc_array(tmp_ctx, struct dom_sid, user_info_dc->num_sids);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(sids, tmp_ctx);
if (sids == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
if (!sids) {
talloc_free(tmp_ctx);
return NT_STATUS_NO_MEMORY;
@ -151,11 +172,17 @@ _PUBLIC_ NTSTATUS auth_generate_session_info(TALLOC_CTX *mem_ctx,
sid_string = dom_sid_string(tmp_ctx,
&sids[i]);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(sid_string, user_info_dc);
if (sid_string == NULL) {
TALLOC_FREE(user_info_dc);
return NT_STATUS_NO_MEMORY;
}
sid_dn = talloc_asprintf(tmp_ctx, "<SID=%s>", sid_string);
talloc_free(sid_string);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(sid_dn, user_info_dc);
if (sid_dn == NULL) {
TALLOC_FREE(user_info_dc);
return NT_STATUS_NO_MEMORY;
}
sid_blob = data_blob_string_const(sid_dn);
/* This function takes in memberOf values and expands

View File

@ -174,7 +174,10 @@ NTSTATUS dsdb_expand_nested_groups(struct ldb_context *sam_ctx,
if (!only_childs) {
*res_sids = talloc_realloc(res_sids_ctx, *res_sids,
struct dom_sid, *num_res_sids + 1);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(*res_sids, tmp_ctx);
if (*res_sids == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
(*res_sids)[*num_res_sids] = sid;
++(*num_res_sids);
}

View File

@ -505,7 +505,10 @@ static NTSTATUS kcctpl_create_graph(TALLOC_CTX *mem_ctx,
graph->vertices.count = guids.count;
graph->vertices.data = talloc_zero_array(graph, struct kcctpl_vertex,
guids.count);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(graph->vertices.data, graph);
if (graph->vertices.data == NULL) {
TALLOC_FREE(graph);
return NT_STATUS_NO_MEMORY;
}
TYPESAFE_QSORT(guids.data, guids.count, GUID_compare);
@ -539,7 +542,10 @@ static NTSTATUS kcctpl_create_edge(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
NT_STATUS_HAVE_NO_MEMORY(tmp_ctx);
edge = talloc_zero(tmp_ctx, struct kcctpl_multi_edge);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(edge, tmp_ctx);
if (edge == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
edge->id = samdb_result_guid(site_link, "objectGUID");
@ -580,7 +586,10 @@ static NTSTATUS kcctpl_create_edge(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
}
edge->vertex_ids.data = talloc_array(edge, struct GUID, el->num_values);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(edge->vertex_ids.data, tmp_ctx);
if (edge->vertex_ids.data == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
edge->vertex_ids.count = el->num_values;
for (i = 0; i < el->num_values; i++) {
@ -641,7 +650,10 @@ static NTSTATUS kcctpl_create_auto_edge_set(struct kcctpl_graph *graph,
NT_STATUS_HAVE_NO_MEMORY(tmp_ctx);
set = talloc_zero(tmp_ctx, struct kcctpl_multi_edge_set);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(set, tmp_ctx);
if (set == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
for (i = 0; i < res_site_link->count; i++) {
struct GUID site_link_guid;
@ -665,7 +677,10 @@ static NTSTATUS kcctpl_create_auto_edge_set(struct kcctpl_graph *graph,
new_data = talloc_realloc(set, set->edge_ids.data,
struct GUID,
set->edge_ids.count + 1);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(new_data, tmp_ctx);
if (new_data == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
new_data[set->edge_ids.count] = site_link_guid;
set->edge_ids.data = new_data;
set->edge_ids.count++;
@ -694,7 +709,10 @@ static NTSTATUS kcctpl_create_edge_set(struct ldb_context *ldb,
NT_STATUS_HAVE_NO_MEMORY(tmp_ctx);
set = talloc_zero(tmp_ctx, struct kcctpl_multi_edge_set);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(set, tmp_ctx);
if (set == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
set->id = samdb_result_guid(bridge, "objectGUID");
@ -752,7 +770,10 @@ static NTSTATUS kcctpl_create_edge_set(struct ldb_context *ldb,
new_data = talloc_realloc(set, set->edge_ids.data,
struct GUID,
set->edge_ids.count + 1);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(new_data, tmp_ctx);
if (new_data == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
new_data[set->edge_ids.count] = site_link_guid;
set->edge_ids.data = new_data;
set->edge_ids.count++;
@ -820,7 +841,10 @@ static NTSTATUS kcctpl_setup_graph(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
new_data = talloc_realloc(tmp_ctx, vertex_ids.data, struct GUID,
vertex_ids.count + 1);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(new_data, tmp_ctx);
if (new_data == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
new_data[vertex_ids.count] = guid;
vertex_ids.data = new_data;
vertex_ids.count++;
@ -905,7 +929,10 @@ static NTSTATUS kcctpl_setup_graph(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
new_data = talloc_realloc(graph, graph->edges.data,
struct kcctpl_multi_edge,
graph->edges.count + 1);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(new_data, tmp_ctx);
if (new_data == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
new_data[graph->edges.count] = *edge;
graph->edges.data = new_data;
graph->edges.count++;
@ -930,7 +957,10 @@ static NTSTATUS kcctpl_setup_graph(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
new_data = talloc_realloc(graph, graph->edge_sets.data,
struct kcctpl_multi_edge_set,
graph->edge_sets.count + 1);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(new_data, tmp_ctx);
if (new_data == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
new_data[graph->edge_sets.count] = *edge_set;
graph->edge_sets.data = new_data;
graph->edge_sets.count++;
@ -1285,7 +1315,10 @@ static NTSTATUS kcctpl_get_all_bridgehead_dcs(struct kccsrv_service *service,
new_data = talloc_realloc(tmp_ctx, bridgeheads.data,
struct ldb_message,
bridgeheads.count + 1);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(new_data, tmp_ctx);
if (new_data == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
new_data[bridgeheads.count + 1] = *dc;
bridgeheads.data = new_data;
bridgeheads.count++;
@ -1527,7 +1560,10 @@ static NTSTATUS kcctpl_color_vertices(struct kccsrv_service *service,
vertex->accept_red_red.data,
struct GUID,
vertex->accept_red_red.count + 1);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(new_data, tmp_ctx);
if (new_data == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
new_data[vertex->accept_red_red.count + 1] = transport_guid;
vertex->accept_red_red.data = new_data;
vertex->accept_red_red.count++;
@ -1536,7 +1572,10 @@ static NTSTATUS kcctpl_color_vertices(struct kccsrv_service *service,
vertex->accept_black.data,
struct GUID,
vertex->accept_black.count + 1);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(new_data, tmp_ctx);
if (new_data == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
new_data[vertex->accept_black.count + 1] = transport_guid;
vertex->accept_black.data = new_data;
vertex->accept_black.count++;
@ -1716,7 +1755,10 @@ static NTSTATUS kcctpl_copy_output_edges(struct kccsrv_service *service,
new_data = talloc_realloc(tmp_ctx, copy.data,
struct kcctpl_multi_edge,
copy.count + 1);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(new_data, tmp_ctx);
if (new_data == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
new_data[copy.count + 1] = *edge;
copy.data = new_data;
copy.count++;
@ -1928,7 +1970,10 @@ static NTSTATUS kcctpl_dijkstra(struct kcctpl_graph *graph, struct GUID type,
new_data = talloc_realloc(tmp_ctx, vertices.data,
struct kcctpl_vertex,
vertices.count - 1);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(new_data, tmp_ctx);
if (new_data == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
talloc_free(vertices.data);
vertices.data = new_data;
vertices.count--;
@ -2110,7 +2155,10 @@ static NTSTATUS kcctpl_process_edge(TALLOC_CTX *mem_ctx,
new_data = talloc_realloc(tmp_ctx, vertices.data,
struct kcctpl_vertex,
vertices.count + 1);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(new_data, tmp_ctx);
if (new_data == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
new_data[vertices.count] = *vertex;
vertices.data = new_data;
vertices.count++;
@ -2323,13 +2371,19 @@ static NTSTATUS kcctpl_add_out_edge(TALLOC_CTX *mem_ctx,
}
new_edge = talloc(tmp_ctx, struct kcctpl_multi_edge);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(new_edge, tmp_ctx);
if (new_edge == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
new_edge->id = GUID_random(); /* TODO: what should be new_edge->GUID? */
new_edge->directed = false;
new_edge->vertex_ids.data = talloc_array(new_edge, struct GUID, 2);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(new_edge->vertex_ids.data, tmp_ctx);
if (new_edge->vertex_ids.data == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
new_edge->vertex_ids.data[0] = vertex1->id;
new_edge->vertex_ids.data[1] = vertex2->id;
@ -2341,14 +2395,20 @@ static NTSTATUS kcctpl_add_out_edge(TALLOC_CTX *mem_ctx,
new_data = talloc_realloc(tmp_ctx, output_edges.data,
struct kcctpl_multi_edge,
output_edges.count + 1);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(new_data, tmp_ctx);
if (new_data == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
new_data[output_edges.count + 1] = *new_edge;
output_edges.data = new_data;
output_edges.count++;
new_data_id = talloc_realloc(vertex1, vertex1->edge_ids.data,
struct GUID, vertex1->edge_ids.count);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(new_data_id, tmp_ctx);
if (new_data_id == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
new_data_id[vertex1->edge_ids.count] = new_edge->id;
talloc_free(vertex1->edge_ids.data);
vertex1->edge_ids.data = new_data_id;
@ -2356,7 +2416,10 @@ static NTSTATUS kcctpl_add_out_edge(TALLOC_CTX *mem_ctx,
new_data_id = talloc_realloc(vertex2, vertex2->edge_ids.data,
struct GUID, vertex2->edge_ids.count);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(new_data_id, tmp_ctx);
if (new_data_id == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
new_data_id[vertex2->edge_ids.count] = new_edge->id;
talloc_free(vertex2->edge_ids.data);
vertex2->edge_ids.data = new_data_id;
@ -2729,7 +2792,10 @@ static NTSTATUS kcctpl_create_connection(struct kccsrv_service *service,
NT_STATUS_HAVE_NO_MEMORY(tmp_ctx);
r_site_dn = ldb_dn_copy(tmp_ctx, r_bridgehead->dn);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(r_site_dn, tmp_ctx);
if (r_site_dn == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
ok = ldb_dn_remove_child_components(r_site_dn, 3);
if (!ok) {
@ -2748,7 +2814,10 @@ static NTSTATUS kcctpl_create_connection(struct kccsrv_service *service,
}
l_site_dn = ldb_dn_copy(tmp_ctx, l_bridgehead->dn);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(l_site_dn, tmp_ctx);
if (l_site_dn == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
ok = ldb_dn_remove_child_components(l_site_dn, 3);
if (!ok) {
@ -3111,7 +3180,10 @@ static NTSTATUS kcctpl_create_connection(struct kccsrv_service *service,
new_data = talloc_realloc(tmp_ctx, keep_connections.data,
struct GUID,
keep_connections.count + 1);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(new_data, tmp_ctx);
if (new_data == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
new_data[keep_connections.count] = new_guid;
keep_connections.data = new_data;
keep_connections.count++;
@ -3369,7 +3441,10 @@ static NTSTATUS kcctpl_create_intersite_connections(struct kccsrv_service *servi
NT_STATUS_HAVE_NO_MEMORY(tmp_ctx);
partitions_dn = samdb_partitions_dn(service->samdb, tmp_ctx);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(partitions_dn, tmp_ctx);
if (partitions_dn == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
ret = ldb_search(service->samdb, tmp_ctx, &res, partitions_dn, LDB_SCOPE_ONELEVEL,
attrs, "objectClass=crossRef");

View File

@ -280,7 +280,10 @@ static NTSTATUS dreplsrv_get_rodc_partial_attribute_set(struct dreplsrv_service
pas->version = 1;
pas->attids = talloc_array(pas, enum drsuapi_DsAttributeId, schema->num_attributes);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(pas->attids, pas);
if (pas->attids == NULL) {
TALLOC_FREE(pas);
return NT_STATUS_NO_MEMORY;
}
for (i=0; i<schema->num_attributes; i++) {
struct dsdb_attribute *a;
@ -296,7 +299,10 @@ static NTSTATUS dreplsrv_get_rodc_partial_attribute_set(struct dreplsrv_service
}
pas->attids = talloc_realloc(pas, pas->attids, enum drsuapi_DsAttributeId, pas->num_attids);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(pas->attids, pas);
if (pas->attids == NULL) {
TALLOC_FREE(pas);
return NT_STATUS_NO_MEMORY;
}
*_pas = pas;
return NT_STATUS_OK;
@ -321,7 +327,10 @@ static NTSTATUS dreplsrv_get_gc_partial_attribute_set(struct dreplsrv_service *s
pas->version = 1;
pas->attids = talloc_array(pas, enum drsuapi_DsAttributeId, schema->num_attributes);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(pas->attids, pas);
if (pas->attids == NULL) {
TALLOC_FREE(pas);
return NT_STATUS_NO_MEMORY;
}
for (i=0; i<schema->num_attributes; i++) {
struct dsdb_attribute *a;
@ -333,7 +342,10 @@ static NTSTATUS dreplsrv_get_gc_partial_attribute_set(struct dreplsrv_service *s
}
pas->attids = talloc_realloc(pas, pas->attids, enum drsuapi_DsAttributeId, pas->num_attids);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(pas->attids, pas);
if (pas->attids == NULL) {
TALLOC_FREE(pas);
return NT_STATUS_NO_MEMORY;
}
*_pas = pas;
return NT_STATUS_OK;

View File

@ -280,12 +280,18 @@ static NTSTATUS gp_get_files(struct smbcli_tree *tree, const char *share_path,
/* Get local path by replacing backslashes with slashes */
local_rel_path = talloc_strdup(mem_ctx, list->files[i].rel_path);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(local_rel_path, mem_ctx);
if (local_rel_path == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
string_replace(local_rel_path, '\\', '/');
full_local_path = talloc_asprintf(mem_ctx, "%s%s", local_path,
local_rel_path);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(full_local_path, mem_ctx);
if (full_local_path == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
/* If the entry is a directory, create it. */
if (list->files[i].is_directory == true) {
@ -301,7 +307,10 @@ static NTSTATUS gp_get_files(struct smbcli_tree *tree, const char *share_path,
full_remote_path = talloc_asprintf(mem_ctx, "%s%s", share_path,
list->files[i].rel_path);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(full_remote_path, mem_ctx);
if (full_remote_path == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
/* Get the file */
status = gp_get_file(tree, full_remote_path, full_local_path);
@ -340,15 +349,24 @@ NTSTATUS gp_fetch_gpt (struct gp_context *gp_ctx, struct gp_object *gpo,
/* Get the remote path to copy from */
share_path = gp_get_share_path(mem_ctx, gpo->file_sys_path);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(share_path, mem_ctx);
if (share_path == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
/* Get the local path to copy to */
local_path = talloc_asprintf(gp_ctx, "%s/%s", gp_tmpdir(mem_ctx), gpo->name);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(local_path, mem_ctx);
if (local_path == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
/* Prepare the state structure */
state = talloc_zero(mem_ctx, struct gp_list_state);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(state, mem_ctx);
if (state == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
state->tree = gp_ctx->cli->tree;
state->share_path = share_path;

View File

@ -61,26 +61,41 @@ static NTSTATUS parse_gpo(TALLOC_CTX *mem_ctx, struct ldb_message *msg, struct g
NT_STATUS_HAVE_NO_MEMORY(gpo);
gpo->dn = talloc_strdup(mem_ctx, ldb_dn_get_linearized(msg->dn));
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->dn, gpo);
if (gpo->dn == NULL) {
TALLOC_FREE(gpo);
return NT_STATUS_NO_MEMORY;
}
DEBUG(9, ("Parsing GPO LDAP data for %s\n", gpo->dn));
gpo->display_name = talloc_strdup(gpo, ldb_msg_find_attr_as_string(msg, "displayName", ""));
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->display_name, gpo);
if (gpo->display_name == NULL) {
TALLOC_FREE(gpo);
return NT_STATUS_NO_MEMORY;
}
gpo->name = talloc_strdup(gpo, ldb_msg_find_attr_as_string(msg, "name", ""));
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->name, gpo);
if (gpo->name == NULL) {
TALLOC_FREE(gpo);
return NT_STATUS_NO_MEMORY;
}
gpo->flags = ldb_msg_find_attr_as_uint(msg, "flags", 0);
gpo->version = ldb_msg_find_attr_as_uint(msg, "versionNumber", 0);
gpo->file_sys_path = talloc_strdup(gpo, ldb_msg_find_attr_as_string(msg, "gPCFileSysPath", ""));
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->file_sys_path, gpo);
if (gpo->file_sys_path == NULL) {
TALLOC_FREE(gpo);
return NT_STATUS_NO_MEMORY;
}
/* Pull the security descriptor through the NDR library */
data = ldb_msg_find_ldb_val(msg, "nTSecurityDescriptor");
gpo->security_descriptor = talloc(gpo, struct security_descriptor);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->security_descriptor, gpo);
if (gpo->security_descriptor == NULL) {
TALLOC_FREE(gpo);
return NT_STATUS_NO_MEMORY;
}
ndr_err = ndr_pull_struct_blob(data,
mem_ctx,
@ -218,7 +233,10 @@ NTSTATUS gp_list_all_gpos(struct gp_context *gp_ctx, struct gp_object ***ret)
DEBUG(10, ("Searching for policies in DN: %s\n", ldb_dn_get_linearized(dn)));
attrs = talloc_array(mem_ctx, const char *, 7);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(attrs, mem_ctx);
if (attrs == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
attrs[0] = "nTSecurityDescriptor";
attrs[1] = "versionNumber";
@ -236,7 +254,10 @@ NTSTATUS gp_list_all_gpos(struct gp_context *gp_ctx, struct gp_object ***ret)
}
gpo = talloc_array(gp_ctx, struct gp_object *, result->count+1);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo, mem_ctx);
if (gpo == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
gpo[result->count] = NULL;
@ -273,7 +294,10 @@ NTSTATUS gp_get_gpo_info(struct gp_context *gp_ctx, const char *dn_str, struct g
dn = ldb_dn_new(mem_ctx, gp_ctx->ldb_ctx, dn_str);
attrs = talloc_array(mem_ctx, const char *, 7);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(attrs, mem_ctx);
if (attrs == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
attrs[0] = "nTSecurityDescriptor";
attrs[1] = "versionNumber";
@ -341,12 +365,18 @@ static NTSTATUS parse_gplink (TALLOC_CTX *mem_ctx, const char *gplink_str, struc
gplinks[idx]->dn = talloc_strndup(mem_ctx,
gplink_str + start,
pos - start);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gplinks[idx]->dn, gplinks);
if (gplinks[idx]->dn == NULL) {
TALLOC_FREE(gplinks);
return NT_STATUS_NO_MEMORY;
}
for (start = pos + 1; gplink_str[pos] != ']'; pos++);
buf = talloc_strndup(gplinks, gplink_str + start, pos - start);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(buf, gplinks);
if (buf == NULL) {
TALLOC_FREE(gplinks);
return NT_STATUS_NO_MEMORY;
}
gplinks[idx]->options = (uint32_t) strtoll(buf, &end, 0);
talloc_free(buf);
@ -397,13 +427,19 @@ NTSTATUS gp_get_gplinks(struct gp_context *gp_ctx, const char *dn_str, struct gp
if (strcmp(element->name, "gPLink") == 0) {
SMB_ASSERT(element->num_values > 0);
gplink_str = talloc_strdup(mem_ctx, (char *) element->values[0].data);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gplink_str, mem_ctx);
if (gplink_str == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
goto found;
}
}
}
gplink_str = talloc_strdup(mem_ctx, "");
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gplink_str, mem_ctx);
if (gplink_str == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
found:
@ -479,7 +515,10 @@ NTSTATUS gp_list_gpos(struct gp_context *gp_ctx, struct security_token *token, c
}
gpos = talloc_array(gp_ctx, const char *, 1);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpos, mem_ctx);
if (gpos == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
gpos[0] = NULL;
/* Walk through the containers until we hit the root */
@ -559,9 +598,15 @@ NTSTATUS gp_list_gpos(struct gp_context *gp_ctx, struct security_token *token, c
/* Add the GPO to the list */
gpos = talloc_realloc(gp_ctx, gpos, const char *, count+2);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpos, mem_ctx);
if (gpos == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
gpos[count] = talloc_strdup(gp_ctx, gplinks[i]->dn);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpos[count], mem_ctx);
if (gpos[count] == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
gpos[count+1] = NULL;
count++;
@ -624,18 +669,27 @@ NTSTATUS gp_set_gplink(struct gp_context *gp_ctx, const char *dn_str, struct gp_
start++;
}
gplink_str = talloc_asprintf(mem_ctx, "%s;%d%s", gplink_str, gplink->options, start);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gplink_str, mem_ctx);
if (gplink_str == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
} else {
/* Prepend the new GPO link to the string. This list is backwards in priority. */
gplink_str = talloc_asprintf(mem_ctx, "[LDAP://%s;%d]%s", gplink->dn, gplink->options, gplink_str);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gplink_str, mem_ctx);
if (gplink_str == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
}
msg = ldb_msg_new(mem_ctx);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(msg, mem_ctx);
if (msg == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
msg->dn = dn;
@ -691,7 +745,10 @@ NTSTATUS gp_del_gplink(struct gp_context *gp_ctx, const char *dn_str, const char
/* If this GPO link already exists, alter the options, else add it */
search_string = talloc_asprintf(mem_ctx, "[LDAP://%s]", gplink_dn);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(search_string, mem_ctx);
if (search_string == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
p = strcasestr(gplink_str, search_string);
if (p == NULL) {
@ -706,11 +763,17 @@ NTSTATUS gp_del_gplink(struct gp_context *gp_ctx, const char *dn_str, const char
}
p++;
gplink_str = talloc_asprintf(mem_ctx, "%s%s", gplink_str, p);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gplink_str, mem_ctx);
if (gplink_str == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
msg = ldb_msg_new(mem_ctx);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(msg, mem_ctx);
if (msg == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
msg->dn = dn;
@ -785,7 +848,10 @@ NTSTATUS gp_set_inheritance(struct gp_context *gp_ctx, const char *dn_str, enum
msg->dn = ldb_dn_new(msg, gp_ctx->ldb_ctx, dn_str);
inheritance_string = talloc_asprintf(msg, "%d", inheritance);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(inheritance_string, msg);
if (inheritance_string == NULL) {
TALLOC_FREE(msg);
return NT_STATUS_NO_MEMORY;
}
rv = ldb_msg_add_string(msg, "gPOptions", inheritance_string);
if (rv != LDB_SUCCESS) {
@ -819,21 +885,33 @@ NTSTATUS gp_create_ldap_gpo(struct gp_context *gp_ctx, struct gp_object *gpo)
/* CN={GUID} */
msg = ldb_msg_new(mem_ctx);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(msg, mem_ctx);
if (msg == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
msg->dn = ldb_get_default_basedn(gp_ctx->ldb_ctx);
dn_str = talloc_asprintf(mem_ctx, "CN=%s,CN=Policies,CN=System", gpo->name);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(dn_str, mem_ctx);
if (dn_str == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
child_dn = ldb_dn_new(mem_ctx, gp_ctx->ldb_ctx, dn_str);
rv = ldb_dn_add_child(msg->dn, child_dn);
if (!rv) goto ldb_msg_add_error;
flags_str = talloc_asprintf(mem_ctx, "%d", gpo->flags);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(flags_str, mem_ctx);
if (flags_str == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
version_str = talloc_asprintf(mem_ctx, "%d", gpo->version);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(version_str, mem_ctx);
if (version_str == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
rv = ldb_msg_add_string(msg, "objectClass", "top");
if (rv != LDB_SUCCESS) goto ldb_msg_add_error;
@ -869,7 +947,10 @@ NTSTATUS gp_create_ldap_gpo(struct gp_context *gp_ctx, struct gp_object *gpo)
/* CN=User */
msg = ldb_msg_new(mem_ctx);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(msg, mem_ctx);
if (msg == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
msg->dn = ldb_dn_copy(mem_ctx, gpo_dn);
child_dn = ldb_dn_new(mem_ctx, gp_ctx->ldb_ctx, "CN=User");
@ -896,7 +977,10 @@ NTSTATUS gp_create_ldap_gpo(struct gp_context *gp_ctx, struct gp_object *gpo)
/* CN=Machine */
msg = ldb_msg_new(mem_ctx);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(msg, mem_ctx);
if (msg == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
msg->dn = ldb_dn_copy(mem_ctx, gpo_dn);
child_dn = ldb_dn_new(mem_ctx, gp_ctx->ldb_ctx, "CN=Machine");
@ -922,7 +1006,10 @@ NTSTATUS gp_create_ldap_gpo(struct gp_context *gp_ctx, struct gp_object *gpo)
}
gpo->dn = talloc_strdup(gpo, ldb_dn_get_linearized(gpo_dn));
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->dn, mem_ctx);
if (gpo->dn == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
talloc_free(mem_ctx);
return NT_STATUS_OK;
@ -957,7 +1044,10 @@ NTSTATUS gp_set_ads_acl (struct gp_context *gp_ctx, const char *dn_str, const st
/* Create a LDB message */
msg = ldb_msg_new(mem_ctx);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(msg, mem_ctx);
if (msg == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
msg->dn = ldb_dn_new(mem_ctx, gp_ctx->ldb_ctx, dn_str);
@ -991,15 +1081,24 @@ NTSTATUS gp_set_ldap_gpo(struct gp_context *gp_ctx, struct gp_object *gpo)
mem_ctx = talloc_new(gp_ctx);
msg = ldb_msg_new(mem_ctx);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(msg, mem_ctx);
if (msg == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
msg->dn = ldb_dn_new(mem_ctx, gp_ctx->ldb_ctx, gpo->dn);
version_str = talloc_asprintf(mem_ctx, "%d", gpo->version);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(msg, mem_ctx);
if (msg == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
flags_str = talloc_asprintf(mem_ctx, "%d", gpo->flags);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(msg, mem_ctx);
if (msg == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
rv = ldb_msg_add_string(msg, "flags", flags_str);
if (rv != LDB_SUCCESS) {

View File

@ -67,21 +67,33 @@ NTSTATUS gp_create_gpt_security_descriptor (TALLOC_CTX *mem_ctx, struct security
/* Copy the basic information from the directory server security descriptor */
fs_sd->owner_sid = talloc_memdup(fs_sd, ds_sd->owner_sid, sizeof(struct dom_sid));
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(fs_sd->owner_sid, fs_sd);
if (fs_sd->owner_sid == NULL) {
TALLOC_FREE(fs_sd);
return NT_STATUS_NO_MEMORY;
}
fs_sd->group_sid = talloc_memdup(fs_sd, ds_sd->group_sid, sizeof(struct dom_sid));
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(fs_sd->group_sid, fs_sd);
if (fs_sd->group_sid == NULL) {
TALLOC_FREE(fs_sd);
return NT_STATUS_NO_MEMORY;
}
fs_sd->type = ds_sd->type;
fs_sd->revision = ds_sd->revision;
/* Copy the sacl */
fs_sd->sacl = security_acl_dup(fs_sd, ds_sd->sacl);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(fs_sd->sacl, fs_sd);
if (fs_sd->sacl == NULL) {
TALLOC_FREE(fs_sd);
return NT_STATUS_NO_MEMORY;
}
/* Copy the dacl */
fs_sd->dacl = talloc_zero(fs_sd, struct security_acl);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(fs_sd->dacl, fs_sd);
if (fs_sd->dacl == NULL) {
TALLOC_FREE(fs_sd);
return NT_STATUS_NO_MEMORY;
}
for (i = 0; i < ds_sd->dacl->num_aces; i++) {
char *trustee = dom_sid_string(fs_sd, &ds_sd->dacl->aces[i].trustee);
@ -96,7 +108,10 @@ NTSTATUS gp_create_gpt_security_descriptor (TALLOC_CTX *mem_ctx, struct security
/* Copy the ace from the directory server security descriptor */
ace = talloc_memdup(fs_sd, &ds_sd->dacl->aces[i], sizeof(struct security_ace));
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(ace, fs_sd);
if (ace == NULL) {
TALLOC_FREE(fs_sd);
return NT_STATUS_NO_MEMORY;
}
/* Set specific inheritance flags for within the GPO */
ace->flags |= SEC_ACE_FLAG_OBJECT_INHERIT | SEC_ACE_FLAG_CONTAINER_INHERIT;
@ -139,14 +154,23 @@ NTSTATUS gp_create_gpo (struct gp_context *gp_ctx, const char *display_name, str
/* Create the gpo struct to return later */
gpo = talloc(gp_ctx, struct gp_object);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo, mem_ctx);
if (gpo == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
/* Generate a GUID */
guid_struct = GUID_random();
guid_str = GUID_string2(mem_ctx, &guid_struct);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(guid_str, mem_ctx);
if (guid_str == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
name = strupper_talloc(mem_ctx, guid_str);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(name, mem_ctx);
if (name == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
/* Prepare the GPO struct */
gpo->dn = NULL;
@ -154,10 +178,16 @@ NTSTATUS gp_create_gpo (struct gp_context *gp_ctx, const char *display_name, str
gpo->flags = 0;
gpo->version = 0;
gpo->display_name = talloc_strdup(gpo, display_name);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->display_name, mem_ctx);
if (gpo->display_name == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
gpo->file_sys_path = talloc_asprintf(gpo, "\\\\%s\\sysvol\\%s\\Policies\\%s", lpcfg_dnsdomain(gp_ctx->lp_ctx), lpcfg_dnsdomain(gp_ctx->lp_ctx), name);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(gpo->file_sys_path, mem_ctx);
if (gpo->file_sys_path == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
/* Create the GPT */
status = gp_create_gpt(gp_ctx, name, gpo->file_sys_path);
@ -266,7 +296,10 @@ NTSTATUS gp_push_gpo (struct gp_context *gp_ctx, const char *local_path, struct
/* Get version from ini file */
/* FIXME: The local file system may be case sensitive */
filename = talloc_asprintf(mem_ctx, "%s/%s", local_path, "GPT.INI");
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(filename, mem_ctx);
if (filename == NULL) {
TALLOC_FREE(mem_ctx);
return NT_STATUS_NO_MEMORY;
}
status = gp_parse_ini(mem_ctx, gp_ctx, local_path, &ini);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0, ("Failed to parse GPT.INI.\n"));

View File

@ -976,13 +976,22 @@ static NTSTATUS samsync_ldb_handle_account(TALLOC_CTX *mem_ctx,
}
sidstr = dom_sid_string(msg, sid);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(sidstr, msg);
if (sidstr == NULL) {
TALLOC_FREE(msg);
return NT_STATUS_NO_MEMORY;
}
dnstr = talloc_asprintf(msg, "sid=%s", sidstr);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(dnstr, msg);
if (dnstr == NULL) {
TALLOC_FREE(msg);
return NT_STATUS_NO_MEMORY;
}
msg->dn = ldb_dn_new(msg, state->pdb, dnstr);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(msg->dn, msg);
if (msg->dn == NULL) {
TALLOC_FREE(msg);
return NT_STATUS_NO_MEMORY;
}
for (i=0; i< account->privilege_entries; i++) {
ldb_msg_add_string(msg, "privilege", account->privilege_name[i].string);

View File

@ -926,7 +926,10 @@ NTSTATUS pvfs_acl_inherited_sd(struct pvfs_state *pvfs,
*ret_sd = NULL;
acl = talloc(req, struct xattr_NTACL);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(acl, tmp_ctx);
if (acl == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
status = pvfs_acl_load(pvfs, parent, -1, acl);
if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) {
@ -954,10 +957,16 @@ NTSTATUS pvfs_acl_inherited_sd(struct pvfs_state *pvfs,
/* create the new sd */
sd = security_descriptor_initialise(req);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(sd, tmp_ctx);
if (sd == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
ids = talloc_array(sd, struct id_map, 2);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(ids, tmp_ctx);
if (ids == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
ids[0].xid.id = geteuid();
ids[0].xid.type = ID_TYPE_UID;

View File

@ -87,13 +87,22 @@ static NTSTATUS dcesrv_build_lsa_sd(TALLOC_CTX *mem_ctx,
NT_STATUS_NOT_OK_RETURN_AND_FREE(status, tmp_ctx);
domain_admins_sid = dom_sid_add_rid(tmp_ctx, domain_sid, DOMAIN_RID_ADMINS);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(domain_admins_sid, tmp_ctx);
if (domain_admins_sid == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
domain_admins_sid_str = dom_sid_string(tmp_ctx, domain_admins_sid);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(domain_admins_sid_str, tmp_ctx);
if (domain_admins_sid_str == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
sidstr = dom_sid_string(tmp_ctx, sid);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(sidstr, tmp_ctx);
if (sidstr == NULL) {
TALLOC_FREE(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
*sd = security_descriptor_dacl_create(mem_ctx,
0, sidstr, NULL,
@ -2587,16 +2596,28 @@ static NTSTATUS dcesrv_lsa_AddRemoveAccountRights(struct dcesrv_call_state *dce_
}
sidndrstr = ldap_encode_ndr_dom_sid(msg, sid);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(sidndrstr, msg);
if (sidndrstr == NULL) {
TALLOC_FREE(msg);
return NT_STATUS_NO_MEMORY;
}
sidstr = dom_sid_string(msg, sid);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(sidstr, msg);
if (sidstr == NULL) {
TALLOC_FREE(msg);
return NT_STATUS_NO_MEMORY;
}
dnstr = talloc_asprintf(msg, "sid=%s", sidstr);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(dnstr, msg);
if (dnstr == NULL) {
TALLOC_FREE(msg);
return NT_STATUS_NO_MEMORY;
}
msg->dn = ldb_dn_new(msg, state->pdb, dnstr);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(msg->dn, msg);
if (msg->dn == NULL) {
TALLOC_FREE(msg);
return NT_STATUS_NO_MEMORY;
}
if (LDB_FLAG_MOD_TYPE(ldb_flag) == LDB_FLAG_MOD_ADD) {
NTSTATUS status;

View File

@ -290,7 +290,10 @@ NTSTATUS stream_setup_socket(TALLOC_CTX *mem_ctx,
}
socket_address = socket_address_from_sockaddr_storage(stream_socket, &ss, port?*port:0);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(socket_address, stream_socket);
if (socket_address == NULL) {
TALLOC_FREE(stream_socket);
return NT_STATUS_NO_MEMORY;
}
status = socket_create(socket_address->family, SOCKET_TYPE_STREAM, &stream_socket->sock, 0);
NT_STATUS_NOT_OK_RETURN(status);

View File

@ -361,7 +361,10 @@ static NTSTATUS wreplsrv_in_update(struct wreplsrv_in_call *call)
wrepl_out->sock = wrepl_socket_init(wrepl_out,
wrepl_in->conn->event.ctx);
NT_STATUS_HAVE_NO_MEMORY_AND_FREE(wrepl_out->sock, update_state);
if (wrepl_out->sock == NULL) {
TALLOC_FREE(update_state);
return NT_STATUS_NO_MEMORY;
}
TALLOC_FREE(wrepl_in->send_queue);