winbind: Return queried domain name from name_to_sid
[garming/samba-autobuild/.git] / source3 / winbindd / winbindd_msrpc.c
index 69a049556ddd0dbcd9906a60988710dac98de6a1..342f22cfde31bd120b34d8873a98785bc99b4287 100644 (file)
@@ -218,6 +218,7 @@ static NTSTATUS msrpc_name_to_sid(struct winbindd_domain *domain,
                                  const char *domain_name,
                                  const char *name,
                                  uint32_t flags,
+                                 const char **pdom_name,
                                  struct dom_sid *sid,
                                  enum lsa_SidType *type)
 {
@@ -268,6 +269,17 @@ static NTSTATUS msrpc_name_to_sid(struct winbindd_domain *domain,
 
        /* Return rid and type if lookup successful */
 
+       if (pdom_name != NULL) {
+               const char *dom_name;
+
+               dom_name = talloc_strdup(mem_ctx, domains[0]);
+               if (dom_name == NULL) {
+                       return NT_STATUS_NO_MEMORY;
+               }
+
+               *pdom_name = dom_name;
+       }
+
        sid_copy(sid, &sids[0]);
        *type = types[0];