From 24058fc089a5a75c2c8cc0cfb9e57b7fc5b6fe63 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 2 Oct 2010 11:50:26 +0200 Subject: [PATCH] s3: Attempt to fix bug 7665 Quite a few of our internal routines put stuff on talloc_tos() these days. In top-level netapi routines, properly allocate a stackframe and clean it again. Also, don't leak memory in the rpccli_ callers onto the libnetapi context. --- source3/lib/netapi/file.c | 6 +- source3/lib/netapi/getdc.c | 4 +- source3/lib/netapi/group.c | 112 ++++++++++++++-------------- source3/lib/netapi/joindomain.c | 10 +- source3/lib/netapi/libnetapi.c | 159 +++++++++++++++++++++++++++++++++++++++ source3/lib/netapi/localgroup.c | 34 ++++---- source3/lib/netapi/netlogon.c | 6 +- source3/lib/netapi/serverinfo.c | 6 +- source3/lib/netapi/share.c | 10 +- source3/lib/netapi/shutdown.c | 4 +- source3/lib/netapi/user.c | 80 ++++++++++---------- 11 files changed, 295 insertions(+), 136 deletions(-) diff --git a/source3/lib/netapi/file.c b/source3/lib/netapi/file.c index 1c3ef6d..6d76be0 100644 --- a/source3/lib/netapi/file.c +++ b/source3/lib/netapi/file.c @@ -42,7 +42,7 @@ WERROR NetFileClose_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_srvsvc_NetFileClose(pipe_cli, ctx, + status = rpccli_srvsvc_NetFileClose(pipe_cli, talloc_tos(), r->in.server_name, r->in.fileid, &werr); @@ -136,7 +136,7 @@ WERROR NetFileGetInfo_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_srvsvc_NetFileGetInfo(pipe_cli, ctx, + status = rpccli_srvsvc_NetFileGetInfo(pipe_cli, talloc_tos(), r->in.server_name, r->in.fileid, r->in.level, @@ -216,7 +216,7 @@ WERROR NetFileEnum_r(struct libnetapi_ctx *ctx, break; } - status = rpccli_srvsvc_NetFileEnum(pipe_cli, ctx, + status = rpccli_srvsvc_NetFileEnum(pipe_cli, talloc_tos(), r->in.server_name, r->in.base_path, r->in.user_name, diff --git a/source3/lib/netapi/getdc.c b/source3/lib/netapi/getdc.c index 9af01ce..b735b6a 100644 --- a/source3/lib/netapi/getdc.c +++ b/source3/lib/netapi/getdc.c @@ -52,7 +52,7 @@ WERROR NetGetDCName_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_netr_GetDcName(pipe_cli, ctx, + status = rpccli_netr_GetDcName(pipe_cli, talloc_tos(), r->in.server_name, r->in.domain_name, (const char **)r->out.buffer, @@ -92,7 +92,7 @@ WERROR NetGetAnyDCName_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_netr_GetAnyDCName(pipe_cli, ctx, + status = rpccli_netr_GetAnyDCName(pipe_cli, talloc_tos(), r->in.server_name, r->in.domain_name, (const char **)r->out.buffer, diff --git a/source3/lib/netapi/group.c b/source3/lib/netapi/group.c index e707c0c..f5a7e77 100644 --- a/source3/lib/netapi/group.c +++ b/source3/lib/netapi/group.c @@ -105,7 +105,7 @@ WERROR NetGroupAdd_r(struct libnetapi_ctx *ctx, break; } - status = rpccli_samr_CreateDomainGroup(pipe_cli, ctx, + status = rpccli_samr_CreateDomainGroup(pipe_cli, talloc_tos(), &domain_handle, &lsa_group_name, SEC_STD_DELETE | @@ -124,7 +124,7 @@ WERROR NetGroupAdd_r(struct libnetapi_ctx *ctx, init_lsa_String(&info.description, info1->grpi1_comment); - status = rpccli_samr_SetGroupInfo(pipe_cli, ctx, + status = rpccli_samr_SetGroupInfo(pipe_cli, talloc_tos(), &group_handle, GROUPINFODESCRIPTION, &info); @@ -135,7 +135,7 @@ WERROR NetGroupAdd_r(struct libnetapi_ctx *ctx, init_lsa_String(&info.description, info2->grpi2_comment); - status = rpccli_samr_SetGroupInfo(pipe_cli, ctx, + status = rpccli_samr_SetGroupInfo(pipe_cli, talloc_tos(), &group_handle, GROUPINFODESCRIPTION, &info); @@ -147,7 +147,7 @@ WERROR NetGroupAdd_r(struct libnetapi_ctx *ctx, if (info2->grpi2_attributes != 0) { info.attributes.attributes = info2->grpi2_attributes; - status = rpccli_samr_SetGroupInfo(pipe_cli, ctx, + status = rpccli_samr_SetGroupInfo(pipe_cli, talloc_tos(), &group_handle, GROUPINFOATTRIBUTES, &info); @@ -159,7 +159,7 @@ WERROR NetGroupAdd_r(struct libnetapi_ctx *ctx, init_lsa_String(&info.description, info3->grpi3_comment); - status = rpccli_samr_SetGroupInfo(pipe_cli, ctx, + status = rpccli_samr_SetGroupInfo(pipe_cli, talloc_tos(), &group_handle, GROUPINFODESCRIPTION, &info); @@ -171,7 +171,7 @@ WERROR NetGroupAdd_r(struct libnetapi_ctx *ctx, if (info3->grpi3_attributes != 0) { info.attributes.attributes = info3->grpi3_attributes; - status = rpccli_samr_SetGroupInfo(pipe_cli, ctx, + status = rpccli_samr_SetGroupInfo(pipe_cli, talloc_tos(), &group_handle, GROUPINFOATTRIBUTES, &info); @@ -190,12 +190,12 @@ WERROR NetGroupAdd_r(struct libnetapi_ctx *ctx, goto done; failed: - rpccli_samr_DeleteDomainGroup(pipe_cli, ctx, + rpccli_samr_DeleteDomainGroup(pipe_cli, talloc_tos(), &group_handle); done: if (is_valid_policy_hnd(&group_handle)) { - rpccli_samr_Close(pipe_cli, ctx, &group_handle); + rpccli_samr_Close(pipe_cli, talloc_tos(), &group_handle); } if (ctx->disable_policy_handle_cache) { @@ -262,7 +262,7 @@ WERROR NetGroupDel_r(struct libnetapi_ctx *ctx, init_lsa_String(&lsa_group_name, r->in.group_name); - status = rpccli_samr_LookupNames(pipe_cli, ctx, + status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(), &domain_handle, 1, &lsa_group_name, @@ -278,7 +278,7 @@ WERROR NetGroupDel_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_samr_OpenGroup(pipe_cli, ctx, + status = rpccli_samr_OpenGroup(pipe_cli, talloc_tos(), &domain_handle, SEC_STD_DELETE | SAMR_GROUP_ACCESS_GET_MEMBERS | @@ -292,7 +292,7 @@ WERROR NetGroupDel_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_samr_QueryGroupInfo(pipe_cli, ctx, + status = rpccli_samr_QueryGroupInfo(pipe_cli, talloc_tos(), &group_handle, GROUPINFOATTRIBUTES, &info); @@ -308,7 +308,7 @@ WERROR NetGroupDel_r(struct libnetapi_ctx *ctx, goto done; } #endif - status = rpccli_samr_QueryGroupMember(pipe_cli, ctx, + status = rpccli_samr_QueryGroupMember(pipe_cli, talloc_tos(), &group_handle, &rid_array); if (!NT_STATUS_IS_OK(status)) { @@ -320,7 +320,7 @@ WERROR NetGroupDel_r(struct libnetapi_ctx *ctx, struct lsa_Strings names; struct samr_Ids member_types; - status = rpccli_samr_LookupRids(pipe_cli, ctx, + status = rpccli_samr_LookupRids(pipe_cli, talloc_tos(), &domain_handle, rid_array->count, rid_array->rids, @@ -334,7 +334,7 @@ WERROR NetGroupDel_r(struct libnetapi_ctx *ctx, for (i=0; i < rid_array->count; i++) { - status = rpccli_samr_DeleteGroupMember(pipe_cli, ctx, + status = rpccli_samr_DeleteGroupMember(pipe_cli, talloc_tos(), &group_handle, rid_array->rids[i]); if (!NT_STATUS_IS_OK(status)) { @@ -343,7 +343,7 @@ WERROR NetGroupDel_r(struct libnetapi_ctx *ctx, } } - status = rpccli_samr_DeleteDomainGroup(pipe_cli, ctx, + status = rpccli_samr_DeleteDomainGroup(pipe_cli, talloc_tos(), &group_handle); if (!NT_STATUS_IS_OK(status)) { werr = ntstatus_to_werror(status); @@ -356,7 +356,7 @@ WERROR NetGroupDel_r(struct libnetapi_ctx *ctx, done: if (is_valid_policy_hnd(&group_handle)) { - rpccli_samr_Close(pipe_cli, ctx, &group_handle); + rpccli_samr_Close(pipe_cli, talloc_tos(), &group_handle); } if (ctx->disable_policy_handle_cache) { @@ -427,7 +427,7 @@ WERROR NetGroupSetInfo_r(struct libnetapi_ctx *ctx, init_lsa_String(&lsa_group_name, r->in.group_name); - status = rpccli_samr_LookupNames(pipe_cli, ctx, + status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(), &domain_handle, 1, &lsa_group_name, @@ -443,7 +443,7 @@ WERROR NetGroupSetInfo_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_samr_OpenGroup(pipe_cli, ctx, + status = rpccli_samr_OpenGroup(pipe_cli, talloc_tos(), &domain_handle, SAMR_GROUP_ACCESS_SET_INFO | SAMR_GROUP_ACCESS_LOOKUP_INFO, @@ -458,7 +458,7 @@ WERROR NetGroupSetInfo_r(struct libnetapi_ctx *ctx, case 0: g0 = (struct GROUP_INFO_0 *)r->in.buffer; init_lsa_String(&info.name, g0->grpi0_name); - status = rpccli_samr_SetGroupInfo(pipe_cli, ctx, + status = rpccli_samr_SetGroupInfo(pipe_cli, talloc_tos(), &group_handle, GROUPINFONAME, &info); @@ -466,7 +466,7 @@ WERROR NetGroupSetInfo_r(struct libnetapi_ctx *ctx, case 1: g1 = (struct GROUP_INFO_1 *)r->in.buffer; init_lsa_String(&info.description, g1->grpi1_comment); - status = rpccli_samr_SetGroupInfo(pipe_cli, ctx, + status = rpccli_samr_SetGroupInfo(pipe_cli, talloc_tos(), &group_handle, GROUPINFODESCRIPTION, &info); @@ -474,7 +474,7 @@ WERROR NetGroupSetInfo_r(struct libnetapi_ctx *ctx, case 2: g2 = (struct GROUP_INFO_2 *)r->in.buffer; init_lsa_String(&info.description, g2->grpi2_comment); - status = rpccli_samr_SetGroupInfo(pipe_cli, ctx, + status = rpccli_samr_SetGroupInfo(pipe_cli, talloc_tos(), &group_handle, GROUPINFODESCRIPTION, &info); @@ -483,7 +483,7 @@ WERROR NetGroupSetInfo_r(struct libnetapi_ctx *ctx, goto done; } info.attributes.attributes = g2->grpi2_attributes; - status = rpccli_samr_SetGroupInfo(pipe_cli, ctx, + status = rpccli_samr_SetGroupInfo(pipe_cli, talloc_tos(), &group_handle, GROUPINFOATTRIBUTES, &info); @@ -491,7 +491,7 @@ WERROR NetGroupSetInfo_r(struct libnetapi_ctx *ctx, case 3: g3 = (struct GROUP_INFO_3 *)r->in.buffer; init_lsa_String(&info.description, g3->grpi3_comment); - status = rpccli_samr_SetGroupInfo(pipe_cli, ctx, + status = rpccli_samr_SetGroupInfo(pipe_cli, talloc_tos(), &group_handle, GROUPINFODESCRIPTION, &info); @@ -500,7 +500,7 @@ WERROR NetGroupSetInfo_r(struct libnetapi_ctx *ctx, goto done; } info.attributes.attributes = g3->grpi3_attributes; - status = rpccli_samr_SetGroupInfo(pipe_cli, ctx, + status = rpccli_samr_SetGroupInfo(pipe_cli, talloc_tos(), &group_handle, GROUPINFOATTRIBUTES, &info); @@ -508,7 +508,7 @@ WERROR NetGroupSetInfo_r(struct libnetapi_ctx *ctx, case 1002: g1002 = (struct GROUP_INFO_1002 *)r->in.buffer; init_lsa_String(&info.description, g1002->grpi1002_comment); - status = rpccli_samr_SetGroupInfo(pipe_cli, ctx, + status = rpccli_samr_SetGroupInfo(pipe_cli, talloc_tos(), &group_handle, GROUPINFODESCRIPTION, &info); @@ -516,7 +516,7 @@ WERROR NetGroupSetInfo_r(struct libnetapi_ctx *ctx, case 1005: g1005 = (struct GROUP_INFO_1005 *)r->in.buffer; info.attributes.attributes = g1005->grpi1005_attributes; - status = rpccli_samr_SetGroupInfo(pipe_cli, ctx, + status = rpccli_samr_SetGroupInfo(pipe_cli, talloc_tos(), &group_handle, GROUPINFOATTRIBUTES, &info); @@ -535,7 +535,7 @@ WERROR NetGroupSetInfo_r(struct libnetapi_ctx *ctx, done: if (is_valid_policy_hnd(&group_handle)) { - rpccli_samr_Close(pipe_cli, ctx, &group_handle); + rpccli_samr_Close(pipe_cli, talloc_tos(), &group_handle); } if (ctx->disable_policy_handle_cache) { @@ -662,7 +662,7 @@ WERROR NetGroupGetInfo_r(struct libnetapi_ctx *ctx, init_lsa_String(&lsa_group_name, r->in.group_name); - status = rpccli_samr_LookupNames(pipe_cli, ctx, + status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(), &domain_handle, 1, &lsa_group_name, @@ -678,7 +678,7 @@ WERROR NetGroupGetInfo_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_samr_OpenGroup(pipe_cli, ctx, + status = rpccli_samr_OpenGroup(pipe_cli, talloc_tos(), &domain_handle, SAMR_GROUP_ACCESS_LOOKUP_INFO, rids.ids[0], @@ -688,12 +688,12 @@ WERROR NetGroupGetInfo_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_samr_QueryGroupInfo(pipe_cli, ctx, + status = rpccli_samr_QueryGroupInfo(pipe_cli, talloc_tos(), &group_handle, GROUPINFOALL2, &info); if (NT_STATUS_EQUAL(status, NT_STATUS_INVALID_INFO_CLASS)) { - status = rpccli_samr_QueryGroupInfo(pipe_cli, ctx, + status = rpccli_samr_QueryGroupInfo(pipe_cli, talloc_tos(), &group_handle, GROUPINFOALL, &info); @@ -714,7 +714,7 @@ WERROR NetGroupGetInfo_r(struct libnetapi_ctx *ctx, } done: if (is_valid_policy_hnd(&group_handle)) { - rpccli_samr_Close(pipe_cli, ctx, &group_handle); + rpccli_samr_Close(pipe_cli, talloc_tos(), &group_handle); } if (ctx->disable_policy_handle_cache) { @@ -778,7 +778,7 @@ WERROR NetGroupAddUser_r(struct libnetapi_ctx *ctx, init_lsa_String(&lsa_group_name, r->in.group_name); - status = rpccli_samr_LookupNames(pipe_cli, ctx, + status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(), &domain_handle, 1, &lsa_group_name, @@ -794,7 +794,7 @@ WERROR NetGroupAddUser_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_samr_OpenGroup(pipe_cli, ctx, + status = rpccli_samr_OpenGroup(pipe_cli, talloc_tos(), &domain_handle, SAMR_GROUP_ACCESS_ADD_MEMBER, rids.ids[0], @@ -806,7 +806,7 @@ WERROR NetGroupAddUser_r(struct libnetapi_ctx *ctx, init_lsa_String(&lsa_user_name, r->in.user_name); - status = rpccli_samr_LookupNames(pipe_cli, ctx, + status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(), &domain_handle, 1, &lsa_user_name, @@ -822,7 +822,7 @@ WERROR NetGroupAddUser_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_samr_AddGroupMember(pipe_cli, ctx, + status = rpccli_samr_AddGroupMember(pipe_cli, talloc_tos(), &group_handle, rids.ids[0], 7); /* why ? */ @@ -835,7 +835,7 @@ WERROR NetGroupAddUser_r(struct libnetapi_ctx *ctx, done: if (is_valid_policy_hnd(&group_handle)) { - rpccli_samr_Close(pipe_cli, ctx, &group_handle); + rpccli_samr_Close(pipe_cli, talloc_tos(), &group_handle); } if (ctx->disable_policy_handle_cache) { @@ -899,7 +899,7 @@ WERROR NetGroupDelUser_r(struct libnetapi_ctx *ctx, init_lsa_String(&lsa_group_name, r->in.group_name); - status = rpccli_samr_LookupNames(pipe_cli, ctx, + status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(), &domain_handle, 1, &lsa_group_name, @@ -915,7 +915,7 @@ WERROR NetGroupDelUser_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_samr_OpenGroup(pipe_cli, ctx, + status = rpccli_samr_OpenGroup(pipe_cli, talloc_tos(), &domain_handle, SAMR_GROUP_ACCESS_REMOVE_MEMBER, rids.ids[0], @@ -927,7 +927,7 @@ WERROR NetGroupDelUser_r(struct libnetapi_ctx *ctx, init_lsa_String(&lsa_user_name, r->in.user_name); - status = rpccli_samr_LookupNames(pipe_cli, ctx, + status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(), &domain_handle, 1, &lsa_user_name, @@ -943,7 +943,7 @@ WERROR NetGroupDelUser_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_samr_DeleteGroupMember(pipe_cli, ctx, + status = rpccli_samr_DeleteGroupMember(pipe_cli, talloc_tos(), &group_handle, rids.ids[0]); if (!NT_STATUS_IS_OK(status)) { @@ -955,7 +955,7 @@ WERROR NetGroupDelUser_r(struct libnetapi_ctx *ctx, done: if (is_valid_policy_hnd(&group_handle)) { - rpccli_samr_Close(pipe_cli, ctx, &group_handle); + rpccli_samr_Close(pipe_cli, talloc_tos(), &group_handle); } if (ctx->disable_policy_handle_cache) { @@ -1177,7 +1177,7 @@ WERROR NetGroupEnum_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_samr_QueryDomainInfo(pipe_cli, ctx, + status = rpccli_samr_QueryDomainInfo(pipe_cli, talloc_tos(), &domain_handle, 2, &domain_info); @@ -1308,7 +1308,7 @@ WERROR NetGroupGetUsers_r(struct libnetapi_ctx *ctx, init_lsa_String(&lsa_account_name, r->in.group_name); - status = rpccli_samr_LookupNames(pipe_cli, ctx, + status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(), &domain_handle, 1, &lsa_account_name, @@ -1319,7 +1319,7 @@ WERROR NetGroupGetUsers_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_samr_OpenGroup(pipe_cli, ctx, + status = rpccli_samr_OpenGroup(pipe_cli, talloc_tos(), &domain_handle, SAMR_GROUP_ACCESS_GET_MEMBERS, group_rids.ids[0], @@ -1329,7 +1329,7 @@ WERROR NetGroupGetUsers_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_samr_QueryGroupMember(pipe_cli, ctx, + status = rpccli_samr_QueryGroupMember(pipe_cli, talloc_tos(), &group_handle, &rid_array); if (!NT_STATUS_IS_OK(status)) { @@ -1337,7 +1337,7 @@ WERROR NetGroupGetUsers_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_samr_LookupRids(pipe_cli, ctx, + status = rpccli_samr_LookupRids(pipe_cli, talloc_tos(), &domain_handle, rid_array->count, rid_array->rids, @@ -1373,7 +1373,7 @@ WERROR NetGroupGetUsers_r(struct libnetapi_ctx *ctx, done: if (is_valid_policy_hnd(&group_handle)) { - rpccli_samr_Close(pipe_cli, ctx, &group_handle); + rpccli_samr_Close(pipe_cli, talloc_tos(), &group_handle); } if (ctx->disable_policy_handle_cache) { @@ -1460,7 +1460,7 @@ WERROR NetGroupSetUsers_r(struct libnetapi_ctx *ctx, init_lsa_String(&lsa_account_name, r->in.group_name); - status = rpccli_samr_LookupNames(pipe_cli, ctx, + status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(), &domain_handle, 1, &lsa_account_name, @@ -1471,7 +1471,7 @@ WERROR NetGroupSetUsers_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_samr_OpenGroup(pipe_cli, ctx, + status = rpccli_samr_OpenGroup(pipe_cli, talloc_tos(), &domain_handle, SAMR_GROUP_ACCESS_GET_MEMBERS | SAMR_GROUP_ACCESS_ADD_MEMBER | @@ -1484,7 +1484,7 @@ WERROR NetGroupSetUsers_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_samr_QueryGroupInfo(pipe_cli, ctx, + status = rpccli_samr_QueryGroupInfo(pipe_cli, talloc_tos(), &group_handle, GROUPINFOATTRIBUTES, &group_info); @@ -1522,7 +1522,7 @@ WERROR NetGroupSetUsers_r(struct libnetapi_ctx *ctx, } } - status = rpccli_samr_LookupNames(pipe_cli, ctx, + status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(), &domain_handle, r->in.num_entries, lsa_names, @@ -1536,7 +1536,7 @@ WERROR NetGroupSetUsers_r(struct libnetapi_ctx *ctx, member_rids = user_rids.ids; num_member_rids = user_rids.count; - status = rpccli_samr_QueryGroupMember(pipe_cli, ctx, + status = rpccli_samr_QueryGroupMember(pipe_cli, talloc_tos(), &group_handle, &rid_array); if (!NT_STATUS_IS_OK(status)) { @@ -1587,7 +1587,7 @@ WERROR NetGroupSetUsers_r(struct libnetapi_ctx *ctx, /* add list */ for (i=0; i < num_add_rids; i++) { - status = rpccli_samr_AddGroupMember(pipe_cli, ctx, + status = rpccli_samr_AddGroupMember(pipe_cli, talloc_tos(), &group_handle, add_rids[i], 7 /* ? */); @@ -1600,7 +1600,7 @@ WERROR NetGroupSetUsers_r(struct libnetapi_ctx *ctx, /* del list */ for (i=0; i < num_del_rids; i++) { - status = rpccli_samr_DeleteGroupMember(pipe_cli, ctx, + status = rpccli_samr_DeleteGroupMember(pipe_cli, talloc_tos(), &group_handle, del_rids[i]); if (!NT_STATUS_IS_OK(status)) { @@ -1613,7 +1613,7 @@ WERROR NetGroupSetUsers_r(struct libnetapi_ctx *ctx, done: if (is_valid_policy_hnd(&group_handle)) { - rpccli_samr_Close(pipe_cli, ctx, &group_handle); + rpccli_samr_Close(pipe_cli, talloc_tos(), &group_handle); } if (ctx->disable_policy_handle_cache) { diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c index 4936d77..8adca11 100644 --- a/source3/lib/netapi/joindomain.c +++ b/source3/lib/netapi/joindomain.c @@ -122,7 +122,7 @@ WERROR NetJoinDomain_r(struct libnetapi_ctx *ctx, old_timeout = rpccli_set_timeout(pipe_cli, 600000); - status = rpccli_wkssvc_NetrJoinDomain2(pipe_cli, ctx, + status = rpccli_wkssvc_NetrJoinDomain2(pipe_cli, talloc_tos(), r->in.server, r->in.domain, r->in.account_ou, @@ -248,7 +248,7 @@ WERROR NetUnjoinDomain_r(struct libnetapi_ctx *ctx, old_timeout = rpccli_set_timeout(pipe_cli, 60000); - status = rpccli_wkssvc_NetrUnjoinDomain2(pipe_cli, ctx, + status = rpccli_wkssvc_NetrUnjoinDomain2(pipe_cli, talloc_tos(), r->in.server_name, r->in.account, encrypted_password, @@ -285,7 +285,7 @@ WERROR NetGetJoinInformation_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_wkssvc_NetrGetJoinInformation(pipe_cli, ctx, + status = rpccli_wkssvc_NetrGetJoinInformation(pipe_cli, talloc_tos(), r->in.server_name, &buffer, (enum wkssvc_NetJoinStatus *)r->out.name_type, @@ -422,7 +422,7 @@ WERROR NetGetJoinableOUs_r(struct libnetapi_ctx *ctx, &encrypted_password); } - status = rpccli_wkssvc_NetrGetJoinableOus2(pipe_cli, ctx, + status = rpccli_wkssvc_NetrGetJoinableOus2(pipe_cli, talloc_tos(), r->in.server_name, r->in.domain, r->in.account, @@ -464,7 +464,7 @@ WERROR NetRenameMachineInDomain_r(struct libnetapi_ctx *ctx, &encrypted_password); } - status = rpccli_wkssvc_NetrRenameMachineInDomain2(pipe_cli, ctx, + status = rpccli_wkssvc_NetrRenameMachineInDomain2(pipe_cli, talloc_tos(), r->in.server_name, r->in.new_machine_name, r->in.account, diff --git a/source3/lib/netapi/libnetapi.c b/source3/lib/netapi/libnetapi.c index 336ab26..e1e85aa 100644 --- a/source3/lib/netapi/libnetapi.c +++ b/source3/lib/netapi/libnetapi.c @@ -39,9 +39,11 @@ NET_API_STATUS NetJoinDomain(const char * server /* [in] [unique] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -71,6 +73,7 @@ NET_API_STATUS NetJoinDomain(const char * server /* [in] [unique] */, NDR_PRINT_OUT_DEBUG(NetJoinDomain, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -87,9 +90,11 @@ NET_API_STATUS NetUnjoinDomain(const char * server_name /* [in] [unique] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -117,6 +122,7 @@ NET_API_STATUS NetUnjoinDomain(const char * server_name /* [in] [unique] */, NDR_PRINT_OUT_DEBUG(NetUnjoinDomain, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -132,9 +138,11 @@ NET_API_STATUS NetGetJoinInformation(const char * server_name /* [in] [unique] * struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -161,6 +169,7 @@ NET_API_STATUS NetGetJoinInformation(const char * server_name /* [in] [unique] * NDR_PRINT_OUT_DEBUG(NetGetJoinInformation, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -179,9 +188,11 @@ NET_API_STATUS NetGetJoinableOUs(const char * server_name /* [in] [unique] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -211,6 +222,7 @@ NET_API_STATUS NetGetJoinableOUs(const char * server_name /* [in] [unique] */, NDR_PRINT_OUT_DEBUG(NetGetJoinableOUs, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -228,9 +240,11 @@ NET_API_STATUS NetRenameMachineInDomain(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -259,6 +273,7 @@ NET_API_STATUS NetRenameMachineInDomain(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetRenameMachineInDomain, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -274,9 +289,11 @@ NET_API_STATUS NetServerGetInfo(const char * server_name /* [in] [unique] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -303,6 +320,7 @@ NET_API_STATUS NetServerGetInfo(const char * server_name /* [in] [unique] */, NDR_PRINT_OUT_DEBUG(NetServerGetInfo, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -319,9 +337,11 @@ NET_API_STATUS NetServerSetInfo(const char * server_name /* [in] [unique] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -349,6 +369,7 @@ NET_API_STATUS NetServerSetInfo(const char * server_name /* [in] [unique] */, NDR_PRINT_OUT_DEBUG(NetServerSetInfo, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -364,9 +385,11 @@ NET_API_STATUS NetGetDCName(const char * server_name /* [in] [unique] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -393,6 +416,7 @@ NET_API_STATUS NetGetDCName(const char * server_name /* [in] [unique] */, NDR_PRINT_OUT_DEBUG(NetGetDCName, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -408,9 +432,11 @@ NET_API_STATUS NetGetAnyDCName(const char * server_name /* [in] [unique] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -437,6 +463,7 @@ NET_API_STATUS NetGetAnyDCName(const char * server_name /* [in] [unique] */, NDR_PRINT_OUT_DEBUG(NetGetAnyDCName, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -455,9 +482,11 @@ NET_API_STATUS DsGetDcName(const char * server_name /* [in] [unique] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -487,6 +516,7 @@ NET_API_STATUS DsGetDcName(const char * server_name /* [in] [unique] */, NDR_PRINT_OUT_DEBUG(DsGetDcName, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -503,9 +533,11 @@ NET_API_STATUS NetUserAdd(const char * server_name /* [in] [unique] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -533,6 +565,7 @@ NET_API_STATUS NetUserAdd(const char * server_name /* [in] [unique] */, NDR_PRINT_OUT_DEBUG(NetUserAdd, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -547,9 +580,11 @@ NET_API_STATUS NetUserDel(const char * server_name /* [in] [unique] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -575,6 +610,7 @@ NET_API_STATUS NetUserDel(const char * server_name /* [in] [unique] */, NDR_PRINT_OUT_DEBUG(NetUserDel, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -595,9 +631,11 @@ NET_API_STATUS NetUserEnum(const char * server_name /* [in] [unique] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -630,6 +668,7 @@ NET_API_STATUS NetUserEnum(const char * server_name /* [in] [unique] */, NDR_PRINT_OUT_DEBUG(NetUserEnum, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -646,9 +685,11 @@ NET_API_STATUS NetUserChangePassword(const char * domain_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -676,6 +717,7 @@ NET_API_STATUS NetUserChangePassword(const char * domain_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetUserChangePassword, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -692,9 +734,11 @@ NET_API_STATUS NetUserGetInfo(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -722,6 +766,7 @@ NET_API_STATUS NetUserGetInfo(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetUserGetInfo, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -739,9 +784,11 @@ NET_API_STATUS NetUserSetInfo(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -770,6 +817,7 @@ NET_API_STATUS NetUserSetInfo(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetUserSetInfo, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -789,9 +837,11 @@ NET_API_STATUS NetUserGetGroups(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -822,6 +872,7 @@ NET_API_STATUS NetUserGetGroups(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetUserGetGroups, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -839,9 +890,11 @@ NET_API_STATUS NetUserSetGroups(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -870,6 +923,7 @@ NET_API_STATUS NetUserSetGroups(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetUserSetGroups, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -890,9 +944,11 @@ NET_API_STATUS NetUserGetLocalGroups(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -924,6 +980,7 @@ NET_API_STATUS NetUserGetLocalGroups(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetUserGetLocalGroups, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -939,9 +996,11 @@ NET_API_STATUS NetUserModalsGet(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -968,6 +1027,7 @@ NET_API_STATUS NetUserModalsGet(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetUserModalsGet, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -984,9 +1044,11 @@ NET_API_STATUS NetUserModalsSet(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -1014,6 +1076,7 @@ NET_API_STATUS NetUserModalsSet(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetUserModalsSet, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -1033,9 +1096,11 @@ NET_API_STATUS NetQueryDisplayInformation(const char * server_name /* [in] [uniq struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -1066,6 +1131,7 @@ NET_API_STATUS NetQueryDisplayInformation(const char * server_name /* [in] [uniq NDR_PRINT_OUT_DEBUG(NetQueryDisplayInformation, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -1082,9 +1148,11 @@ NET_API_STATUS NetGroupAdd(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -1112,6 +1180,7 @@ NET_API_STATUS NetGroupAdd(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetGroupAdd, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -1126,9 +1195,11 @@ NET_API_STATUS NetGroupDel(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -1154,6 +1225,7 @@ NET_API_STATUS NetGroupDel(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetGroupDel, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -1173,9 +1245,11 @@ NET_API_STATUS NetGroupEnum(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -1207,6 +1281,7 @@ NET_API_STATUS NetGroupEnum(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetGroupEnum, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -1224,9 +1299,11 @@ NET_API_STATUS NetGroupSetInfo(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -1255,6 +1332,7 @@ NET_API_STATUS NetGroupSetInfo(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetGroupSetInfo, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -1271,9 +1349,11 @@ NET_API_STATUS NetGroupGetInfo(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -1301,6 +1381,7 @@ NET_API_STATUS NetGroupGetInfo(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetGroupGetInfo, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -1316,9 +1397,11 @@ NET_API_STATUS NetGroupAddUser(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -1345,6 +1428,7 @@ NET_API_STATUS NetGroupAddUser(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetGroupAddUser, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -1360,9 +1444,11 @@ NET_API_STATUS NetGroupDelUser(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -1389,6 +1475,7 @@ NET_API_STATUS NetGroupDelUser(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetGroupDelUser, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -1409,9 +1496,11 @@ NET_API_STATUS NetGroupGetUsers(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -1444,6 +1533,7 @@ NET_API_STATUS NetGroupGetUsers(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetGroupGetUsers, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -1461,9 +1551,11 @@ NET_API_STATUS NetGroupSetUsers(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -1492,6 +1584,7 @@ NET_API_STATUS NetGroupSetUsers(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetGroupSetUsers, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -1508,9 +1601,11 @@ NET_API_STATUS NetLocalGroupAdd(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -1538,6 +1633,7 @@ NET_API_STATUS NetLocalGroupAdd(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetLocalGroupAdd, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -1552,9 +1648,11 @@ NET_API_STATUS NetLocalGroupDel(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -1580,6 +1678,7 @@ NET_API_STATUS NetLocalGroupDel(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetLocalGroupDel, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -1596,9 +1695,11 @@ NET_API_STATUS NetLocalGroupGetInfo(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -1626,6 +1727,7 @@ NET_API_STATUS NetLocalGroupGetInfo(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetLocalGroupGetInfo, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -1643,9 +1745,11 @@ NET_API_STATUS NetLocalGroupSetInfo(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -1674,6 +1778,7 @@ NET_API_STATUS NetLocalGroupSetInfo(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetLocalGroupSetInfo, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -1693,9 +1798,11 @@ NET_API_STATUS NetLocalGroupEnum(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -1727,6 +1834,7 @@ NET_API_STATUS NetLocalGroupEnum(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetLocalGroupEnum, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -1744,9 +1852,11 @@ NET_API_STATUS NetLocalGroupAddMembers(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -1775,6 +1885,7 @@ NET_API_STATUS NetLocalGroupAddMembers(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetLocalGroupAddMembers, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -1792,9 +1903,11 @@ NET_API_STATUS NetLocalGroupDelMembers(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -1823,6 +1936,7 @@ NET_API_STATUS NetLocalGroupDelMembers(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetLocalGroupDelMembers, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -1843,9 +1957,11 @@ NET_API_STATUS NetLocalGroupGetMembers(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -1878,6 +1994,7 @@ NET_API_STATUS NetLocalGroupGetMembers(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetLocalGroupGetMembers, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -1895,9 +2012,11 @@ NET_API_STATUS NetLocalGroupSetMembers(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -1926,6 +2045,7 @@ NET_API_STATUS NetLocalGroupSetMembers(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetLocalGroupSetMembers, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -1940,9 +2060,11 @@ NET_API_STATUS NetRemoteTOD(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -1968,6 +2090,7 @@ NET_API_STATUS NetRemoteTOD(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetRemoteTOD, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -1984,9 +2107,11 @@ NET_API_STATUS NetShareAdd(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -2014,6 +2139,7 @@ NET_API_STATUS NetShareAdd(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetShareAdd, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -2029,9 +2155,11 @@ NET_API_STATUS NetShareDel(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -2058,6 +2186,7 @@ NET_API_STATUS NetShareDel(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetShareDel, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -2077,9 +2206,11 @@ NET_API_STATUS NetShareEnum(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -2111,6 +2242,7 @@ NET_API_STATUS NetShareEnum(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetShareEnum, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -2127,9 +2259,11 @@ NET_API_STATUS NetShareGetInfo(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -2157,6 +2291,7 @@ NET_API_STATUS NetShareGetInfo(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetShareGetInfo, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -2174,9 +2309,11 @@ NET_API_STATUS NetShareSetInfo(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -2205,6 +2342,7 @@ NET_API_STATUS NetShareSetInfo(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetShareSetInfo, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -2219,9 +2357,11 @@ NET_API_STATUS NetFileClose(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -2247,6 +2387,7 @@ NET_API_STATUS NetFileClose(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetFileClose, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -2263,9 +2404,11 @@ NET_API_STATUS NetFileGetInfo(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -2293,6 +2436,7 @@ NET_API_STATUS NetFileGetInfo(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetFileGetInfo, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -2314,9 +2458,11 @@ NET_API_STATUS NetFileEnum(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -2350,6 +2496,7 @@ NET_API_STATUS NetFileEnum(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetFileEnum, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -2367,9 +2514,11 @@ NET_API_STATUS NetShutdownInit(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -2398,6 +2547,7 @@ NET_API_STATUS NetShutdownInit(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(NetShutdownInit, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -2411,9 +2561,11 @@ NET_API_STATUS NetShutdownAbort(const char * server_name /* [in] */) struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -2438,6 +2590,7 @@ NET_API_STATUS NetShutdownAbort(const char * server_name /* [in] */) NDR_PRINT_OUT_DEBUG(NetShutdownAbort, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -2454,9 +2607,11 @@ NET_API_STATUS I_NetLogonControl(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -2484,6 +2639,7 @@ NET_API_STATUS I_NetLogonControl(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(I_NetLogonControl, &r); } + TALLOC_FREE(frame); return r.out.result; } @@ -2501,9 +2657,11 @@ NET_API_STATUS I_NetLogonControl2(const char * server_name /* [in] */, struct libnetapi_ctx *ctx = NULL; NET_API_STATUS status; WERROR werr; + TALLOC_CTX *frame = talloc_stackframe(); status = libnetapi_getctx(&ctx); if (status != 0) { + TALLOC_FREE(frame); return status; } @@ -2532,6 +2690,7 @@ NET_API_STATUS I_NetLogonControl2(const char * server_name /* [in] */, NDR_PRINT_OUT_DEBUG(I_NetLogonControl2, &r); } + TALLOC_FREE(frame); return r.out.result; } diff --git a/source3/lib/netapi/localgroup.c b/source3/lib/netapi/localgroup.c index b9c0b4c..03f9da5 100644 --- a/source3/lib/netapi/localgroup.c +++ b/source3/lib/netapi/localgroup.c @@ -196,7 +196,7 @@ WERROR NetLocalGroupAdd_r(struct libnetapi_ctx *ctx, init_lsa_String(&lsa_account_name, alias_name); - status = rpccli_samr_CreateDomAlias(pipe_cli, ctx, + status = rpccli_samr_CreateDomAlias(pipe_cli, talloc_tos(), &domain_handle, &lsa_account_name, SEC_STD_DELETE | @@ -214,7 +214,7 @@ WERROR NetLocalGroupAdd_r(struct libnetapi_ctx *ctx, init_lsa_String(&alias_info.description, info1->lgrpi1_comment); - status = rpccli_samr_SetAliasInfo(pipe_cli, ctx, + status = rpccli_samr_SetAliasInfo(pipe_cli, talloc_tos(), &alias_handle, ALIASINFODESCRIPTION, &alias_info); @@ -228,7 +228,7 @@ WERROR NetLocalGroupAdd_r(struct libnetapi_ctx *ctx, done: if (is_valid_policy_hnd(&alias_handle)) { - rpccli_samr_Close(pipe_cli, ctx, &alias_handle); + rpccli_samr_Close(pipe_cli, talloc_tos(), &alias_handle); } if (ctx->disable_policy_handle_cache) { @@ -331,7 +331,7 @@ WERROR NetLocalGroupDel_r(struct libnetapi_ctx *ctx, delete_alias: - status = rpccli_samr_DeleteDomAlias(pipe_cli, ctx, + status = rpccli_samr_DeleteDomAlias(pipe_cli, talloc_tos(), &alias_handle); if (!NT_STATUS_IS_OK(status)) { werr = ntstatus_to_werror(status); @@ -344,7 +344,7 @@ WERROR NetLocalGroupDel_r(struct libnetapi_ctx *ctx, done: if (is_valid_policy_hnd(&alias_handle)) { - rpccli_samr_Close(pipe_cli, ctx, &alias_handle); + rpccli_samr_Close(pipe_cli, talloc_tos(), &alias_handle); } if (ctx->disable_policy_handle_cache) { @@ -502,7 +502,7 @@ WERROR NetLocalGroupGetInfo_r(struct libnetapi_ctx *ctx, } query_alias: - status = rpccli_samr_QueryAliasInfo(pipe_cli, ctx, + status = rpccli_samr_QueryAliasInfo(pipe_cli, talloc_tos(), &alias_handle, ALIASINFOALL, &alias_info); @@ -519,7 +519,7 @@ WERROR NetLocalGroupGetInfo_r(struct libnetapi_ctx *ctx, done: if (is_valid_policy_hnd(&alias_handle)) { - rpccli_samr_Close(pipe_cli, ctx, &alias_handle); + rpccli_samr_Close(pipe_cli, talloc_tos(), &alias_handle); } if (ctx->disable_policy_handle_cache) { @@ -680,7 +680,7 @@ WERROR NetLocalGroupSetInfo_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_samr_SetAliasInfo(pipe_cli, ctx, + status = rpccli_samr_SetAliasInfo(pipe_cli, talloc_tos(), &alias_handle, alias_level, alias_info); @@ -693,7 +693,7 @@ WERROR NetLocalGroupSetInfo_r(struct libnetapi_ctx *ctx, done: if (is_valid_policy_hnd(&alias_handle)) { - rpccli_samr_Close(pipe_cli, ctx, &alias_handle); + rpccli_samr_Close(pipe_cli, talloc_tos(), &alias_handle); } if (ctx->disable_policy_handle_cache) { @@ -788,7 +788,7 @@ WERROR NetLocalGroupEnum_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_samr_QueryDomainInfo(pipe_cli, ctx, + status = rpccli_samr_QueryDomainInfo(pipe_cli, talloc_tos(), &builtin_handle, 2, &builtin_info); @@ -801,7 +801,7 @@ WERROR NetLocalGroupEnum_r(struct libnetapi_ctx *ctx, *r->out.total_entries += builtin_info->general.num_aliases; } - status = rpccli_samr_QueryDomainInfo(pipe_cli, ctx, + status = rpccli_samr_QueryDomainInfo(pipe_cli, talloc_tos(), &domain_handle, 2, &domain_info); @@ -814,7 +814,7 @@ WERROR NetLocalGroupEnum_r(struct libnetapi_ctx *ctx, *r->out.total_entries += domain_info->general.num_aliases; } - status = rpccli_samr_EnumDomainAliases(pipe_cli, ctx, + status = rpccli_samr_EnumDomainAliases(pipe_cli, talloc_tos(), &builtin_handle, r->in.resume_handle, &builtin_sam_array, @@ -850,7 +850,7 @@ WERROR NetLocalGroupEnum_r(struct libnetapi_ctx *ctx, r->out.buffer); } - status = rpccli_samr_EnumDomainAliases(pipe_cli, ctx, + status = rpccli_samr_EnumDomainAliases(pipe_cli, talloc_tos(), &domain_handle, r->in.resume_handle, &domain_sam_array, @@ -1156,7 +1156,7 @@ static WERROR NetLocalGroupModifyMembers_r(struct libnetapi_ctx *ctx, struct lsa_SidArray current_sids; - status = rpccli_samr_GetMembersInAlias(pipe_cli, ctx, + status = rpccli_samr_GetMembersInAlias(pipe_cli, talloc_tos(), &alias_handle, ¤t_sids); if (!NT_STATUS_IS_OK(status)) { @@ -1212,7 +1212,7 @@ static WERROR NetLocalGroupModifyMembers_r(struct libnetapi_ctx *ctx, /* add list */ for (i=0; i < num_add_sids; i++) { - status = rpccli_samr_AddAliasMember(pipe_cli, ctx, + status = rpccli_samr_AddAliasMember(pipe_cli, talloc_tos(), &alias_handle, &add_sids[i]); if (!NT_STATUS_IS_OK(status)) { @@ -1224,7 +1224,7 @@ static WERROR NetLocalGroupModifyMembers_r(struct libnetapi_ctx *ctx, /* del list */ for (i=0; i < num_del_sids; i++) { - status = rpccli_samr_DeleteAliasMember(pipe_cli, ctx, + status = rpccli_samr_DeleteAliasMember(pipe_cli, talloc_tos(), &alias_handle, &del_sids[i]); if (!NT_STATUS_IS_OK(status)) { @@ -1237,7 +1237,7 @@ static WERROR NetLocalGroupModifyMembers_r(struct libnetapi_ctx *ctx, done: if (is_valid_policy_hnd(&alias_handle)) { - rpccli_samr_Close(pipe_cli, ctx, &alias_handle); + rpccli_samr_Close(pipe_cli, talloc_tos(), &alias_handle); } if (ctx->disable_policy_handle_cache) { diff --git a/source3/lib/netapi/netlogon.c b/source3/lib/netapi/netlogon.c index 54b9709..8ca7592 100644 --- a/source3/lib/netapi/netlogon.c +++ b/source3/lib/netapi/netlogon.c @@ -136,7 +136,7 @@ WERROR I_NetLogonControl_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_netr_LogonControl(pipe_cli, ctx, + status = rpccli_netr_LogonControl(pipe_cli, talloc_tos(), r->in.server_name, r->in.function_code, r->in.query_level, @@ -193,7 +193,7 @@ WERROR I_NetLogonControl2_r(struct libnetapi_ctx *ctx, switch (r->in.function_code) { case NETLOGON_CONTROL_TC_VERIFY: case NETLOGON_CONTROL_SET_DBFLAG: - status = rpccli_netr_LogonControl2Ex(pipe_cli, ctx, + status = rpccli_netr_LogonControl2Ex(pipe_cli, talloc_tos(), r->in.server_name, r->in.function_code, r->in.query_level, @@ -202,7 +202,7 @@ WERROR I_NetLogonControl2_r(struct libnetapi_ctx *ctx, &werr); break; default: - status = rpccli_netr_LogonControl2(pipe_cli, ctx, + status = rpccli_netr_LogonControl2(pipe_cli, talloc_tos(), r->in.server_name, r->in.function_code, r->in.query_level, diff --git a/source3/lib/netapi/serverinfo.c b/source3/lib/netapi/serverinfo.c index f537802..60c9751 100644 --- a/source3/lib/netapi/serverinfo.c +++ b/source3/lib/netapi/serverinfo.c @@ -508,7 +508,7 @@ WERROR NetServerGetInfo_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_srvsvc_NetSrvGetInfo(pipe_cli, ctx, + status = rpccli_srvsvc_NetSrvGetInfo(pipe_cli, talloc_tos(), r->in.server_name, r->in.level, &info, @@ -614,7 +614,7 @@ WERROR NetServerSetInfo_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_srvsvc_NetSrvSetInfo(pipe_cli, ctx, + status = rpccli_srvsvc_NetSrvSetInfo(pipe_cli, talloc_tos(), r->in.server_name, r->in.level, &info, @@ -647,7 +647,7 @@ WERROR NetRemoteTOD_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_srvsvc_NetRemoteTOD(pipe_cli, ctx, + status = rpccli_srvsvc_NetRemoteTOD(pipe_cli, talloc_tos(), r->in.server_name, &info, &werr); diff --git a/source3/lib/netapi/share.c b/source3/lib/netapi/share.c index 65bcd9a..4232a9e 100644 --- a/source3/lib/netapi/share.c +++ b/source3/lib/netapi/share.c @@ -215,7 +215,7 @@ WERROR NetShareAdd_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_srvsvc_NetShareAdd(pipe_cli, ctx, + status = rpccli_srvsvc_NetShareAdd(pipe_cli, talloc_tos(), r->in.server_name, r->in.level, &info, @@ -259,7 +259,7 @@ WERROR NetShareDel_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_srvsvc_NetShareDel(pipe_cli, ctx, + status = rpccli_srvsvc_NetShareDel(pipe_cli, talloc_tos(), r->in.server_name, r->in.net_name, r->in.reserved, @@ -338,7 +338,7 @@ WERROR NetShareEnum_r(struct libnetapi_ctx *ctx, break; } - status = rpccli_srvsvc_NetShareEnumAll(pipe_cli, ctx, + status = rpccli_srvsvc_NetShareEnumAll(pipe_cli, talloc_tos(), r->in.server_name, &info_ctr, r->in.prefmaxlen, @@ -423,7 +423,7 @@ WERROR NetShareGetInfo_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_srvsvc_NetShareGetInfo(pipe_cli, ctx, + status = rpccli_srvsvc_NetShareGetInfo(pipe_cli, talloc_tos(), r->in.server_name, r->in.net_name, r->in.level, @@ -502,7 +502,7 @@ WERROR NetShareSetInfo_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_srvsvc_NetShareSetInfo(pipe_cli, ctx, + status = rpccli_srvsvc_NetShareSetInfo(pipe_cli, talloc_tos(), r->in.server_name, r->in.net_name, r->in.level, diff --git a/source3/lib/netapi/shutdown.c b/source3/lib/netapi/shutdown.c index 4c274d6..977e192 100644 --- a/source3/lib/netapi/shutdown.c +++ b/source3/lib/netapi/shutdown.c @@ -45,7 +45,7 @@ WERROR NetShutdownInit_r(struct libnetapi_ctx *ctx, init_lsa_StringLarge(&message, r->in.message); - status = rpccli_initshutdown_Init(pipe_cli, ctx, + status = rpccli_initshutdown_Init(pipe_cli, talloc_tos(), NULL, &message, r->in.timeout, @@ -87,7 +87,7 @@ WERROR NetShutdownAbort_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_initshutdown_Abort(pipe_cli, ctx, + status = rpccli_initshutdown_Abort(pipe_cli, talloc_tos(), NULL, &werr); if (!NT_STATUS_IS_OK(status)) { diff --git a/source3/lib/netapi/user.c b/source3/lib/netapi/user.c index 1ad4a6f..e870ffd 100644 --- a/source3/lib/netapi/user.c +++ b/source3/lib/netapi/user.c @@ -313,7 +313,7 @@ static NTSTATUS set_user_info_USER_INFO_X(TALLOC_CTX *ctx, session_key, &user_info.info25.password); - status = rpccli_samr_SetUserInfo2(pipe_cli, ctx, + status = rpccli_samr_SetUserInfo2(pipe_cli, talloc_tos(), user_handle, 25, &user_info); @@ -326,7 +326,7 @@ static NTSTATUS set_user_info_USER_INFO_X(TALLOC_CTX *ctx, session_key, &user_info.info23.password); - status = rpccli_samr_SetUserInfo2(pipe_cli, ctx, + status = rpccli_samr_SetUserInfo2(pipe_cli, talloc_tos(), user_handle, 23, &user_info); @@ -335,7 +335,7 @@ static NTSTATUS set_user_info_USER_INFO_X(TALLOC_CTX *ctx, user_info.info21 = info21; - status = rpccli_samr_SetUserInfo(pipe_cli, ctx, + status = rpccli_samr_SetUserInfo(pipe_cli, talloc_tos(), user_handle, 21, &user_info); @@ -409,7 +409,7 @@ WERROR NetUserAdd_r(struct libnetapi_ctx *ctx, init_lsa_String(&lsa_account_name, uX.usriX_name); - status = rpccli_samr_CreateUser2(pipe_cli, ctx, + status = rpccli_samr_CreateUser2(pipe_cli, talloc_tos(), &domain_handle, &lsa_account_name, ACB_NORMAL, @@ -426,7 +426,7 @@ WERROR NetUserAdd_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_samr_QueryUserInfo(pipe_cli, ctx, + status = rpccli_samr_QueryUserInfo(pipe_cli, talloc_tos(), &user_handle, 16, &user_info); @@ -440,7 +440,7 @@ WERROR NetUserAdd_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_samr_GetUserPwInfo(pipe_cli, ctx, + status = rpccli_samr_GetUserPwInfo(pipe_cli, talloc_tos(), &user_handle, &pw_info); if (!NT_STATUS_IS_OK(status)) { @@ -463,12 +463,12 @@ WERROR NetUserAdd_r(struct libnetapi_ctx *ctx, goto done; failed: - rpccli_samr_DeleteUser(pipe_cli, ctx, + rpccli_samr_DeleteUser(pipe_cli, talloc_tos(), &user_handle); done: if (is_valid_policy_hnd(&user_handle) && pipe_cli) { - rpccli_samr_Close(pipe_cli, ctx, &user_handle); + rpccli_samr_Close(pipe_cli, talloc_tos(), &user_handle); } if (ctx->disable_policy_handle_cache) { @@ -527,7 +527,7 @@ WERROR NetUserDel_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_samr_OpenDomain(pipe_cli, ctx, + status = rpccli_samr_OpenDomain(pipe_cli, talloc_tos(), &connect_handle, SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT, CONST_DISCARD(DOM_SID *, &global_sid_Builtin), @@ -539,7 +539,7 @@ WERROR NetUserDel_r(struct libnetapi_ctx *ctx, init_lsa_String(&lsa_account_name, r->in.user_name); - status = rpccli_samr_LookupNames(pipe_cli, ctx, + status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(), &domain_handle, 1, &lsa_account_name, @@ -550,7 +550,7 @@ WERROR NetUserDel_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_samr_OpenUser(pipe_cli, ctx, + status = rpccli_samr_OpenUser(pipe_cli, talloc_tos(), &domain_handle, SEC_STD_DELETE, user_rids.ids[0], @@ -562,7 +562,7 @@ WERROR NetUserDel_r(struct libnetapi_ctx *ctx, sid_compose(&user_sid, domain_sid, user_rids.ids[0]); - status = rpccli_samr_RemoveMemberFromForeignDomain(pipe_cli, ctx, + status = rpccli_samr_RemoveMemberFromForeignDomain(pipe_cli, talloc_tos(), &builtin_handle, &user_sid); if (!NT_STATUS_IS_OK(status)) { @@ -570,7 +570,7 @@ WERROR NetUserDel_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_samr_DeleteUser(pipe_cli, ctx, + status = rpccli_samr_DeleteUser(pipe_cli, talloc_tos(), &user_handle); if (!NT_STATUS_IS_OK(status)) { werr = ntstatus_to_werror(status); @@ -581,7 +581,7 @@ WERROR NetUserDel_r(struct libnetapi_ctx *ctx, done: if (is_valid_policy_hnd(&user_handle)) { - rpccli_samr_Close(pipe_cli, ctx, &user_handle); + rpccli_samr_Close(pipe_cli, talloc_tos(), &user_handle); } if (ctx->disable_policy_handle_cache) { @@ -1671,7 +1671,7 @@ WERROR NetUserGetInfo_r(struct libnetapi_ctx *ctx, init_lsa_String(&lsa_account_name, r->in.user_name); - status = rpccli_samr_LookupNames(pipe_cli, ctx, + status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(), &domain_handle, 1, &lsa_account_name, @@ -1698,7 +1698,7 @@ WERROR NetUserGetInfo_r(struct libnetapi_ctx *ctx, done: if (is_valid_policy_hnd(&user_handle) && pipe_cli) { - rpccli_samr_Close(pipe_cli, ctx, &user_handle); + rpccli_samr_Close(pipe_cli, talloc_tos(), &user_handle); } if (ctx->disable_policy_handle_cache) { @@ -1826,7 +1826,7 @@ WERROR NetUserSetInfo_r(struct libnetapi_ctx *ctx, init_lsa_String(&lsa_account_name, r->in.user_name); - status = rpccli_samr_LookupNames(pipe_cli, ctx, + status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(), &domain_handle, 1, &lsa_account_name, @@ -1837,7 +1837,7 @@ WERROR NetUserSetInfo_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_samr_OpenUser(pipe_cli, ctx, + status = rpccli_samr_OpenUser(pipe_cli, talloc_tos(), &domain_handle, user_mask, user_rids.ids[0], @@ -1866,7 +1866,7 @@ WERROR NetUserSetInfo_r(struct libnetapi_ctx *ctx, done: if (is_valid_policy_hnd(&user_handle) && pipe_cli) { - rpccli_samr_Close(pipe_cli, ctx, &user_handle); + rpccli_samr_Close(pipe_cli, talloc_tos(), &user_handle); } if (ctx->disable_policy_handle_cache) { @@ -2845,7 +2845,7 @@ WERROR NetUserGetGroups_r(struct libnetapi_ctx *ctx, init_lsa_String(&lsa_account_name, r->in.user_name); - status = rpccli_samr_LookupNames(pipe_cli, ctx, + status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(), &domain_handle, 1, &lsa_account_name, @@ -2856,7 +2856,7 @@ WERROR NetUserGetGroups_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_samr_OpenUser(pipe_cli, ctx, + status = rpccli_samr_OpenUser(pipe_cli, talloc_tos(), &domain_handle, SAMR_USER_ACCESS_GET_GROUPS, user_rids.ids[0], @@ -2866,7 +2866,7 @@ WERROR NetUserGetGroups_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_samr_GetGroupsForUser(pipe_cli, ctx, + status = rpccli_samr_GetGroupsForUser(pipe_cli, talloc_tos(), &user_handle, &rid_array); if (!NT_STATUS_IS_OK(status)) { @@ -2884,7 +2884,7 @@ WERROR NetUserGetGroups_r(struct libnetapi_ctx *ctx, rids[i] = rid_array->rids[i].rid; } - status = rpccli_samr_LookupRids(pipe_cli, ctx, + status = rpccli_samr_LookupRids(pipe_cli, talloc_tos(), &domain_handle, rid_array->count, rids, @@ -2996,7 +2996,7 @@ WERROR NetUserSetGroups_r(struct libnetapi_ctx *ctx, init_lsa_String(&lsa_account_name, r->in.user_name); - status = rpccli_samr_LookupNames(pipe_cli, ctx, + status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(), &domain_handle, 1, &lsa_account_name, @@ -3007,7 +3007,7 @@ WERROR NetUserSetGroups_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_samr_OpenUser(pipe_cli, ctx, + status = rpccli_samr_OpenUser(pipe_cli, talloc_tos(), &domain_handle, SAMR_USER_ACCESS_GET_GROUPS, user_rids.ids[0], @@ -3046,7 +3046,7 @@ WERROR NetUserSetGroups_r(struct libnetapi_ctx *ctx, } } - status = rpccli_samr_LookupNames(pipe_cli, ctx, + status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(), &domain_handle, r->in.num_entries, lsa_names, @@ -3060,7 +3060,7 @@ WERROR NetUserSetGroups_r(struct libnetapi_ctx *ctx, member_rids = group_rids.ids; num_member_rids = group_rids.count; - status = rpccli_samr_GetGroupsForUser(pipe_cli, ctx, + status = rpccli_samr_GetGroupsForUser(pipe_cli, talloc_tos(), &user_handle, &rid_array); if (!NT_STATUS_IS_OK(status)) { @@ -3111,7 +3111,7 @@ WERROR NetUserSetGroups_r(struct libnetapi_ctx *ctx, /* add list */ for (i=0; i < num_add_rids; i++) { - status = rpccli_samr_OpenGroup(pipe_cli, ctx, + status = rpccli_samr_OpenGroup(pipe_cli, talloc_tos(), &domain_handle, SAMR_GROUP_ACCESS_ADD_MEMBER, add_rids[i], @@ -3121,7 +3121,7 @@ WERROR NetUserSetGroups_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_samr_AddGroupMember(pipe_cli, ctx, + status = rpccli_samr_AddGroupMember(pipe_cli, talloc_tos(), &group_handle, user_rids.ids[0], 7 /* ? */); @@ -3131,14 +3131,14 @@ WERROR NetUserSetGroups_r(struct libnetapi_ctx *ctx, } if (is_valid_policy_hnd(&group_handle)) { - rpccli_samr_Close(pipe_cli, ctx, &group_handle); + rpccli_samr_Close(pipe_cli, talloc_tos(), &group_handle); } } /* del list */ for (i=0; i < num_del_rids; i++) { - status = rpccli_samr_OpenGroup(pipe_cli, ctx, + status = rpccli_samr_OpenGroup(pipe_cli, talloc_tos(), &domain_handle, SAMR_GROUP_ACCESS_REMOVE_MEMBER, del_rids[i], @@ -3148,7 +3148,7 @@ WERROR NetUserSetGroups_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_samr_DeleteGroupMember(pipe_cli, ctx, + status = rpccli_samr_DeleteGroupMember(pipe_cli, talloc_tos(), &group_handle, user_rids.ids[0]); if (!NT_STATUS_IS_OK(status)) { @@ -3157,7 +3157,7 @@ WERROR NetUserSetGroups_r(struct libnetapi_ctx *ctx, } if (is_valid_policy_hnd(&group_handle)) { - rpccli_samr_Close(pipe_cli, ctx, &group_handle); + rpccli_samr_Close(pipe_cli, talloc_tos(), &group_handle); } } @@ -3165,7 +3165,7 @@ WERROR NetUserSetGroups_r(struct libnetapi_ctx *ctx, done: if (is_valid_policy_hnd(&group_handle)) { - rpccli_samr_Close(pipe_cli, ctx, &group_handle); + rpccli_samr_Close(pipe_cli, talloc_tos(), &group_handle); } if (ctx->disable_policy_handle_cache) { @@ -3290,7 +3290,7 @@ WERROR NetUserGetLocalGroups_r(struct libnetapi_ctx *ctx, init_lsa_String(&lsa_account_name, r->in.user_name); - status = rpccli_samr_LookupNames(pipe_cli, ctx, + status = rpccli_samr_LookupNames(pipe_cli, talloc_tos(), &domain_handle, 1, &lsa_account_name, @@ -3301,7 +3301,7 @@ WERROR NetUserGetLocalGroups_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_samr_OpenUser(pipe_cli, ctx, + status = rpccli_samr_OpenUser(pipe_cli, talloc_tos(), &domain_handle, SAMR_USER_ACCESS_GET_GROUPS, user_rids.ids[0], @@ -3311,7 +3311,7 @@ WERROR NetUserGetLocalGroups_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_samr_GetGroupsForUser(pipe_cli, ctx, + status = rpccli_samr_GetGroupsForUser(pipe_cli, talloc_tos(), &user_handle, &rid_array); if (!NT_STATUS_IS_OK(status)) { @@ -3352,7 +3352,7 @@ WERROR NetUserGetLocalGroups_r(struct libnetapi_ctx *ctx, } } - status = rpccli_samr_GetAliasMembership(pipe_cli, ctx, + status = rpccli_samr_GetAliasMembership(pipe_cli, talloc_tos(), &domain_handle, &sid_array, &domain_rids); @@ -3369,7 +3369,7 @@ WERROR NetUserGetLocalGroups_r(struct libnetapi_ctx *ctx, } } - status = rpccli_samr_GetAliasMembership(pipe_cli, ctx, + status = rpccli_samr_GetAliasMembership(pipe_cli, talloc_tos(), &builtin_handle, &sid_array, &builtin_rids); @@ -3386,7 +3386,7 @@ WERROR NetUserGetLocalGroups_r(struct libnetapi_ctx *ctx, } } - status = rpccli_samr_LookupRids(pipe_cli, ctx, + status = rpccli_samr_LookupRids(pipe_cli, talloc_tos(), &builtin_handle, num_rids, rids, -- 1.6.5.7