[SCM] Samba Shared Repository - branch master updated

Ralph Böhme slow at samba.org
Sun Jun 19 08:35:02 UTC 2016


The branch, master has been updated
       via  9379a86 s3/net: print returned addresses in dns gethostbyname
      from  3de3f64 s4-kdc: Move KDC packet handling functions to kdc-server.c

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 9379a869439585410c4c3f74db2a39eaa36cb523
Author: Richard Sharpe <rsharpe at samba.org>
Date:   Sat Jun 18 13:29:36 2016 -0700

    s3/net: print returned addresses in dns gethostbyname
    
    Make net ads dns gethostbyname actually print out the returned addresses
    so we can use it in self tests.
    
    Signed-off-by: Richard Sharpe <rsharpe at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    Autobuild-User(master): Ralph Böhme <slow at samba.org>
    Autobuild-Date(master): Sun Jun 19 10:34:37 CEST 2016 on sn-devel-144

-----------------------------------------------------------------------

Summary of changes:
 source3/utils/net_ads.c |  7 ++++---
 source3/utils/net_dns.c | 29 +++++++++++++++++++++++++++--
 2 files changed, 31 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
index f4c25e1..5feecc9 100644
--- a/source3/utils/net_ads.c
+++ b/source3/utils/net_ads.c
@@ -1751,9 +1751,10 @@ static int net_ads_dns_gethostbyname(struct net_context *c, int argc, const char
 	}
 
 	err = do_gethostbyname(argv[0], argv[1]);
-
-	d_printf(_("do_gethostbyname returned %s (%d)\n"),
-		dns_errstr(err), ERROR_DNS_V(err));
+	if (!ERR_DNS_IS_OK(err)) {
+		d_printf(_("do_gethostbyname returned %s (%d)\n"),
+			dns_errstr(err), ERROR_DNS_V(err));
+	}
 #endif
 	return 0;
 }
diff --git a/source3/utils/net_dns.c b/source3/utils/net_dns.c
index 3b9730a..207dfa5 100644
--- a/source3/utils/net_dns.c
+++ b/source3/utils/net_dns.c
@@ -212,14 +212,39 @@ DNS_ERROR do_gethostbyname(const char *server, const char *host)
 	struct dns_connection *conn = NULL;
 	struct dns_request *req, *resp;
 	DNS_ERROR err;
+	int ans = 0;
 
 	err = dns_open_connection(server, DNS_UDP, NULL, &conn);
-	if (!ERR_DNS_IS_OK(err)) goto error;
+	if (!ERR_DNS_IS_OK(err)) {
+		goto error;
+	}
 
 	err = dns_create_query(conn, host, QTYPE_A, DNS_CLASS_IN, &req);
-	if (!ERR_DNS_IS_OK(err)) goto error;
+	if (!ERR_DNS_IS_OK(err)) {
+		goto error;
+	}
 
 	err = dns_transaction(conn, conn, req, &resp);
+	if (!ERR_DNS_IS_OK(err)) {
+		goto error;
+	}
+
+	if (resp->num_answers == 0) {
+		printf("%s", "No answers!\n");
+		goto error;
+	}
+
+	for (ans = 0; ans < resp->num_answers; ans++) {
+		struct in_addr resp_ip;
+
+		if (ans > 0)
+			printf("%s", " ");
+
+		resp_ip.s_addr = *((uint32_t *)resp->answers[ans]->data);
+		printf("%s", inet_ntoa(resp_ip));
+	}
+
+	printf("%s", "\n");
 
  error:
 	TALLOC_FREE(conn);


-- 
Samba Shared Repository



More information about the samba-cvs mailing list