summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-06-27 17:16:14 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:09:35 -0500
commit7dc22bf3e019d2f68e52cbeab8eb3ad14d903cff (patch)
treed71838572ea18735b0471377fddea27ee5ad3a68
parent529aa3b885cfbea6706ef52a0f869a2424f13261 (diff)
downloadsamba-7dc22bf3e019d2f68e52cbeab8eb3ad14d903cff.tar.gz
samba-7dc22bf3e019d2f68e52cbeab8eb3ad14d903cff.tar.bz2
samba-7dc22bf3e019d2f68e52cbeab8eb3ad14d903cff.zip
r16566: add pull function for a site32/offset32 blob
metze (This used to be commit 81702c36c28e9e32860c5d91887d2ad2121ce306)
-rw-r--r--source4/libcli/smb2/request.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/source4/libcli/smb2/request.c b/source4/libcli/smb2/request.c
index 43445575f0..2f1117cf30 100644
--- a/source4/libcli/smb2/request.c
+++ b/source4/libcli/smb2/request.c
@@ -509,6 +509,30 @@ NTSTATUS smb2_pull_o32s32_blob(struct smb2_request_buffer *buf, TALLOC_CTX *mem_
}
/*
+ pull a uint32_t length/ uint32_t ofs/blob triple from a data blob
+ the ptr points to the start of the offset/length pair
+*/
+NTSTATUS smb2_pull_s32o32_blob(struct smb2_request_buffer *buf, TALLOC_CTX *mem_ctx, uint8_t *ptr, DATA_BLOB *blob)
+{
+ uint32_t ofs, size;
+ if (smb2_oob(buf, ptr, 8)) {
+ return NT_STATUS_BUFFER_TOO_SMALL;
+ }
+ size = IVAL(ptr, 0);
+ ofs = IVAL(ptr, 4);
+ if (ofs == 0 || size == 0) {
+ *blob = data_blob(NULL, 0);
+ return NT_STATUS_OK;
+ }
+ if (smb2_oob(buf, buf->hdr + ofs, size)) {
+ return NT_STATUS_BUFFER_TOO_SMALL;
+ }
+ *blob = data_blob_talloc(mem_ctx, buf->hdr + ofs, size);
+ NT_STATUS_HAVE_NO_MEMORY(blob->data);
+ return NT_STATUS_OK;
+}
+
+/*
pull a string in a uint16_t ofs/ uint16_t length/blob format
UTF-16 without termination
*/