libcli/util Rename common map_nt_error_from_unix to avoid duplicate symbol
[samba.git] / source4 / libcli / resolve / dns_ex.c
index 069ba823c2044ec0dd6516ac68a1f28792713040..592121257937707833fc14d0116d2a31d3e232d2 100644 (file)
@@ -267,7 +267,22 @@ static void run_child_dns_lookup(struct dns_ex_state *state, int fd)
                        port = state->port;
                }
 
-               if (!print_sockaddr_len(addrstr, sizeof(addrstr), (struct sockaddr *)addrs_rr[i]->u.data, addrs_rr[i]->size)) {
+               switch (addrs_rr[i]->type) {
+               case rk_ns_t_a:
+                       if (inet_ntop(AF_INET, addrs_rr[i]->u.a,
+                                     addrstr, sizeof(addrstr)) == NULL) {
+                               continue;
+                       }
+                       break;
+#ifdef HAVE_IPV6
+               case rk_ns_t_aaaa:
+                       if (inet_ntop(AF_INET6, (struct in6_addr *)addrs_rr[i]->u.data,
+                                     addrstr, sizeof(addrstr)) == NULL) {
+                               continue;
+                       }
+                       break;
+#endif
+               default:
                        continue;
                }
 
@@ -503,7 +518,7 @@ struct composite_context *resolve_name_dns_ex_send(TALLOC_CTX *mem_ctx,
        /* setup a pipe to chat to our child */
        ret = pipe(fd);
        if (ret == -1) {
-               composite_error(c, map_nt_error_from_unix(errno));
+               composite_error(c, map_nt_error_from_unix_common(errno));
                return c;
        }
 
@@ -527,7 +542,7 @@ struct composite_context *resolve_name_dns_ex_send(TALLOC_CTX *mem_ctx,
 
        state->child = fork();
        if (state->child == (pid_t)-1) {
-               composite_error(c, map_nt_error_from_unix(errno));
+               composite_error(c, map_nt_error_from_unix_common(errno));
                return c;
        }