[SCM] Samba Shared Repository - branch master updated

Andreas Schneider asn at samba.org
Fri Aug 7 07:59:02 UTC 2020


The branch, master has been updated
       via  6a9c7859281 s3: libsmb: Cleanup - Remove the last use of a struct sockaddr_storage variable in dsgetdcname.c
       via  1b42b79cc89 s3: libsmb: Cleanup - Move dsgetdcname.c to using struct samba_sockaddr internally.
       via  eb5a4738643 s3: libsmb: Change dns_lookup_list_async() and associated functions to return a struct samba_sockaddr * array.
       via  3b13d4d65a9 s3: libsmb: Add utility function sockaddr_storage_to_samba_sockaddr().
       via  d882add695b s3: libsmb: Make discover_dc_dns() use async DNS.
       via  6411c64d066 s3: libsmb: Make dns_lookup_list_async() available to other Samba callers.
       via  f87ce5b08a3 s3: libsmb: Remove dns_lookup_list(). No longer used.
       via  bc307f1e370 s3: libsmb: Use dns_lookup_list_async() instead of dns_lookup_list().
       via  5ffcd883ddd s3: libsmb: Add dns_lookup_list_async() - not yet used.
       via  8a140391d6d s3: Parameters. Add 'async dns timeout' parameter. Default to 10. Minimum value 1.
       via  156f1dfc396 s4: tests: Add new async DNS unit test - samba4.blackbox.net_ads_dns_async(ad_member:local).
       via  b3671de4ee7 s3: net: Add new 'net ads dns async <name>' command.
       via  a1b90237d60 lib: addns: Add code for asynchronously looking up AAAA records.
       via  47c1b874230 lib: addns: Add code for asynchronously looking up A records.
      from  fc83b470513 libprc/test: add pull_string_array large array test

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


- Log -----------------------------------------------------------------
commit 6a9c78592814543e69e39f4451c8d0ef7e4dcf6b
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Aug 5 11:37:03 2020 -0700

    s3: libsmb: Cleanup - Remove the last use of a struct sockaddr_storage variable in dsgetdcname.c
    
    Remove from process_dc_netbios().
    
    This is a logic change, but as all the logic did was force a round-trip
    through converting an already guaranteed numeric hostname printed by
    print_sockaddr() inside discover_dc_netbios() to a struct
    sockaddr_storage and then discard the result (!) I think it's harmless.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
    Autobuild-Date(master): Fri Aug  7 07:58:14 UTC 2020 on sn-devel-184

