The Samba-Bugzilla – Attachment 13988 Details for
Bug 13281
Use talloc_zero_array() in lsa lookup related functions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch for 4.8 cherry-picked from master
bug13281-v48.patch (text/plain), 6.12 KB, created by
Ralph Böhme
on 2018-02-27 10:14:46 UTC
(
hide
)
Description:
Patch for 4.8 cherry-picked from master
Filename:
MIME Type:
Creator:
Ralph Böhme
Created:
2018-02-27 10:14:46 UTC
Size:
6.12 KB
patch
obsolete
>From 05e2b09613f8fec2092ce8eb85514d970a57d8bf Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Fri, 2 Feb 2018 12:07:11 +0100 >Subject: [PATCH 1/3] s3:cli_lsarpc: use talloc_zero_array() in > dcerpc_lsa_lookup_sids_generic() > >It just feels better for such a complex function. > >Bug: https://bugzilla.samba.org/show_bug.cgi?id=13281 > >Signed-off-by: Stefan Metzmacher <metze@samba.org> >Reviewed-by: Ralph Boehme <slow@samba.org> >Reviewed-by: Andreas Schneider <asn@samba.org> >(cherry picked from commit 5cae7da1de302b38ee0059590b1e93a3d60ee42c) >--- > source3/rpc_client/cli_lsarpc.c | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > >diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c >index 65c6ca04d50..1dce7056385 100644 >--- a/source3/rpc_client/cli_lsarpc.c >+++ b/source3/rpc_client/cli_lsarpc.c >@@ -370,19 +370,22 @@ NTSTATUS dcerpc_lsa_lookup_sids_generic(struct dcerpc_binding_handle *h, > bool have_unmapped = false; > > if (num_sids) { >- if (!(domains = talloc_array(mem_ctx, char *, num_sids))) { >+ domains = talloc_zero_array(mem_ctx, char *, num_sids); >+ if (domains == NULL) { > DEBUG(0, ("rpccli_lsa_lookup_sids(): out of memory\n")); > status = NT_STATUS_NO_MEMORY; > goto fail; > } > >- if (!(names = talloc_array(mem_ctx, char *, num_sids))) { >+ names = talloc_zero_array(mem_ctx, char *, num_sids); >+ if (names == NULL) { > DEBUG(0, ("rpccli_lsa_lookup_sids(): out of memory\n")); > status = NT_STATUS_NO_MEMORY; > goto fail; > } > >- if (!(types = talloc_array(mem_ctx, enum lsa_SidType, num_sids))) { >+ types = talloc_zero_array(mem_ctx, enum lsa_SidType, num_sids); >+ if (types == NULL) { > DEBUG(0, ("rpccli_lsa_lookup_sids(): out of memory\n")); > status = NT_STATUS_NO_MEMORY; > goto fail; >-- >2.13.6 > > >From aed5d1ca68d62768a2e367547695a1d4f7fd9650 Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Fri, 2 Feb 2018 12:07:11 +0100 >Subject: [PATCH 2/3] s3:cli_lsarpc: use talloc_zero_array() in > dcerpc_lsa_lookup_names_generic() > >It just feels better for such a complex function. > >Bug: https://bugzilla.samba.org/show_bug.cgi?id=13281 > >Signed-off-by: Stefan Metzmacher <metze@samba.org> >Reviewed-by: Ralph Boehme <slow@samba.org> >Reviewed-by: Andreas Schneider <asn@samba.org> >(cherry picked from commit 569c910b950df24b22777c545fe9f6427a19b035) >--- > source3/rpc_client/cli_lsarpc.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > >diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c >index 1dce7056385..a093ee2572c 100644 >--- a/source3/rpc_client/cli_lsarpc.c >+++ b/source3/rpc_client/cli_lsarpc.c >@@ -638,20 +638,22 @@ NTSTATUS dcerpc_lsa_lookup_names_generic(struct dcerpc_binding_handle *h, > } > > if (num_names) { >- if (!((*sids = talloc_array(mem_ctx, struct dom_sid, num_names)))) { >+ *sids = talloc_zero_array(mem_ctx, struct dom_sid, num_names); >+ if (*sids == NULL) { > DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n")); > *presult = NT_STATUS_NO_MEMORY; > goto done; > } > >- if (!((*types = talloc_array(mem_ctx, enum lsa_SidType, num_names)))) { >+ *types = talloc_zero_array(mem_ctx, enum lsa_SidType, num_names); >+ if (*types == NULL) { > DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n")); > *presult = NT_STATUS_NO_MEMORY; > goto done; > } > > if (dom_names != NULL) { >- *dom_names = talloc_array(mem_ctx, const char *, num_names); >+ *dom_names = talloc_zero_array(mem_ctx, const char *, num_names); > if (*dom_names == NULL) { > DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n")); > *presult = NT_STATUS_NO_MEMORY; >-- >2.13.6 > > >From bdeb981dc4065adb8de33fcd2c9083e0a76c8a49 Mon Sep 17 00:00:00 2001 >From: Stefan Metzmacher <metze@samba.org> >Date: Tue, 23 Jan 2018 23:52:37 +0100 >Subject: [PATCH 3/3] winbindd: make use of talloc_zero_array() in > wb_lookupsids*() > >It just feels better for such a complex function. > >Bug: https://bugzilla.samba.org/show_bug.cgi?id=13281 > >Signed-off-by: Stefan Metzmacher <metze@samba.org> >Reviewed-by: Ralph Boehme <slow@samba.org> >(cherry picked from commit c376ab29d1d9f4b06fbb3a713029d79ecac80b59) >--- > source3/winbindd/wb_lookupsids.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > >diff --git a/source3/winbindd/wb_lookupsids.c b/source3/winbindd/wb_lookupsids.c >index bd90c43bbe9..af02a0c9547 100644 >--- a/source3/winbindd/wb_lookupsids.c >+++ b/source3/winbindd/wb_lookupsids.c >@@ -124,7 +124,7 @@ struct tevent_req *wb_lookupsids_send(TALLOC_CTX *mem_ctx, > state->sids = sids; > state->num_sids = num_sids; > >- state->single_sids = talloc_array(state, uint32_t, num_sids); >+ state->single_sids = talloc_zero_array(state, uint32_t, num_sids); > if (tevent_req_nomem(state->single_sids, req)) { > return tevent_req_post(req, ev); > } >@@ -133,7 +133,7 @@ struct tevent_req *wb_lookupsids_send(TALLOC_CTX *mem_ctx, > if (tevent_req_nomem(state->res_domains, req)) { > return tevent_req_post(req, ev); > } >- state->res_domains->domains = talloc_array( >+ state->res_domains->domains = talloc_zero_array( > state->res_domains, struct lsa_DomainInfo, num_sids); > if (tevent_req_nomem(state->res_domains->domains, req)) { > return tevent_req_post(req, ev); >@@ -143,7 +143,7 @@ struct tevent_req *wb_lookupsids_send(TALLOC_CTX *mem_ctx, > if (tevent_req_nomem(state->res_names, req)) { > return tevent_req_post(req, ev); > } >- state->res_names->names = talloc_array( >+ state->res_names->names = talloc_zero_array( > state->res_names, struct lsa_TranslatedName, num_sids); > if (tevent_req_nomem(state->res_names->names, req)) { > return tevent_req_post(req, ev); >@@ -371,13 +371,13 @@ static struct wb_lookupsids_domain *wb_lookupsids_get_domain( > domain = &domains[num_domains]; > domain->domain = wb_domain; > >- domain->sids.sids = talloc_array(domains, struct lsa_SidPtr, num_sids); >+ domain->sids.sids = talloc_zero_array(domains, struct lsa_SidPtr, num_sids); > if (domains->sids.sids == NULL) { > goto fail; > } > domain->sids.num_sids = 0; > >- domain->sid_indexes = talloc_array(domains, uint32_t, num_sids); >+ domain->sid_indexes = talloc_zero_array(domains, uint32_t, num_sids); > if (domain->sid_indexes == NULL) { > TALLOC_FREE(domain->sids.sids); > goto fail; >-- >2.13.6 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
metze
:
review+
Actions:
View
Attachments on
bug 13281
: 13988