[SCM] Samba Shared Repository - branch v4-24-stable updated

Björn Jacke bjacke at samba.org
Wed Sep 9 15:16:01 UTC 2026


The branch, v4-24-stable has been updated
       via  1aab718aaf6 VERSION: Disable GIT_SNAPSHOT for the 4.24.7 release.
       via  3d8f77c75bc WHATSNEW: Add release notes for Samba 4.24.7.
       via  655614d8454 smbd: check the return value before the ACE-lists out args
       via  61fe86b48d1 smbd: prepare for correct error handling for callers of unpack_canon_ace()
       via  f4084b298d9 smbtorture: add test smb2.acls.NON-CANONICAL-ORDER
       via  2cc2d16a89b smbtorture: split smb2.acls into acls-with-sysacl and acls-ignore-sysacl
       via  1fc39c45338 s4:rpc_server/dnsserver: allow dnsserver_db_do_reset_dword() to add new dNSProperty values
       via  e2ea69bf582 s4:rpc_server/dnsserver: fix talloc hierarchy in dnsserver_db_do_reset_dword()
       via  48330acbf7e python/tests: add tests for samba-tool dns zoneoptions on a zone without dNSProperty values
       via  c5e2a6d602a s4:kcc: let dns_tombstone_records_zone() skip if fAging is not 1
       via  7f00cbbd1ec s4:dns_server: let dns_get_zone_properties() fallback to serverinfo->dwDefault[No]RefreshInterval
       via  674fdb59460 s4:dns_server: move rpc_server/dnsserver/dnsutils.c to dns_server/dnsserver_utils.c
       via  1525bf05043 s4:dns_server: let dns_get_zone_properties() initialize zoneinfo completely.
       via  a836a14721f s4:rpc_server/dnsserver: let dnsserver_init_zoneinfo() fallback to serverinfo->dwDefault[No]RefreshInterval
       via  59fb4e0b629 s4:rpc_server/dnsserver: define DNS_SERVER_DEFAULT_[NO_]REFRESH_INTERVAL as 24 * 7
       via  b2c643490b4 s4:rpc_server/dnsserver: let dnsserver_init_serverinfo() use dns_server_scavenging_interval()
       via  54565c36561 s4:kcc: let kccsrv_dns_zone_scavenging() use dns_server_scavenging_interval()
       via  d87e714b8fa s4:dns_server: add dns_server_scavenging_interval()
       via  7036a847f78 s4:rpc_server/common: turn lpcfg_dcerpc_server_info() into an inline function
       via  688f8b3cfa2 s4:dns_server: change DNS_MAX_UDP_PACKET_LENGTH to 512
       via  ab06827c9da python:tests/dns: use tcp for the CVE-2018-14629 regression tests
       via  75052b7677b s4:dns_server: avoid layer violation for truncated udp responses.
       via  372fcb30a38 s4:dns_server: make it more obvious that the DNS over TCP length hdr is u16
       via  9bb04cdf8c5 s4/dns_server: truncate large dns packets over udp and set truncated flag
       via  a8193d863a6 s4/dns_server: add large dns udp truncated packets tests
       via  241fb3b906a script/autobuild.py: also add .stderr output including backtraces
       via  7cfa98c3300 ctdb-recoverd: Ensure an outgoing leader aborts recovery
       via  591262701c3 ctdb-recoverd: Factor out fetching node map and local flags
       via  9fb2d75d65d s3:vfs_streams_xattr: Use dirfsp in streams_xattr_unlinkat()
       via  98692e28453 s3:smbd: Allow STREAM_INFORMATION query on alternate stream handles
       via  db0ad6a53bc s4:torture: Close all handles in test_stream_io() in smb2.streams
       via  4a0af83ae07 s4:torture: Use torture_result() in check_stream_list() in smb2.streams
       via  86452367b71 s4:torture: Move smb2_util_close() do done in create_file_with_stream()
       via  0653e197053 s4:torture: Add missing CHECK_STATUS() in test_stream_io()
       via  c48a23265cf s4:torture: Cleanup to to use the right name
       via  ee1864723ed s4:torture: Make sure we close handles correctly in test_stream_names()
       via  2e8b88d7d86 s4:torture: Always close handle in check_stream() in smb2.streams
       via  fc701b4343f s4:torture: Close handles opened by torture_smb2_testdir() in smb2.streams test
       via  52c25206890 libcli/dns: Do not pass NULL pointer to memcpy()
       via  e62c39b8863 libcli/dns: Add dns_cli_request() sync wrapper
       via  f8bce5686f5 libcli/dns: Make dns_cli_request_send() take a dns_name_packet()
       via  fac98d611f2 libcli/dns: fix use-after-free oom case
       via  d72c26c4301 libcli/dns: Add TCP parallel fallback after 1 second UDP timeout
       via  2e0fa9df61f libcli/dns: Make SMB_ASSERT available
       via  71b72ccc5ab libcli/dns: dns_udp_request_get_reply -> dns_udp_request_sent
       via  6ee7f0dc17f libcli/dns: Avoid a local variable referenced only once
       via  35744d77898 libcli/dns: Simplify dns over tcp requests, save 39 lines :-)
       via  644439765d3 VERSION: Bump version up to Samba 4.24.7...
      from  f6577b76099 VERSION: Disable GIT_SNAPSHOT for the 4.24.6 release.

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-24-stable


- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 VERSION                                            |   2 +-
 WHATSNEW.txt                                       |  73 ++-
 ctdb/server/ctdb_recoverd.c                        |  58 ++-
 lib/param/param.h                                  |   1 -
 libcli/dns/dns.c                                   | 530 +++++++++++++--------
 libcli/dns/dns_lookup.c                            |  16 +-
 libcli/dns/libdns.h                                |  13 +-
 libcli/dns/wscript_build                           |   2 +-
 python/samba/tests/dns.py                          | 127 ++++-
 python/samba/tests/samba_tool/dnscmd.py            |  72 ++-
 script/autobuild.py                                |  39 +-
 selftest/flapping                                  |   4 +-
 selftest/knownfail                                 |   8 +-
 selftest/knownfail.d/dns                           |   2 +
 source3/modules/vfs_streams_xattr.c                |   2 +-
 source3/selftest/tests.py                          |   7 +
 source3/smbd/posix_acls.c                          |  13 +-
 source3/smbd/smb2_trans2.c                         |   5 +-
 source4/dns_server/dns_query.c                     |  13 +-
 source4/dns_server/dns_server.c                    |  79 ++-
 source4/dns_server/dns_server.h                    |  11 +
 source4/dns_server/dnsserver_common.c              |  73 ++-
 source4/dns_server/dnsserver_common.h              |   5 +
 .../dnsutils.c => dns_server/dnsserver_utils.c}    |  35 +-
 source4/dns_server/wscript_build                   |   4 +-
 source4/dsdb/kcc/kcc_periodic.c                    |  12 +-
 source4/dsdb/kcc/scavenge_dns_records.c            |  16 +
 source4/rpc_server/common/common.h                 |  26 +
 source4/rpc_server/common/loadparm.c               |  45 --
 source4/rpc_server/dnsserver/dnsdb.c               | 157 ++++--
 source4/rpc_server/dnsserver/dnsserver.h           |  16 +
 .../tests/rpc_dns_server_dnsutils_test.c           |   2 +-
 source4/rpc_server/wscript_build                   |   2 -
 source4/torture/smb2/acls.c                        | 116 ++++-
 source4/torture/smb2/smb2.c                        |   3 +-
 source4/torture/smb2/streams.c                     |  89 ++--
 36 files changed, 1253 insertions(+), 425 deletions(-)
 rename source4/{rpc_server/dnsserver/dnsutils.c => dns_server/dnsserver_utils.c} (93%)
 delete mode 100644 source4/rpc_server/common/loadparm.c


