The branch, v3-5-test has been updated via c4421a2 s3: Attempt to fix bug 7665 from 8e46bff s3:librpc/ndr: use new strlen_m_ext_term() in ndr_charset_length(): fix bug #7594
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-5-test - Log ----------------------------------------------------------------- commit c4421a287c7e613c0c8da188a6ae8db37e90c8fc Author: Volker Lendecke <v...@samba.org> Date: Sat Oct 2 11:50:26 2010 +0200 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. ----------------------------------------------------------------------- Summary of changes: 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(-) Changeset truncated at 500 lines: 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 | -- Samba Shared Repository