summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-06-16 18:25:15 +0200
committerStefan Metzmacher <metze@samba.org>2011-06-16 19:50:16 +0200
commit5961852d9c0e5cf64cea988586d610af9d63d487 (patch)
tree3c2c1824b33d9017b48984ab66723085e40cf169
parent85809ccbe3a79f307af1fdd227f33b899d8db1b4 (diff)
downloadsamba-5961852d9c0e5cf64cea988586d610af9d63d487.tar.gz
samba-5961852d9c0e5cf64cea988586d610af9d63d487.tar.bz2
samba-5961852d9c0e5cf64cea988586d610af9d63d487.zip
s3:wb_lookupsids: add some paranoia checks to wb_lookupsids_recv()
This hopefully catches future bugs. metze Autobuild-User: Stefan Metzmacher <metze@samba.org> Autobuild-Date: Thu Jun 16 19:50:16 CEST 2011 on sn-devel-104
-rw-r--r--source3/winbindd/wb_lookupsids.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/source3/winbindd/wb_lookupsids.c b/source3/winbindd/wb_lookupsids.c
index 8f431ab4fc..92eee039ed 100644
--- a/source3/winbindd/wb_lookupsids.c
+++ b/source3/winbindd/wb_lookupsids.c
@@ -639,6 +639,24 @@ NTSTATUS wb_lookupsids_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx,
if (tevent_req_is_nterror(req, &status)) {
return status;
}
+
+ /*
+ * The returned names need to match the given sids,
+ * if not we have a bug in the code!
+ *
+ */
+ SMB_ASSERT(state->res_names->count == state->num_sids);
+
+ /*
+ * Not strictly needed, but it might make debugging in the callers
+ * easier in future, if the talloc_array_length() returns the
+ * expected result...
+ */
+ state->res_domains->domains = talloc_realloc(state->res_domains,
+ state->res_domains->domains,
+ struct lsa_DomainInfo,
+ state->res_domains->count);
+
*domains = talloc_move(mem_ctx, &state->res_domains);
*names = talloc_move(mem_ctx, &state->res_names);
return NT_STATUS_OK;