Changeset truncated at 500 lines:

diff --git a/VERSION b/VERSION
index 7b2606f736c..eb9f840d87b 100644
--- a/VERSION
+++ b/VERSION
@@ -27,7 +27,7 @@ SAMBA_COPYRIGHT_STRING="Copyright Andrew Tridgell and the Samba Team 1992-2026"
 ########################################################
 SAMBA_VERSION_MAJOR=4
 SAMBA_VERSION_MINOR=24
-SAMBA_VERSION_RELEASE=6
+SAMBA_VERSION_RELEASE=7
 
 ########################################################
 # If a official release has a serious bug              #
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index b3075870c4b..ea93b395dd3 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,3 +1,73 @@
+                   ==============================
+                   Release Notes for Samba 4.24.7
+                         September 09, 2026
+                   ==============================
+
+
+This is the latest stable release of the Samba 4.24 release series.
+
+
+Changes since 4.24.6
+--------------------
+
+o  Ralph Boehme <slow at samba.org>
+   * BUG 16097: POSIX ACL backend silently discards erros when processing NT
+     ACLs with non-canonical ordering
+
+o  Volker Lendecke <vl at samba.org>
+   * BUG 16225: dns client problems related to EDNS usage
+
+o  Andréas Leroux <aleroux at tranquil.it>
+   * BUG 15988: Samba internal DNS service doesn't handle switch from UDP to TCP
+     when packet is larger than 4k
+
+o  Stefan Metzmacher <metze at samba.org>
+   * BUG 15988: Samba internal DNS service doesn't handle switch from UDP to TCP
+     when packet is larger than 4k
+   * BUG 16194: autobuild failures need to be reported in a more verbose way
+   * BUG 16223: DNS scavenging happens even if fAging is FALSE
+   * BUG 16226: samba-tool dns zoneoptions $DC_SERVER_IP
+     _msdcs.addom.samba.example.com -P --aging=1 gives
+     WERR_INTERNAL_DB_ERROR
+
+o  Andreas Schneider <asn at samba.org>
+   * BUG 16144: Incorrect behavior on stream create-disposition when prior
+     handle is closed
+
+o  Martin Schwenke <mschwenke at ddn.com>
+   * BUG 16082: An inactive node can run recovery resulting in inconsistent
+     databases
+
+o  Shachar Sharon <ssharon at redhat.com>
+   * BUG 16225: dns client problems related to EDNS usage
+
+o  Jennifer Sutton <jennifersutton at catalyst.net.nz>
+   * BUG 16225: dns client problems related to EDNS usage
+
+
+#######################################
+Reporting bugs & Development Discussion
+#######################################
+
+Please discuss this release on the samba-technical mailing list or by
+joining the #samba-technical:matrix.org matrix room, or
+#samba-technical IRC channel on irc.libera.chat.
+
+If you do report problems then please try to send high quality
+feedback. If you don't provide vital information to help us track down
+the problem then you will probably be ignored.  All bug reports should
+be filed under the Samba 4.1 and newer product in the project's Bugzilla
+database (https://bugzilla.samba.org/).
+
+
+======================================================================
+== Our Code, Our Bugs, Our Responsibility.
+== The Samba Team
+======================================================================
+
+
+Release notes for older releases follow:
+----------------------------------------
                    ==============================
                    Release Notes for Samba 4.24.6
                           August 13, 2026
@@ -64,8 +134,7 @@ database (https://bugzilla.samba.org/).
 ======================================================================
 
 
-Release notes for older releases follow:
-----------------------------------------
+----------------------------------------------------------------------
                    ==============================
                    Release Notes for Samba 4.24.5
                            July 28, 2026
diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c
index 2e56fb77f31..9c206b3a3cf 100644
--- a/ctdb/server/ctdb_recoverd.c
+++ b/ctdb/server/ctdb_recoverd.c
@@ -1279,6 +1279,37 @@ done:
 	return ok;
 }
 
+static struct ctdb_node_map_old *update_node_map_and_flags(
+	struct ctdb_recoverd *rec)
+{
+	struct ctdb_context *ctdb = rec->ctdb;
+	struct ctdb_node_map_old *nodemap = NULL;
+	unsigned int i = 0;
+	int ret = 0;
+
+	ret = ctdb_ctrl_getnodemap(ctdb,
+				   CONTROL_TIMEOUT(),
+				   rec->pnn,
+				   rec,
+				   &nodemap);
+	if (ret != 0) {
+		return NULL;
+	}
+
+	talloc_free(rec->nodemap);
+	rec->nodemap = nodemap;
+
+	/* Remember this node's flags */
+	for (i = 0; i < nodemap->num; i++) {
+		if (nodemap->nodes[i].pnn == rec->pnn) {
+			rec->node_flags = nodemap->nodes[i].flags;
+			break;
+		}
+	}
+
+	return nodemap;
+}
+
 static int db_recovery_parallel(struct ctdb_recoverd *rec, TALLOC_CTX *mem_ctx)
 {
 	static char prog[PATH_MAX+1] = "";
@@ -1307,13 +1338,24 @@ static int db_recovery_parallel(struct ctdb_recoverd *rec, TALLOC_CTX *mem_ctx)
 static int do_recovery(struct ctdb_recoverd *rec, TALLOC_CTX *mem_ctx)
 {
 	struct ctdb_context *ctdb = rec->ctdb;
-	struct ctdb_node_map_old *nodemap = rec->nodemap;
+	struct ctdb_node_map_old *nodemap = NULL;
 	unsigned int i;
 	int ret;
 	bool self_ban;
 
 	DBG_NOTICE("Starting do_recovery\n");
 
+	nodemap = update_node_map_and_flags(rec);
+	if (nodemap == NULL) {
+		DBG_ERR("Unable to get nodemap from node %"PRIu32"\n", rec->pnn);
+		return -1;
+	}
+
+	if (!this_node_can_be_leader(rec)) {
+		DBG_ERR("This node can no longer be leader, abort recovery\n");
+		return -1;
+	}
+
 	/* Check if the current node is still the leader.  It's possible that
 	 * re-election has changed the leader.
 	 */
@@ -2601,21 +2643,11 @@ static void main_loop(struct ctdb_context *ctdb, struct ctdb_recoverd *rec,
 		return;
 	}
 
-	/* get nodemap */
-	ret = ctdb_ctrl_getnodemap(ctdb,
-				   CONTROL_TIMEOUT(),
-				   rec->pnn,
-				   rec,
-				   &nodemap);
-	if (ret != 0) {
+	nodemap = update_node_map_and_flags(rec);
+	if (nodemap == NULL) {
 		DBG_ERR("Unable to get nodemap from node %"PRIu32"\n", rec->pnn);
 		return;
 	}
-	talloc_free(rec->nodemap);
-	rec->nodemap = nodemap;
-
-	/* remember our own node flags */
-	rec->node_flags = nodemap->nodes[rec->pnn].flags;
 
 	ban_misbehaving_nodes(rec, &self_ban);
 	if (self_ban) {
diff --git a/lib/param/param.h b/lib/param/param.h
index ed10fa9e90d..6cf27c24597 100644
--- a/lib/param/param.h
+++ b/lib/param/param.h
@@ -188,7 +188,6 @@ void lpcfg_smbcli_options(struct loadparm_context *lp_ctx,
 void lpcfg_smbcli_session_options(struct loadparm_context *lp_ctx,
 				 struct smbcli_session_options *options);
 const char *lpcfg_socket_options(struct loadparm_context *);
-struct dcerpc_server_info *lpcfg_dcerpc_server_info(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx);
 struct gensec_settings *lpcfg_gensec_settings(TALLOC_CTX *, struct loadparm_context *);
 
 /* The following definitions come from param/util.c  */
diff --git a/libcli/dns/dns.c b/libcli/dns/dns.c
index 81144601bb8..1d285f50133 100644
--- a/libcli/dns/dns.c
+++ b/libcli/dns/dns.c
@@ -23,16 +23,18 @@
 #include "system/network.h"
 #include <tevent.h>
 #include "lib/tsocket/tsocket.h"
+#include "source3/lib/util_tsock.h"
 #include "libcli/dns/libdns.h"
 #include "lib/util/tevent_unix.h"
-#include "lib/util/samba_util.h"
 #include "lib/util/debug.h"
+#include "lib/util/samba_util.h"
 #include "libcli/util/error.h"
 #include "librpc/ndr/libndr.h"
 #include "librpc/gen_ndr/ndr_dns.h"
 
 struct dns_udp_request_state {
 	struct tevent_context *ev;
+	const struct dns_name_packet *q;
 	struct tdgram_context *dgram;
 	size_t query_len;
 	uint8_t *reply;
@@ -42,19 +44,21 @@ struct dns_udp_request_state {
 #define DNS_REQUEST_TIMEOUT 10
 
 /* Declare callback functions used below. */
-static void dns_udp_request_get_reply(struct tevent_req *subreq);
+static void dns_udp_request_sent(struct tevent_req *subreq);
 static void dns_udp_request_done(struct tevent_req *subreq);
 
-static struct tevent_req *dns_udp_request_send(TALLOC_CTX *mem_ctx,
-					       struct tevent_context *ev,
-					       const char *server_addr_string,
-					       const uint8_t *query,
-					       size_t query_len)
+static struct tevent_req *dns_udp_request_send(
+	TALLOC_CTX *mem_ctx,
+	struct tevent_context *ev,
+	const char *server_addr_string,
+	const struct dns_name_packet *_q)
 {
 	struct tevent_req *req, *subreq;
 	struct dns_udp_request_state *state;
+	struct dns_name_packet *udp_q = NULL;
+	DATA_BLOB blob = {};
+	enum ndr_err_code ndr_err;
 	struct tsocket_address *local_addr, *server_addr;
-	struct tdgram_context *dgram;
 	int ret;
 
 	req = tevent_req_create(mem_ctx, &state, struct dns_udp_request_state);
@@ -63,6 +67,52 @@ static struct tevent_req *dns_udp_request_send(TALLOC_CTX *mem_ctx,
 	}
 
 	state->ev = ev;
+	state->q = _q;
+
+	if (_q->arcount == UINT16_MAX) {
+		tevent_req_error(req, EMSGSIZE);
+		return tevent_req_post(req, ev);
+	}
+
+	/*
+	 * Add minimal EDNS0 OPT record to ADDITIONAL section when
+	 * sending a DNS request out, indicating we can accept DNS
+	 * packets up to 4Kb in size.
+	 */
+	udp_q = talloc_memdup(state, _q, sizeof(struct dns_name_packet));
+	if (tevent_req_nomem(udp_q, req)) {
+		return tevent_req_post(req, ev);
+	}
+	udp_q->additional = talloc_array(udp_q,
+					 struct dns_res_rec,
+					 _q->arcount + 1);
+	if (tevent_req_nomem(udp_q->additional, req)) {
+		return tevent_req_post(req, ev);
+	}
+	if (_q->additional != NULL) {
+		memcpy(udp_q->additional,
+		       _q->additional,
+		       sizeof(struct dns_res_rec) * _q->arcount);
+	}
+
+	udp_q->additional[_q->arcount] = (struct dns_res_rec){
+		.name = "",
+		.rr_type = DNS_QTYPE_OPT,
+		.rr_class = 4096 /* 4096 bytes UDP buffer size */
+	};
+	udp_q->arcount += 1;
+
+	ndr_err = ndr_push_struct_blob(&blob,
+				       state,
+				       udp_q,
+				       (ndr_push_flags_fn_t)
+					       ndr_push_dns_name_packet);
+	TALLOC_FREE(udp_q);
+
+	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+		tevent_req_error(req, ndr_map_error2errno(ndr_err));
+		return tevent_req_post(req, ev);
+	}
 
 	/* Use connected UDP sockets */
 	ret = tsocket_address_inet_from_strings(state, "ip", NULL, 0,
@@ -79,18 +129,21 @@ static struct tevent_req *dns_udp_request_send(TALLOC_CTX *mem_ctx,
 		return tevent_req_post(req, ev);
 	}
 
-	ret = tdgram_inet_udp_socket(local_addr, server_addr, state, &dgram);
+	ret = tdgram_inet_udp_socket(local_addr,
+				     server_addr,
+				     state,
+				     &state->dgram);
 	if (ret != 0) {
 		tevent_req_error(req, errno);
 		return tevent_req_post(req, ev);
 	}
 
-	state->dgram = dgram;
-	state->query_len = query_len;
+	state->query_len = blob.length;
 
-	dump_data(10, query, query_len);
+	dump_data(10, blob.data, blob.length);
 
-	subreq = tdgram_sendto_send(state, ev, dgram, query, query_len, NULL);
+	subreq = tdgram_sendto_send(
+		state, ev, state->dgram, blob.data, blob.length, NULL);
 	if (tevent_req_nomem(subreq, req)) {
 		return tevent_req_post(req, ev);
 	}
@@ -100,11 +153,11 @@ static struct tevent_req *dns_udp_request_send(TALLOC_CTX *mem_ctx,
 		return tevent_req_post(req, ev);
 	}
 
-	tevent_req_set_callback(subreq, dns_udp_request_get_reply, req);
+	tevent_req_set_callback(subreq, dns_udp_request_sent, req);
 	return req;
 }
 
-static void dns_udp_request_get_reply(struct tevent_req *subreq)
+static void dns_udp_request_sent(struct tevent_req *subreq)
 {
 	struct tevent_req *req = tevent_req_callback_data(subreq,
 						struct tevent_req);
@@ -138,9 +191,8 @@ static void dns_udp_request_done(struct tevent_req *subreq)
 {
 	struct tevent_req *req = tevent_req_callback_data(subreq,
 						struct tevent_req);
-	struct dns_udp_request_state *state = tevent_req_data(req,
-						struct dns_udp_request_state);
-
+	struct dns_udp_request_state *state = tevent_req_data(
+		req, struct dns_udp_request_state);
 	ssize_t len;
 	int err = 0;
 
@@ -180,9 +232,9 @@ static int dns_udp_request_recv(struct tevent_req *req,
 
 struct dns_tcp_request_state {
 	struct tevent_context *ev;
+	const struct dns_name_packet *q;
 	struct tstream_context *stream;
-	const uint8_t *query;
-	size_t query_len;
+	DATA_BLOB query;
 
 	uint8_t dns_msglen_hdr[2];
 	struct iovec iov[2];
@@ -193,21 +245,19 @@ struct dns_tcp_request_state {
 
 static void dns_tcp_request_connected(struct tevent_req *subreq);
 static void dns_tcp_request_sent(struct tevent_req *subreq);
-static int dns_tcp_request_next_vector(struct tstream_context *stream,
-				       void *private_data,
-				       TALLOC_CTX *mem_ctx,
-				       struct iovec **_vector,
-				       size_t *_count);
+static ssize_t dns_tcp_request_more(uint8_t *buf,
+				    size_t buflen,
+				    void *private_data);
 static void dns_tcp_request_received(struct tevent_req *subreq);
 
 static struct tevent_req *dns_tcp_request_send(TALLOC_CTX *mem_ctx,
 					       struct tevent_context *ev,
 					       const char *server_addr_string,
-					       const uint8_t *query,
-					       size_t query_len)
+					       const struct dns_name_packet *q)
 {
 	struct tevent_req *req, *subreq;
 	struct dns_tcp_request_state *state;
+	enum ndr_err_code ndr_err;
 	struct tsocket_address *local, *remote;
 	int ret;
 
@@ -217,10 +267,19 @@ static struct tevent_req *dns_tcp_request_send(TALLOC_CTX *mem_ctx,
 		return NULL;
 	}
 	state->ev = ev;
-	state->query = query;
-	state->query_len = query_len;
+	state->q = q;
 
-	if (query_len > UINT16_MAX) {
+	ndr_err = ndr_push_struct_blob(&state->query,
+				       state,
+				       q,
+				       (ndr_push_flags_fn_t)
+					       ndr_push_dns_name_packet);
+	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+		tevent_req_error(req, ndr_map_error2errno(ndr_err));
+		return tevent_req_post(req, ev);
+	}
+
+	if (state->query.length > UINT16_MAX) {
 		tevent_req_error(req, EMSGSIZE);
 		return tevent_req_post(req, ev);
 	}
@@ -264,14 +323,14 @@ static void dns_tcp_request_connected(struct tevent_req *subreq)
 		return;
 	}
 
-	RSSVAL(state->dns_msglen_hdr, 0, state->query_len);
+	RSSVAL(state->dns_msglen_hdr, 0, state->query.length);
 	state->iov[0] = (struct iovec) {
 		.iov_base = state->dns_msglen_hdr,
 		.iov_len = sizeof(state->dns_msglen_hdr)
 	};
-	state->iov[1] = (struct iovec) {
-		.iov_base = discard_const_p(void, state->query),
-		.iov_len = state->query_len
+	state->iov[1] = (struct iovec){
+		.iov_base = discard_const_p(void, state->query.data),
+		.iov_len = state->query.length,
 	};
 
 	subreq = tstream_writev_send(state, state->ev, state->stream,
@@ -297,76 +356,37 @@ static void dns_tcp_request_sent(struct tevent_req *subreq)
 		return;
 	}
 
-	subreq = tstream_readv_pdu_send(state, state->ev, state->stream,
-					dns_tcp_request_next_vector, state);
+	subreq = tstream_read_packet_send(state,
+					  state->ev,
+					  state->stream,
+					  2,
+					  dns_tcp_request_more,
+					  NULL);
 	if (tevent_req_nomem(subreq, req)) {
 		return;
 	}
 	tevent_req_set_callback(subreq, dns_tcp_request_received, req);
 }
 
-static int dns_tcp_request_next_vector(struct tstream_context *stream,
-				       void *private_data,
-				       TALLOC_CTX *mem_ctx,
-				       struct iovec **_vector,
-				       size_t *_count)
+static ssize_t dns_tcp_request_more(uint8_t *buf,
+				    size_t buflen,
+				    void *private_data)
 {
-	struct dns_tcp_request_state *state = talloc_get_type_abort(
-		private_data, struct dns_tcp_request_state);
-	struct iovec *vector;
-	uint16_t msglen;
-
-	if (state->nread == 0) {
-		vector = talloc_array(mem_ctx, struct iovec, 1);
-		if (vector == NULL) {
-			return -1;
-		}
-		vector[0] = (struct iovec) {
-			.iov_base = state->dns_msglen_hdr,
-			.iov_len = sizeof(state->dns_msglen_hdr)
-		};
-		state->nread = sizeof(state->dns_msglen_hdr);
-
-		*_vector = vector;
-		*_count = 1;
-		return 0;
-	}
-
-	if (state->nread == sizeof(state->dns_msglen_hdr)) {
-		msglen = RSVAL(state->dns_msglen_hdr, 0);
-
-		state->reply = talloc_array(state, uint8_t, msglen);
-		if (state->reply == NULL) {
-			return -1;
-		}


-- 
Samba Shared Repository



More information about the samba-cvs mailing list