Index: source3/rpc_client/cli_lsarpc.c =================================================================== --- source3/rpc_client/cli_lsarpc.c.orig +++ source3/rpc_client/cli_lsarpc.c @@ -173,6 +173,7 @@ static NTSTATUS dcerpc_lsa_lookup_sids_n char **names, enum lsa_SidType *types, bool use_lookupsids3, + int sids_processed, NTSTATUS *presult) { NTSTATUS status = NT_STATUS_OK; @@ -183,6 +184,8 @@ static NTSTATUS dcerpc_lsa_lookup_sids_n enum lsa_LookupNamesLevel level = LSA_LOOKUP_NAMES_ALL; uint32_t count = 0; int i; + char **pnames = names - sids_processed; + char **pdomains = domains - sids_processed; ZERO_STRUCT(lsa_names); @@ -287,7 +290,7 @@ static NTSTATUS dcerpc_lsa_lookup_sids_n name = lsa_names.names[i].name.string; if (name) { - (names)[i] = talloc_strdup(names, name); + (names)[i] = talloc_strdup(pnames, name); if ((names)[i] == NULL) { DEBUG(0, ("cli_lsa_lookup_sids_noalloc(): out of memory\n")); *presult = NT_STATUS_UNSUCCESSFUL; @@ -296,7 +299,7 @@ static NTSTATUS dcerpc_lsa_lookup_sids_n } else { (names)[i] = NULL; } - domains[i] = talloc_strdup(domains, + domains[i] = talloc_strdup(pdomains, dom_name ? dom_name : ""); (types)[i] = lsa_names.names[i].sid_type; if (((domains)[i] == NULL)) { @@ -401,6 +404,7 @@ static NTSTATUS dcerpc_lsa_lookup_sids_g hunk_names, hunk_types, use_lookupsids3, + sids_processed, &hunk_result); if (!NT_STATUS_IS_OK(status)) { goto fail;