s4:rpc-server: fix lsa_lookupsids return value for the domain sid
authorMichael Adam <obnox@samba.org>
Wed, 18 Sep 2013 07:33:07 +0000 (09:33 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Wed, 13 Nov 2013 12:34:16 +0000 (13:34 +0100)
We currently return type UNKNOWN and copy the domain sid to the name.
Instead we should return type DOMAIN and return NULL as name.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Nov 13 13:34:16 CET 2013 on sn-devel-104

source4/rpc_server/lsa/lsa_lookup.c

index d9fba938369ab7a52ba891e8ef68d453e4063636..fb4767dc76ab3ea75bd491e6532ff965dfda2765 100644 (file)
@@ -531,6 +531,16 @@ static NTSTATUS dcesrv_lsa_lookup_sid(struct lsa_policy_state *state, TALLOC_CTX
                return status;
        }
 
+       if (dom_sid_equal(state->domain_sid, sid)) {
+               *authority_name = talloc_strdup(mem_ctx, state->domain_name);
+               if (*authority_name == NULL) {
+                       return NT_STATUS_NO_MEMORY;
+               }
+               *name = NULL;
+               *rtype = SID_NAME_DOMAIN;
+               return NT_STATUS_OK;
+       }
+
        if (dom_sid_in_domain(state->domain_sid, sid)) {
                *authority_name = talloc_strdup(mem_ctx, state->domain_name);
                if (*authority_name == NULL) {