This patch makes the 'winbind use default domain' code interact better with
[ira/wip.git] / source3 / rpc_parse / parse_lsa.c
index 12b0ec2e1672b7f5a852d7df77b0b9f18c1435b8..04acc75d7e772827fd49b67a03dc6cae8c0fb28e 100644 (file)
@@ -1045,7 +1045,7 @@ makes a structure.
 ********************************************************************/
 
 void init_q_lookup_names(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_NAMES *q_l, 
-                        POLICY_HND *hnd, int num_names, const char **names)
+                        POLICY_HND *hnd, int num_names, const char **dom_names, const char **names)
 {
        int i;
 
@@ -1072,10 +1072,20 @@ void init_q_lookup_names(TALLOC_CTX *mem_ctx, LSA_Q_LOOKUP_NAMES *q_l,
 
        for (i = 0; i < num_names; i++) {
                const char *name = names[i];
-               int len = strlen(name);
+               const char *dom_name = dom_names[i];
+               char *full_name;
+               int len;
+
+               full_name = talloc_asprintf(mem_ctx, "%s\\%s", dom_name, name);
+               if (!full_name) {
+                       DEBUG(0, ("init_q_lookup_names(): out of memory doing talloc_asprintf\n"));
+                       return;
+               }
+
+               len = strlen(full_name);
 
                init_uni_hdr(&q_l->hdr_name[i], len);
-               init_unistr2(&q_l->uni_name[i], name, len);
+               init_unistr2(&q_l->uni_name[i], full_name, len);
        }
 }