winbind: Use one queue for all domain children
[samba.git] / source3 / winbindd / winbindd_util.c
index 05c963f858fdb846fdb03d547e48d41f1bd4eefc..73e6b76ec733ffc08f3b2914026291445c41e9e2 100644 (file)
@@ -228,6 +228,18 @@ static NTSTATUS add_trusted_domain(const char *domain_name,
                return NT_STATUS_NO_MEMORY;
        }
 
+       domain->queue = tevent_queue_create(domain, "winbind_domain");
+       if (domain->queue == NULL) {
+               TALLOC_FREE(domain);
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       domain->binding_handle = wbint_binding_handle(domain, domain, NULL);
+       if (domain->binding_handle == NULL) {
+               TALLOC_FREE(domain);
+               return NT_STATUS_NO_MEMORY;
+       }
+
        domain->name = talloc_strdup(domain, domain_name);
        if (domain->name == NULL) {
                TALLOC_FREE(domain);
@@ -336,7 +348,9 @@ bool add_trusted_domain_from_auth(uint16_t validation_level,
        }
 
        if (validation_level == 6) {
-               dns_domainname = &info6->dns_domainname[0];
+               if (!strequal(info6->dns_domainname, "")) {
+                       dns_domainname = info6->dns_domainname;
+               }
        }
 
        status = add_trusted_domain(info3->logon_dom,
@@ -779,7 +793,12 @@ enum winbindd_result winbindd_dual_init_connection(struct winbindd_domain *domai
                [sizeof(state->request->data.init_conn.dcname)-1]='\0';
 
        if (strlen(state->request->data.init_conn.dcname) > 0) {
-               fstrcpy(domain->dcname, state->request->data.init_conn.dcname);
+               TALLOC_FREE(domain->dcname);
+               domain->dcname = talloc_strdup(domain,
+                               state->request->data.init_conn.dcname);
+               if (domain->dcname == NULL) {
+                       return WINBINDD_ERROR;
+               }
        }
 
        init_dc_connection(domain, false);
@@ -1426,7 +1445,7 @@ struct winbindd_domain *find_default_route_domain(void)
        if (!IS_DC) {
                return find_our_domain();
        }
-       DBG_ERR("Routing logic not yet implemented on a DC");
+       DBG_DEBUG("Routing logic not yet implemented on a DC\n");
        return NULL;
 }