Revert "s3:winbindd: setup domain->dcname in already add_trusted_domain()"
authorStefan Metzmacher <metze@samba.org>
Mon, 18 Feb 2019 15:43:50 +0000 (16:43 +0100)
committerStefan Metzmacher <metze@samba.org>
Mon, 17 Feb 2020 11:31:13 +0000 (12:31 +0100)
This reverts commit ad6bdacd138749f69e4af38fc325174550c1fd98.

source3/winbindd/winbindd_ping_dc.c
source3/winbindd/winbindd_util.c

index 5b2124e72cd6c65e94d01cefd4980f5073890c0f..8f56a9e8a77e3081d0e989e087fe40add8a8e521 100644 (file)
@@ -54,13 +54,32 @@ struct tevent_req *winbindd_ping_dc_send(TALLOC_CTX *mem_ctx,
                return tevent_req_post(req, ev);
        }
        if (domain->internal) {
+               const char *d = lp_dnsdomain();
+               const char *n = lp_netbios_name();
+
                /*
                 * Internal domains are passdb based, we can always
                 * contact them.
                 */
-               state->dcname = talloc_strdup(state, domain->dcname);
-               if (tevent_req_nomem(state->dcname, req)) {
-                       return tevent_req_post(req, ev);
+
+               if (d != NULL) {
+                       char *h;
+                       h = strlower_talloc(mem_ctx, n);
+                       if (tevent_req_nomem(h, req)) {
+                               return tevent_req_post(req, ev);
+                       }
+
+                       state->dcname = talloc_asprintf(state, "%s.%s", h, d);
+                       TALLOC_FREE(h);
+
+                       if (tevent_req_nomem(state->dcname, req)) {
+                               return tevent_req_post(req, ev);
+                       }
+               } else {
+                       state->dcname = talloc_strdup(state, n);
+                       if (tevent_req_nomem(state->dcname, req)) {
+                               return tevent_req_post(req, ev);
+                       }
                }
 
                tevent_req_done(req);
index 9302f87d21f85478789fc57c5508f3b9312813b7..c2f02b74211e8b976d8405f45494e7a36c954881 100644 (file)
@@ -285,39 +285,6 @@ static NTSTATUS add_trusted_domain(const char *domain_name,
 
        domain->can_do_ncacn_ip_tcp = domain->active_directory;
 
-       if (domain->internal) {
-               const char *d = alternative_name;
-               const char *n = lp_netbios_name();
-
-               /*
-                * Internal domains are passdb based, we can always
-                * contact them.
-                */
-
-               if (d != NULL) {
-                       char *h;
-
-                       h = strlower_talloc(domain, n);
-                       if (h == NULL) {
-                               TALLOC_FREE(domain);
-                               return NULL;
-                       }
-
-                       domain->dcname = talloc_asprintf(domain, "%s.%s", h, d);
-                       TALLOC_FREE(h);
-                       if (domain->dcname == NULL) {
-                               TALLOC_FREE(domain);
-                               return NULL;
-                       }
-               } else {
-                       domain->dcname = talloc_strdup(domain, n);
-                       if (domain->dcname == NULL) {
-                               TALLOC_FREE(domain);
-                               return NULL;
-                       }
-               }
-       }
-
        /* Link to domain list */
        DLIST_ADD_END(_domain_list, domain);