commit 1b42b79cc8930a02150c561bc507a4da0d32ff95
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Jul 28 11:54:02 2020 -0700

    s3: libsmb: Cleanup - Move dsgetdcname.c to using struct samba_sockaddr internally.
    
    Mostly renames of ss -> sa and access union members. No logic changes.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit eb5a4738643c5fdef92851f4474d4eeb1e7b106f
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Jul 28 16:51:03 2020 -0700

    s3: libsmb: Change dns_lookup_list_async() and associated functions to return a struct samba_sockaddr * array.
    
    This fullfills the promise to Andreas and Metze
    of all new code using struct samba_sockaddr.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 3b13d4d65a92f988891f7c237e39b6c2d2d0c3f5
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Jul 28 11:28:19 2020 -0700

    s3: libsmb: Add utility function sockaddr_storage_to_samba_sockaddr().
    
    As requested by Andreas and Metze, ensure new code uses
    struct samba_sockaddr. This is part of changing dns_lookup_list_async()
    and callers to use struct samba_sockaddr.
    
    Currently putting this into namequery.c even though it's
    used inside dsgetdcname.c as I have future patches that
    heavily make use of this to convert sockaddr_storage -> samba_sockaddr.
    
    I'm not committed to putting it here, it may fit better
    in lib/util/util_net.[ch]. It just needs to be somewhere
    other functions inside source/libsmb/*.c can get to it,
    and currently namequery.h exports the most stuff.
    
    Not yet used.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit d882add695bbd5ea03961c08ac2c0380fbf2947b
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Jul 21 22:09:27 2020 -0700

    s3: libsmb: Make discover_dc_dns() use async DNS.
    
    Change to call dns_lookup_list_async(). This is
    doing the samba SRV lookup followed by A and AAAA
    record host lookup as resolve_ads() does and so
    benefits from the same changes to make it async.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 6411c64d066c117c8631ac2f315583250e58f865
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Jul 21 14:56:47 2020 -0700

    s3: libsmb: Make dns_lookup_list_async() available to other Samba callers.
    
    This allows the async DNS lookups to be re-used inside the dsgetdcname() internals
    code as previously described.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit f87ce5b08a31b3b2254c33d87faa539676879608
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Jul 21 22:14:02 2020 -0700

    s3: libsmb: Remove dns_lookup_list(). No longer used.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit bc307f1e3704a2fbe839bba0ef310877ed2e5ee0
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Jul 21 12:38:42 2020 -0700

    s3: libsmb: Use dns_lookup_list_async() instead of dns_lookup_list().
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 5ffcd883ddd4aef9ded18bee65562a8423e2f6c6
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Jul 21 12:34:02 2020 -0700

    s3: libsmb: Add dns_lookup_list_async() - not yet used.
    
    Take a list of hostnames and does async A and AAAA (if
    supported) lookups on them. Interface compatible with
    dns_lookup_list() (with the addition of one extra
    parameter returning the query name list, for use inside
    dsgetdcname() internals later) and we'll replace it in the next
    commit. Waits for lp_get_async_dns_timeout() seconds to complete.
    
    Commented out as not yet used.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 8a140391d6d2bba65275bdc7a85a33cc502dbfb7
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Jul 23 13:10:12 2020 -0700

    s3: Parameters. Add 'async dns timeout' parameter. Default to 10. Minimum value 1.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 156f1dfc396799018f4a97657b31f1852bff92a8
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Aug 5 15:46:04 2020 -0700

    s4: tests: Add new async DNS unit test - samba4.blackbox.net_ads_dns_async(ad_member:local).
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit b3671de4ee70dc56c60d7ea8f5a9b2afdf9dc79f
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Jul 17 14:45:45 2020 -0700

    s3: net: Add new 'net ads dns async <name>' command.
    
    Will test the async DNS lookups in the next commit.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit a1b90237d6082faccf69b13dec8ddc589fa3b588
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Jul 17 14:30:02 2020 -0700

    lib: addns: Add code for asynchronously looking up AAAA records.
    
    Returns an array of struct samba_sockaddr.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

commit 47c1b8742308cd31ed4267379242446ff40eb494
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Jul 17 14:21:09 2020 -0700

    lib: addns: Add code for asynchronously looking up A records.
    
    Returns an array of struct samba_sockaddr.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>

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

Summary of changes:
 docs-xml/smbdotconf/tuning/asyncdnstimeout.xml |  21 ++
 lib/addns/dnsquery.c                           | 408 ++++++++++++++++++++++
 lib/addns/dnsquery.h                           |  31 ++
 lib/param/loadparm.c                           |   3 +
 source3/include/proto.h                        |   1 +
 source3/libsmb/dsgetdcname.c                   | 287 ++++++++++++----
 source3/libsmb/namequery.c                     | 457 +++++++++++++++++++++----
 source3/libsmb/namequery.h                     |   9 +-
 source3/param/loadparm.c                       |  16 +
 source3/utils/net_ads.c                        |  82 +++++
 source4/selftest/tests.py                      |   6 +
 testprogs/blackbox/test_net_ads_dns_async.sh   |  67 ++++
 12 files changed, 1257 insertions(+), 131 deletions(-)
 create mode 100644 docs-xml/smbdotconf/tuning/asyncdnstimeout.xml
 create mode 100755 testprogs/blackbox/test_net_ads_dns_async.sh


Changeset truncated at 500 lines:

diff --git a/docs-xml/smbdotconf/tuning/asyncdnstimeout.xml b/docs-xml/smbdotconf/tuning/asyncdnstimeout.xml
new file mode 100644
index 00000000000..6c7ead2b2fd
--- /dev/null
+++ b/docs-xml/smbdotconf/tuning/asyncdnstimeout.xml
@@ -0,0 +1,21 @@
+<samba:parameter name="async dns timeout"
+                 context="G"
+                 type="integer"
+                 xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
+<description>
+    <para>The number of seconds the asynchronous DNS
+    resolver code in Samba will wait for responses.
+    Some of the Samba client library code uses internal
+    asynchronous DNS resolution for A and AAAA records
+    when trying to find Active Directory Domain controllers.
+    This value prevents this name resolution code from
+    waiting for DNS server timeouts.
+    </para>
+    <para>The minimum value of this parameter is clamped
+    at 1 second.
+    zero.</para>
+</description>
+
+<value type="default">10</value>
+<value type="example">20</value>
+</samba:parameter>
diff --git a/lib/addns/dnsquery.c b/lib/addns/dnsquery.c
index 90e4de9a053..03cadfaef0a 100644
--- a/lib/addns/dnsquery.c
+++ b/lib/addns/dnsquery.c
@@ -371,6 +371,414 @@ fail:
 	return status;
 }
 
+/*********************************************************************
+ Async A record lookup.
+*********************************************************************/
+
+struct ads_dns_lookup_a_state {
+	uint8_t rcode;
+	size_t num_names;
+	char **hostnames;
+	struct samba_sockaddr *addrs;
+};
+
+static void ads_dns_lookup_a_done(struct tevent_req *subreq);
+
+struct tevent_req *ads_dns_lookup_a_send(TALLOC_CTX *mem_ctx,
+					 struct tevent_context *ev,
+					 const char *name)
+{
+	struct tevent_req *req = NULL, *subreq = NULL;
+	struct ads_dns_lookup_a_state *state = NULL;
+
+	req = tevent_req_create(mem_ctx, &state,
+				struct ads_dns_lookup_a_state);
+	if (req == NULL) {
+		return NULL;
+	}
+
+	subreq = dns_lookup_send(
+		state,
+		ev,
+		NULL,
+		name,
+		DNS_QCLASS_IN,
+		DNS_QTYPE_A);
+
+	if (tevent_req_nomem(subreq, req)) {
+		return tevent_req_post(req, ev);
+	}
+	tevent_req_set_callback(subreq, ads_dns_lookup_a_done, req);
+	return req;
+}
+
+static void ads_dns_lookup_a_done(struct tevent_req *subreq)
+{
+	struct tevent_req *req = tevent_req_callback_data(
+		subreq, struct tevent_req);
+	struct ads_dns_lookup_a_state *state = tevent_req_data(
+		req, struct ads_dns_lookup_a_state);
+	int ret;
+	struct dns_name_packet *reply = NULL;
+	uint16_t i;
+
+	ret = dns_lookup_recv(subreq, state, &reply);
+	TALLOC_FREE(subreq);
+	if (ret != 0) {
+		tevent_req_nterror(req, map_nt_error_from_unix_common(ret));
+		return;
+	}
+
+	state->rcode = (reply->operation & DNS_RCODE);
+	if (state->rcode != DNS_RCODE_OK) {
+		/* Don't bother looking for answers. */
+		tevent_req_done(req);
+		return;
+	}
+
+	/*
+	 * We don't care about CNAME answers here. We're
+	 * just wanting an async name -> IPv4 lookup.
+	 */
+	for (i = 0; i < reply->ancount; i++) {
+		if (reply->answers[i].rr_type == DNS_QTYPE_A) {
+			state->num_names += 1;
+		}
+	}
+
+	state->hostnames = talloc_zero_array(state,
+					     char *,
+					     state->num_names);
+	if (tevent_req_nomem(state->hostnames, req)) {
+		return;
+	}
+	state->addrs = talloc_zero_array(state,
+					 struct samba_sockaddr,
+					 state->num_names);
+	if (tevent_req_nomem(state->addrs, req)) {
+		return;
+	}
+
+	state->num_names = 0;
+
+	for (i = 0; i < reply->ancount; i++) {
+		bool ok;
+		struct sockaddr_storage ss = {0};
+		struct dns_res_rec *an = &reply->answers[i];
+
+		if (an->rr_type != DNS_QTYPE_A) {
+			continue;
+		}
+		if (an->name == NULL) {
+			/* Can this happen? */
+			continue;
+		}
+		if (an->rdata.ipv4_record == NULL) {
+			/* Can this happen? */
+			continue;
+		}
+		ok = dns_res_rec_get_sockaddr(an,
+					      &ss);
+		if (!ok) {
+			continue;
+		}
+		if (is_zero_addr(&ss)) {
+			continue;
+		}
+		state->addrs[state->num_names].u.ss = ss;
+		state->addrs[state->num_names].sa_socklen =
+					sizeof(struct sockaddr_in);
+		state->hostnames[state->num_names] = talloc_strdup(
+							state->hostnames,
+							an->name);
+		if (tevent_req_nomem(state->hostnames[state->num_names], req)) {
+			return;
+		}
+		state->num_names += 1;
+	}
+
+	tevent_req_done(req);
+}
+
+NTSTATUS ads_dns_lookup_a_recv(struct tevent_req *req,
+			       TALLOC_CTX *mem_ctx,
+			       uint8_t *rcode_out,
+			       size_t *num_names_out,
+			       char ***hostnames_out,
+			       struct samba_sockaddr **addrs_out)
+{
+	struct ads_dns_lookup_a_state *state = tevent_req_data(
+		req, struct ads_dns_lookup_a_state);
+	NTSTATUS status;
+
+	if (tevent_req_is_nterror(req, &status)) {
+		return status;
+	}
+	if (rcode_out != NULL) {
+		/*
+		 * If we got no names, an upper layer may
+		 * want to print a debug message.
+		 */
+		*rcode_out = state->rcode;
+	}
+	if (hostnames_out != NULL) {
+		*hostnames_out = talloc_move(mem_ctx,
+					     &state->hostnames);
+	}
+	if (addrs_out != NULL) {
+		*addrs_out = talloc_move(mem_ctx,
+					 &state->addrs);
+	}
+	*num_names_out = state->num_names;
+	tevent_req_received(req);
+	return NT_STATUS_OK;
+}
+
+/*********************************************************************
+ Simple wrapper for a DNS A query
+*********************************************************************/
+
+NTSTATUS ads_dns_lookup_a(TALLOC_CTX *ctx,
+			  const char *name_in,
+			  size_t *num_names_out,
+			  char ***hostnames_out,
+			  struct samba_sockaddr **addrs_out)
+{
+	struct tevent_context *ev;
+	struct tevent_req *req;
+	NTSTATUS status = NT_STATUS_NO_MEMORY;
+
+	ev = samba_tevent_context_init(ctx);
+	if (ev == NULL) {
+		goto fail;
+	}
+	req = ads_dns_lookup_a_send(ev, ev, name_in);
+	if (req == NULL) {
+		goto fail;
+	}
+	if (!tevent_req_poll_ntstatus(req, ev, &status)) {
+		goto fail;
+	}
+	/*
+	 * Sychronous doesn't need to care about the rcode or
+	 * a copy of the name_in.
+	 */
+	status = ads_dns_lookup_a_recv(req,
+				       ctx,
+				       NULL,
+				       num_names_out,
+				       hostnames_out,
+				       addrs_out);
+fail:
+	TALLOC_FREE(ev);
+	return status;
+}
+
+#if defined(HAVE_IPV6)
+/*********************************************************************
+ Async AAAA record lookup.
+*********************************************************************/
+
+struct ads_dns_lookup_aaaa_state {
+	uint8_t rcode;
+	size_t num_names;
+	char **hostnames;
+	struct samba_sockaddr *addrs;
+};
+
+static void ads_dns_lookup_aaaa_done(struct tevent_req *subreq);
+
+struct tevent_req *ads_dns_lookup_aaaa_send(TALLOC_CTX *mem_ctx,
+					    struct tevent_context *ev,
+					    const char *name)
+{
+	struct tevent_req *req, *subreq = NULL;
+	struct ads_dns_lookup_aaaa_state *state = NULL;
+
+	req = tevent_req_create(mem_ctx, &state,
+				struct ads_dns_lookup_aaaa_state);
+	if (req == NULL) {
+		return NULL;
+	}
+
+	subreq = dns_lookup_send(
+		state,
+		ev,
+		NULL,
+		name,
+		DNS_QCLASS_IN,
+		DNS_QTYPE_AAAA);
+
+	if (tevent_req_nomem(subreq, req)) {
+		return tevent_req_post(req, ev);
+	}
+	tevent_req_set_callback(subreq, ads_dns_lookup_aaaa_done, req);
+	return req;
+}
+
+static void ads_dns_lookup_aaaa_done(struct tevent_req *subreq)
+{
+	struct tevent_req *req = tevent_req_callback_data(
+		subreq, struct tevent_req);
+	struct ads_dns_lookup_aaaa_state *state = tevent_req_data(
+		req, struct ads_dns_lookup_aaaa_state);
+	int ret;
+	struct dns_name_packet *reply = NULL;
+	uint16_t i;
+
+	ret = dns_lookup_recv(subreq, state, &reply);
+	TALLOC_FREE(subreq);
+	if (ret != 0) {
+		tevent_req_nterror(req, map_nt_error_from_unix_common(ret));
+		return;
+	}
+
+	state->rcode = (reply->operation & DNS_RCODE);
+	if (state->rcode != DNS_RCODE_OK) {
+		/* Don't bother looking for answers. */
+		tevent_req_done(req);
+		return;
+	}
+
+	/*
+	 * We don't care about CNAME answers here. We're
+	 * just wanting an async name -> IPv6 lookup.
+	 */
+	for (i = 0; i < reply->ancount; i++) {
+		if (reply->answers[i].rr_type == DNS_QTYPE_AAAA) {
+			state->num_names += 1;
+		}
+	}
+
+	state->hostnames = talloc_zero_array(state,
+					     char *,
+					     state->num_names);
+	if (tevent_req_nomem(state->hostnames, req)) {
+		return;
+	}
+	state->addrs = talloc_zero_array(state,
+					 struct samba_sockaddr,
+					 state->num_names);
+	if (tevent_req_nomem(state->addrs, req)) {
+		return;
+	}
+
+	state->num_names = 0;
+
+	for (i = 0; i < reply->ancount; i++) {
+		bool ok;
+		struct sockaddr_storage ss = {0};
+		struct dns_res_rec *an = &reply->answers[i];
+
+		if (an->rr_type != DNS_QTYPE_AAAA) {
+			continue;
+		}
+		if (an->name == NULL) {
+			/* Can this happen? */
+			continue;
+		}
+		if (an->rdata.ipv6_record == NULL) {
+			/* Can this happen? */
+			continue;
+		}
+		ok = dns_res_rec_get_sockaddr(an,
+					      &ss);
+		if (!ok) {
+			continue;
+		}
+		if (is_zero_addr(&ss)) {
+			continue;
+		}
+		state->addrs[state->num_names].u.ss = ss;
+		state->addrs[state->num_names].sa_socklen =
+					sizeof(struct sockaddr_in6);
+
+		state->hostnames[state->num_names] = talloc_strdup(
+							state->hostnames,
+							an->name);
+		if (tevent_req_nomem(state->hostnames[state->num_names], req)) {
+			return;
+		}
+		state->num_names += 1;
+	}
+
+	tevent_req_done(req);
+}
+
+NTSTATUS ads_dns_lookup_aaaa_recv(struct tevent_req *req,
+				  TALLOC_CTX *mem_ctx,
+				  uint8_t *rcode_out,
+				  size_t *num_names_out,
+				  char ***hostnames_out,
+				  struct samba_sockaddr **addrs_out)
+{
+	struct ads_dns_lookup_aaaa_state *state = tevent_req_data(
+		req, struct ads_dns_lookup_aaaa_state);
+	NTSTATUS status;
+
+	if (tevent_req_is_nterror(req, &status)) {
+		return status;
+	}
+	if (rcode_out != NULL) {
+		/*
+		 * If we got no names, an upper layer may
+		 * want to print a debug message.
+		 */
+		*rcode_out = state->rcode;
+	}
+	if (hostnames_out != NULL) {
+		*hostnames_out = talloc_move(mem_ctx,
+					     &state->hostnames);
+	}
+	if (addrs_out != NULL) {
+		*addrs_out = talloc_move(mem_ctx,
+					 &state->addrs);
+	}
+	*num_names_out = state->num_names;
+	tevent_req_received(req);
+	return NT_STATUS_OK;
+}
+
+/*********************************************************************
+ Simple wrapper for a DNS AAAA query
+*********************************************************************/
+
+NTSTATUS ads_dns_lookup_aaaa(TALLOC_CTX *ctx,
+			     const char *name_in,
+			     size_t *num_names_out,
+			     char ***hostnames_out,
+			     struct samba_sockaddr **addrs_out)
+{
+	struct tevent_context *ev = NULL;
+	struct tevent_req *req = NULL;
+	NTSTATUS status = NT_STATUS_NO_MEMORY;
+
+	ev = samba_tevent_context_init(ctx);
+	if (ev == NULL) {
+		goto fail;
+	}
+	req = ads_dns_lookup_aaaa_send(ev, ev, name_in);
+	if (req == NULL) {
+		goto fail;
+	}
+	if (!tevent_req_poll_ntstatus(req, ev, &status)) {
+		goto fail;
+	}
+	/*
+	 * Sychronous doesn't need to care about the rcode or
+	 * a copy of the name_in.
+	 */
+	status = ads_dns_lookup_aaaa_recv(req,
+					  ctx,
+					  NULL,
+					  num_names_out,
+					  hostnames_out,
+					  addrs_out);
+fail:
+	TALLOC_FREE(ev);
+	return status;
+}
+#endif
 
 /********************************************************************
  Query with optional sitename.
diff --git a/lib/addns/dnsquery.h b/lib/addns/dnsquery.h
index bb691f5d55a..3f8cc13983b 100644
--- a/lib/addns/dnsquery.h
+++ b/lib/addns/dnsquery.h
@@ -48,6 +48,37 @@ NTSTATUS ads_dns_lookup_ns(TALLOC_CTX *ctx,
 				const char *dnsdomain,
 				struct dns_rr_ns **nslist,
 				int *numns);
+struct tevent_req *ads_dns_lookup_a_send(TALLOC_CTX *mem_ctx,
+				struct tevent_context *ev,
+				const char *name);
+NTSTATUS ads_dns_lookup_a_recv(struct tevent_req *req,
+				TALLOC_CTX *mem_ctx,
+				uint8_t *rcode_out,
+				size_t *num_names_out,
+				char ***hostnames_out,
+				struct samba_sockaddr **addrs_out);
+NTSTATUS ads_dns_lookup_a(TALLOC_CTX *ctx,
+			const char *name_in,
+			size_t *num_names_out,
+			char ***hostnames_out,
+			struct samba_sockaddr **addrs_out);
+#if defined(HAVE_IPV6)
+struct tevent_req *ads_dns_lookup_aaaa_send(TALLOC_CTX *mem_ctx,
+				struct tevent_context *ev,
+				const char *name);
+NTSTATUS ads_dns_lookup_aaaa_recv(struct tevent_req *req,
+				TALLOC_CTX *mem_ctx,
+				uint8_t *rcode_out,
+				size_t *num_names_out,
+				char ***hostnames_out,
+				struct samba_sockaddr **addrs_out);
+NTSTATUS ads_dns_lookup_aaaa(TALLOC_CTX *ctx,
+			const char *name_in,
+			size_t *num_names_out,
+			char ***hostnames_out,
+			struct samba_sockaddr **addrs_out);
+#endif
+
 NTSTATUS ads_dns_query_dcs(TALLOC_CTX *ctx,
 			   const char *realm,
 			   const char *sitename,
diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c
index dc22f646b3e..7e9767590f9 100644
--- a/lib/param/loadparm.c
+++ b/lib/param/loadparm.c
@@ -3066,6 +3066,9 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx)
 	lpcfg_do_global_parameter(
 		lp_ctx, "ldap max search request size", "256000");
 
+	/* Async DNS query timeout in seconds. */
+	lpcfg_do_global_parameter(lp_ctx, "async dns timeout", "10");
+
 	for (i = 0; parm_table[i].label; i++) {


-- 
Samba Shared Repository



More information about the samba-cvs mailing list