s4-lsa Use the supplied handle in LsaLookupNames2
[amitay/samba.git] / source4 / rpc_server / lsa / lsa_lookup.c
index 3d472812d8cef2c646d0184fdc7123f20dbd92fc..522d2db6d6e3d0b541705cdeb367696d2ceac806 100644 (file)
@@ -549,12 +549,17 @@ NTSTATUS dcesrv_lsa_LookupSids2(struct dcesrv_call_state *dce_call,
        struct lsa_RefDomainList *domains = NULL;
        uint32_t i;
        NTSTATUS status = NT_STATUS_OK;
+       struct dcesrv_handle *h;
+
+       DCESRV_PULL_HANDLE(h, r->in.handle, LSA_HANDLE_POLICY);
 
        if (r->in.level < LSA_LOOKUP_NAMES_ALL ||
            r->in.level > LSA_LOOKUP_NAMES_RODC_REFERRAL_TO_FULL_DC) {
                return NT_STATUS_INVALID_PARAMETER;
        }
 
+       state = h->data;
+
        *r->out.domains = NULL;
 
        /* NOTE: the WSPP test suite tries SIDs with invalid revision numbers,
@@ -563,11 +568,6 @@ NTSTATUS dcesrv_lsa_LookupSids2(struct dcesrv_call_state *dce_call,
           MS-DTYP 2.4.2
        */
 
-       status = dcesrv_lsa_get_policy_state(dce_call, mem_ctx, &state);
-       if (!NT_STATUS_IS_OK(status)) {
-               return status;
-       }
-
        domains = talloc_zero(r->out.domains,  struct lsa_RefDomainList);
        if (domains == NULL) {
                return NT_STATUS_NO_MEMORY;