1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-25 17:57:42 +03:00

s4:libcli/dgram: add nbt_dgram_send_raw() to send raw blobs

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15620

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Stefan Metzmacher 2024-02-14 13:49:21 +01:00
parent 77f4f1c7db
commit bfb10774b6
2 changed files with 35 additions and 0 deletions

View File

@ -209,6 +209,38 @@ NTSTATUS dgram_set_incoming_handler(struct nbt_dgram_socket *dgmsock,
return NT_STATUS_OK;
}
NTSTATUS nbt_dgram_send_raw(struct nbt_dgram_socket *dgmsock,
struct socket_address *dest,
const DATA_BLOB pkt_blob)
{
struct nbt_dgram_request *req;
NTSTATUS status = NT_STATUS_NO_MEMORY;
req = talloc(dgmsock, struct nbt_dgram_request);
if (req == NULL) {
goto failed;
}
req->dest = socket_address_copy(req, dest);
if (req->dest == NULL) {
goto failed;
}
req->encoded = data_blob_dup_talloc(req, pkt_blob);
if (req->encoded.length != pkt_blob.length) {
goto failed;
}
DLIST_ADD_END(dgmsock->send_queue, req);
TEVENT_FD_WRITEABLE(dgmsock->fde);
return NT_STATUS_OK;
failed:
talloc_free(req);
return status;
}
/*
queue a datagram for send

View File

@ -83,6 +83,9 @@ struct dgram_mailslot_handler {
/* prototypes */
NTSTATUS nbt_dgram_send_raw(struct nbt_dgram_socket *dgmsock,
struct socket_address *dest,
const DATA_BLOB pkt_blob);
NTSTATUS nbt_dgram_send(struct nbt_dgram_socket *dgmsock,
struct nbt_dgram_packet *packet,
struct socket_address *dest);