summaryrefslogtreecommitdiff
path: root/source4/lib/stream
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/stream')
-rw-r--r--source4/lib/stream/packet.c21
-rw-r--r--source4/lib/stream/packet.h4
2 files changed, 21 insertions, 4 deletions
diff --git a/source4/lib/stream/packet.c b/source4/lib/stream/packet.c
index 3a7a938249e..f367368defb 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;
+}
diff --git a/source4/lib/stream/packet.h b/source4/lib/stream/packet.h
index 196e20a3787..bba8a1940f8 100644
--- a/source4/lib/stream/packet.h
+++ b/source4/lib/stream/packet.h
@@ -46,5 +46,7 @@ void packet_queue_run(struct packet_context *pc);
/*
pre-canned handlers
*/
-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);
+NTSTATUS packet_full_request_u32(void *private, DATA_BLOB blob, size_t *size);
+