From e35b1d8dc43e63d8932e8e0e3cd274e9de6963e3 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 20 Feb 2014 16:57:21 +0100 Subject: [PATCH] passdb: spare superfluous call to lookup_rids() in lookup_sids() If we have no name indexes for a domain, all names were domain names and have been resolved earlier, including the domain name. Bug: https://bugzilla.samba.org/show_bug.cgi?id=10463 Change-Id: I5a7a387fa89d2b2bdd465c13b3dca0e18ca0482c Signed-off-by: Michael Adam Reviewed-by: Stefan Metzmacher Autobuild-User(master): Stefan Metzmacher Autobuild-Date(master): Tue Feb 25 11:17:18 CET 2014 on sn-devel-104 --- source3/passdb/lookup_sid.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/source3/passdb/lookup_sid.c b/source3/passdb/lookup_sid.c index 6ec6ce8e47e..fa44f3efbd0 100644 --- a/source3/passdb/lookup_sid.c +++ b/source3/passdb/lookup_sid.c @@ -899,13 +899,18 @@ NTSTATUS lookup_sids(TALLOC_CTX *mem_ctx, int num_sids, break; } - if (dom->num_idxs) { - if (!(rids = talloc_array(tmp_ctx, uint32, dom->num_idxs))) { - result = NT_STATUS_NO_MEMORY; - goto fail; - } - } else { - rids = NULL; + if (dom->num_idxs == 0) { + /* + * This happens only if the only sid related to + * this domain is the domain sid itself, which + * is mapped to SID_NAME_DOMAIN above. + */ + continue; + } + + if (!(rids = talloc_array(tmp_ctx, uint32, dom->num_idxs))) { + result = NT_STATUS_NO_MEMORY; + goto fail; } for (j=0; jnum_idxs; j++) { -- 2.11.4.GIT