From a9d0bf80459a574ac261a635ee9f68caf0e5f3b0 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 10 Nov 2005 00:25:57 +0000 Subject: r11618: added a generic '32 bit length prefix' full packet helper to the packet code (This used to be commit b4dbe55105cc2807a17d7e5bf8db9756cc526a3b) --- source4/lib/stream/packet.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'source4/lib/stream/packet.c') diff --git a/source4/lib/stream/packet.c b/source4/lib/stream/packet.c index 3a7a938249..f367368def 100644 --- a/source4/lib/stream/packet.c +++ b/source4/lib/stream/packet.c @@ -388,16 +388,31 @@ NTSTATUS packet_send(struct packet_context *pc, DATA_BLOB blob) /* a full request checker for NBT formatted packets (first 3 bytes are length) */ -NTSTATUS packet_full_request_nbt(void *private, DATA_BLOB blob, size_t *packet_size) +NTSTATUS packet_full_request_nbt(void *private, DATA_BLOB blob, size_t *size) { if (blob.length < 4) { return STATUS_MORE_ENTRIES; } - *packet_size = 4 + smb_len(blob.data); - if (*packet_size > blob.length) { + *size = 4 + smb_len(blob.data); + if (*size > blob.length) { return STATUS_MORE_ENTRIES; } return NT_STATUS_OK; } +/* + work out if a packet is complete for protocols that use a 32 bit network byte + order length +*/ +NTSTATUS packet_full_request_u32(void *private, DATA_BLOB blob, size_t *size) +{ + if (blob.length < 4) { + return STATUS_MORE_ENTRIES; + } + *size = 4 + RIVAL(blob.data, 0); + if (*size > blob.length) { + return STATUS_MORE_ENTRIES; + } + return NT_STATUS_OK; +} -- cgit