1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

libnbt: Add an explicit "mem_ctx" to name_request_send

Implicitly hanging requests off nbtsock is too inflexible for future use

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Volker Lendecke 2018-02-04 12:16:14 +00:00 committed by Stefan Metzmacher
parent ce63db26a1
commit 5fea3e3f23
6 changed files with 10 additions and 8 deletions

View File

@ -56,7 +56,7 @@ _PUBLIC_ struct nbt_name_request *nbt_name_query_send(struct nbt_name_socket *nb
dest = socket_address_from_strings(packet, nbtsock->sock->backend_name,
io->in.dest_addr, io->in.dest_port);
if (dest == NULL) goto failed;
req = nbt_name_request_send(nbtsock, dest, packet,
req = nbt_name_request_send(nbtsock, nbtsock, dest, packet,
io->in.timeout, io->in.retries, false);
if (req == NULL) goto failed;
@ -160,7 +160,7 @@ _PUBLIC_ struct nbt_name_request *nbt_name_status_send(struct nbt_name_socket *n
dest = socket_address_from_strings(packet, nbtsock->sock->backend_name,
io->in.dest_addr, io->in.dest_port);
if (dest == NULL) goto failed;
req = nbt_name_request_send(nbtsock, dest, packet,
req = nbt_name_request_send(nbtsock, nbtsock, dest, packet,
io->in.timeout, io->in.retries, false);
if (req == NULL) goto failed;

View File

@ -72,7 +72,7 @@ struct nbt_name_request *nbt_name_refresh_send(struct nbt_name_socket *nbtsock,
nbtsock->sock->backend_name,
io->in.dest_addr, io->in.dest_port);
if (dest == NULL) goto failed;
req = nbt_name_request_send(nbtsock, dest, packet,
req = nbt_name_request_send(nbtsock, nbtsock, dest, packet,
io->in.timeout, io->in.retries, false);
if (req == NULL) goto failed;

View File

@ -80,7 +80,7 @@ struct nbt_name_request *nbt_name_register_send(struct nbt_name_socket *nbtsock,
dest = socket_address_from_strings(packet, nbtsock->sock->backend_name,
io->in.dest_addr, io->in.dest_port);
if (dest == NULL) goto failed;
req = nbt_name_request_send(nbtsock, dest, packet,
req = nbt_name_request_send(nbtsock, nbtsock, dest, packet,
io->in.timeout, io->in.retries, false);
if (req == NULL) goto failed;

View File

@ -69,7 +69,7 @@ _PUBLIC_ struct nbt_name_request *nbt_name_release_send(struct nbt_name_socket *
dest = socket_address_from_strings(packet, nbtsock->sock->backend_name,
io->in.dest_addr, io->in.dest_port);
if (dest == NULL) goto failed;
req = nbt_name_request_send(nbtsock, dest, packet,
req = nbt_name_request_send(nbtsock, nbtsock, dest, packet,
io->in.timeout, io->in.retries, false);
if (req == NULL) goto failed;

View File

@ -33,7 +33,8 @@
/* The following definitions come from ../libcli/nbt/nbtsocket.c */
struct nbt_name_request *nbt_name_request_send(struct nbt_name_socket *nbtsock,
struct nbt_name_request *nbt_name_request_send(TALLOC_CTX *mem_ctx,
struct nbt_name_socket *nbtsock,
struct socket_address *dest,
struct nbt_name_packet *request,
int timeout, int retries,

View File

@ -367,7 +367,8 @@ failed:
/*
send off a nbt name request
*/
struct nbt_name_request *nbt_name_request_send(struct nbt_name_socket *nbtsock,
struct nbt_name_request *nbt_name_request_send(TALLOC_CTX *mem_ctx,
struct nbt_name_socket *nbtsock,
struct socket_address *dest,
struct nbt_name_packet *request,
int timeout, int retries,
@ -377,7 +378,7 @@ struct nbt_name_request *nbt_name_request_send(struct nbt_name_socket *nbtsock,
int id;
enum ndr_err_code ndr_err;
req = talloc_zero(nbtsock, struct nbt_name_request);
req = talloc_zero(mem_ctx, struct nbt_name_request);
if (req == NULL) goto failed;
req->nbtsock = nbtsock;