summaryrefslogtreecommitdiff
path: root/source4/libcli/smb2
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-05-20 10:46:38 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:08:11 -0500
commite306c5bf129a981693bd251d45597f1e584ee850 (patch)
tree54e78bf5ba441d9f780d1e987cd9ff72b0911f23 /source4/libcli/smb2
parent2de1d5f7a8c2a3a815d81c217c274d2d5f1768cb (diff)
downloadsamba-e306c5bf129a981693bd251d45597f1e584ee850.tar.gz
samba-e306c5bf129a981693bd251d45597f1e584ee850.tar.bz2
samba-e306c5bf129a981693bd251d45597f1e584ee850.zip
r15741: move smb2 request structures into the main smb request structs
as new levels metze (This used to be commit 91806353174704857dfcc15a730af7232cfde660)
Diffstat (limited to 'source4/libcli/smb2')
-rw-r--r--source4/libcli/smb2/close.c2
-rw-r--r--source4/libcli/smb2/create.c2
-rw-r--r--source4/libcli/smb2/find.c2
-rw-r--r--source4/libcli/smb2/flush.c2
-rw-r--r--source4/libcli/smb2/ioctl.c4
-rw-r--r--source4/libcli/smb2/read.c2
-rw-r--r--source4/libcli/smb2/smb2_calls.h265
-rw-r--r--source4/libcli/smb2/write.c2
8 files changed, 8 insertions, 273 deletions
diff --git a/source4/libcli/smb2/close.c b/source4/libcli/smb2/close.c
index 4483f3c75b..9156e7d10d 100644
--- a/source4/libcli/smb2/close.c
+++ b/source4/libcli/smb2/close.c
@@ -37,7 +37,7 @@ struct smb2_request *smb2_close_send(struct smb2_tree *tree, struct smb2_close *
SSVAL(req->out.body, 0x02, io->in.flags);
SIVAL(req->out.body, 0x04, 0); /* pad */
- smb2_push_handle(req->out.body+0x08, &io->in.handle);
+ smb2_push_handle(req->out.body+0x08, &io->in.file.handle);
smb2_transport_send(req);
diff --git a/source4/libcli/smb2/create.c b/source4/libcli/smb2/create.c
index 339258a0df..da21d090fd 100644
--- a/source4/libcli/smb2/create.c
+++ b/source4/libcli/smb2/create.c
@@ -144,7 +144,7 @@ NTSTATUS smb2_create_recv(struct smb2_request *req, TALLOC_CTX *mem_ctx, struct
io->out.size = BVAL(req->in.body, 0x30);
io->out.file_attr = IVAL(req->in.body, 0x38);
io->out._pad = IVAL(req->in.body, 0x3C);
- smb2_pull_handle(req->in.body+0x40, &io->out.handle);
+ smb2_pull_handle(req->in.body+0x40, &io->out.file.handle);
status = smb2_pull_o32s32_blob(&req->in, mem_ctx, req->in.body+0x50, &io->out.blob);
if (!NT_STATUS_IS_OK(status)) {
smb2_request_destroy(req);
diff --git a/source4/libcli/smb2/find.c b/source4/libcli/smb2/find.c
index e811095f42..8f4d6c8301 100644
--- a/source4/libcli/smb2/find.c
+++ b/source4/libcli/smb2/find.c
@@ -39,7 +39,7 @@ struct smb2_request *smb2_find_send(struct smb2_tree *tree, struct smb2_find *io
SCVAL(req->out.body, 0x02, io->in.level);
SCVAL(req->out.body, 0x03, io->in.continue_flags);
SIVAL(req->out.body, 0x04, io->in.unknown);
- smb2_push_handle(req->out.body+0x08, &io->in.handle);
+ smb2_push_handle(req->out.body+0x08, &io->in.file.handle);
status = smb2_push_o16s16_string(&req->out, 0x18, io->in.pattern);
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source4/libcli/smb2/flush.c b/source4/libcli/smb2/flush.c
index 596eb26009..0eb5ed7a3b 100644
--- a/source4/libcli/smb2/flush.c
+++ b/source4/libcli/smb2/flush.c
@@ -36,7 +36,7 @@ struct smb2_request *smb2_flush_send(struct smb2_tree *tree, struct smb2_flush *
SSVAL(req->out.body, 0x02, 0); /* pad? */
SIVAL(req->out.body, 0x04, io->in.unknown);
- smb2_push_handle(req->out.body+0x08, &io->in.handle);
+ smb2_push_handle(req->out.body+0x08, &io->in.file.handle);
smb2_transport_send(req);
diff --git a/source4/libcli/smb2/ioctl.c b/source4/libcli/smb2/ioctl.c
index ffe029e16e..a3ac2d9f47 100644
--- a/source4/libcli/smb2/ioctl.c
+++ b/source4/libcli/smb2/ioctl.c
@@ -38,7 +38,7 @@ struct smb2_request *smb2_ioctl_send(struct smb2_tree *tree, struct smb2_ioctl *
SSVAL(req->out.body, 0x02, 0); /* pad */
SIVAL(req->out.body, 0x04, io->in.function);
- smb2_push_handle(req->out.body+0x08, &io->in.handle);
+ smb2_push_handle(req->out.body+0x08, &io->in.file.handle);
status = smb2_push_o32s32_blob(&req->out, 0x18, io->in.out);
if (!NT_STATUS_IS_OK(status)) {
@@ -80,7 +80,7 @@ NTSTATUS smb2_ioctl_recv(struct smb2_request *req,
io->out._pad = SVAL(req->in.body, 0x02);
io->out.function = IVAL(req->in.body, 0x04);
- smb2_pull_handle(req->in.body+0x08, &io->out.handle);
+ smb2_pull_handle(req->in.body+0x08, &io->out.file.handle);
status = smb2_pull_o32s32_blob(&req->in, mem_ctx, req->in.body+0x18, &io->out.in);
if (!NT_STATUS_IS_OK(status)) {
diff --git a/source4/libcli/smb2/read.c b/source4/libcli/smb2/read.c
index 82e9b13280..6806adb8f6 100644
--- a/source4/libcli/smb2/read.c
+++ b/source4/libcli/smb2/read.c
@@ -37,7 +37,7 @@ struct smb2_request *smb2_read_send(struct smb2_tree *tree, struct smb2_read *io
SSVAL(req->out.body, 0x02, 0); /* pad */
SIVAL(req->out.body, 0x04, io->in.length);
SBVAL(req->out.body, 0x08, io->in.offset);
- smb2_push_handle(req->out.body+0x10, &io->in.handle);
+ smb2_push_handle(req->out.body+0x10, &io->in.file.handle);
SBVAL(req->out.body, 0x20, io->in.unknown1);
SBVAL(req->out.body, 0x28, io->in.unknown2);
SCVAL(req->out.body, 0x30, io->in._bug);
diff --git a/source4/libcli/smb2/smb2_calls.h b/source4/libcli/smb2/smb2_calls.h
index b6f8fdef71..6bee0dec91 100644
--- a/source4/libcli/smb2/smb2_calls.h
+++ b/source4/libcli/smb2/smb2_calls.h
@@ -52,138 +52,6 @@ struct smb2_negprot {
} out;
};
-struct smb2_session_setup {
- struct {
- /* static body buffer 16 (0x10) bytes */
- /* uint16_t buffer_code; 0x11 = 0x10 + 1 */
- uint16_t _pad;
- uint32_t unknown2; /* 0xF */
- uint32_t unknown3; /* 0x00 */
- /* uint16_t secblob_ofs */
- /* uint16_t secblob_size */
-
- /* dynamic body */
- DATA_BLOB secblob;
- } in;
- struct {
- /* static body buffer 8 (0x08) bytes */
- /* uint16_t buffer_code; 0x09 = 0x08 +1 */
- uint16_t _pad;
- /* uint16_t secblob_ofs */
- /* uint16_t secblob_size */
-
- /* dynamic body */
- DATA_BLOB secblob;
-
- /* extracted from the SMB2 header */
- uint64_t uid;
- } out;
-};
-
-struct smb2_tree_connect {
- struct {
- /* static body buffer 8 (0x08) bytes */
- /* uint16_t buffer_code; 0x09 = 0x08 + 1 */
- uint16_t unknown1; /* 0x0000 */
- /* uint16_t path_ofs */
- /* uint16_t path_size */
-
- /* dynamic body */
- const char *path; /* as non-terminated UTF-16 on the wire */
- } in;
- struct {
- /* static body buffer 16 (0x10) bytes */
- /* uint16_t buffer_code; 0x10 */
- uint16_t unknown1; /* 0x02 */
- uint32_t unknown2; /* 0x00 */
- uint32_t unknown3; /* 0x00 */
- uint32_t access_mask;
-
- /* extracted from the SMB2 header */
- uint32_t tid;
- } out;
-};
-
-#define SMB2_CREATE_FLAG_REQUEST_OPLOCK 0x0100
-#define SMB2_CREATE_FLAG_REQUEST_EXCLUSIVE_OPLOCK 0x0800
-#define SMB2_CREATE_FLAG_GRANT_OPLOCK 0x0001
-#define SMB2_CREATE_FLAG_GRANT_EXCLUSIVE_OPLOCK 0x0080
-
-struct smb2_create {
- struct {
- /* static body buffer 56 (0x38) bytes */
- /* uint16_t buffer_code; 0x39 = 0x38 + 1 */
- uint16_t oplock_flags; /* SMB2_CREATE_FLAG_* */
- uint32_t impersonation;
- uint32_t unknown3[4];
- uint32_t access_mask;
-
- uint32_t file_attr;
- uint32_t share_access;
- uint32_t open_disposition;
- uint32_t create_options;
-
- /* uint16_t fname_ofs */
- /* uint16_t fname_size */
- /* uint32_t blob_ofs; */
- /* uint32_t blob_size; */
-
- /* dynamic body */
- const char *fname;
-
- /* optional list of extended attributes */
- struct smb_ea_list eas;
- } in;
-
- struct {
- /* static body buffer 88 (0x58) bytes */
- /* uint16_t buffer_code; 0x59 = 0x58 + 1 */
- uint16_t oplock_flags; /* SMB2_CREATE_FLAG_* */
- uint32_t create_action;
- NTTIME create_time;
- NTTIME access_time;
- NTTIME write_time;
- NTTIME change_time;
- uint64_t alloc_size;
- uint64_t size;
- uint32_t file_attr;
- uint32_t _pad;
- struct smb2_handle handle;
- /* uint32_t blob_ofs; */
- /* uint32_t blob_size; */
-
- /* dynamic body */
- DATA_BLOB blob;
- } out;
-};
-
-
-#define SMB2_CLOSE_FLAGS_FULL_INFORMATION (1<<0)
-
-struct smb2_close {
- struct {
- /* static body buffer 24 (0x18) bytes */
- /* uint16_t buffer_code; 0x18 */
- uint16_t flags; /* SMB2_CLOSE_FLAGS_* */
- uint32_t _pad;
- struct smb2_handle handle;
- } in;
-
- struct {
- /* static body buffer 60 (0x3C) bytes */
- /* uint16_t buffer_code; 0x3C */
- uint16_t flags;
- uint32_t _pad;
- NTTIME create_time;
- NTTIME access_time;
- NTTIME write_time;
- NTTIME change_time;
- uint64_t alloc_size;
- uint64_t size;
- uint32_t file_attr;
- } out;
-};
-
/* getinfo classes */
#define SMB2_GETINFO_FILE 0x01
#define SMB2_GETINFO_FS 0x02
@@ -230,139 +98,6 @@ struct smb2_setinfo {
} in;
};
-struct smb2_write {
- struct {
- /* static body buffer 48 (0x30) bytes */
- /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
- /* uint16_t data_ofs; */
- /* uint32_t data_size; */
- uint64_t offset;
- struct smb2_handle handle;
- uint64_t unknown1; /* 0xFFFFFFFFFFFFFFFF */
- uint64_t unknown2; /* 0xFFFFFFFFFFFFFFFF */
-
- /* dynamic body */
- DATA_BLOB data;
- } in;
-
- struct {
- /* static body buffer 17 (0x11) bytes */
- /* uint16_t buffer_code; 0x11 */
- uint16_t _pad;
- uint32_t nwritten;
- uint64_t unknown1; /* 0x0000000000000000 */
- uint8_t _bug;
- } out;
-};
-
-struct smb2_read {
- struct {
- /* static body buffer 48 (0x30) bytes */
- /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
- uint16_t _pad;
- uint32_t length;
- uint64_t offset;
- struct smb2_handle handle;
- uint64_t unknown1; /* 0x0000000000000000 */
- uint64_t unknown2; /* 0x0000000000000000 */
- uint8_t _bug;
- } in;
-
- struct {
- /* static body buffer 16 (0x10) bytes */
- /* uint16_t buffer_code; 0x11 = 0x10 + 1 */
- /* uint16_t data_ofs; */
- /* uint32_t data_size; */
- uint64_t unknown1; /* 0x0000000000000000 */
-
- /* dynamic body */
- DATA_BLOB data;
- } out;
-};
-
-/*
- SMB2 uses different level numbers for the same old SMB search levels
-*/
-#define SMB2_FIND_DIRECTORY_INFO 0x01
-#define SMB2_FIND_FULL_DIRECTORY_INFO 0x02
-#define SMB2_FIND_BOTH_DIRECTORY_INFO 0x03
-#define SMB2_FIND_NAME_INFO 0x0C
-#define SMB2_FIND_ID_BOTH_DIRECTORY_INFO 0x25
-#define SMB2_FIND_ID_FULL_DIRECTORY_INFO 0x26
-
-struct smb2_find {
- struct {
- /* static body buffer 32 (0x20) bytes */
- /* uint16_t buffer_code; 0x21 = 0x20 + 1 */
- uint8_t level;
- uint8_t continue_flags; /* SMB2_CONTINUE_FLAG_* */
- uint32_t unknown; /* perhaps a continue token? */
- struct smb2_handle handle;
- /* uint16_t pattern_ofs; */
- /* uint32_t pattern_size; */
- uint32_t max_response_size;
-
- /* dynamic body */
- const char *pattern;
- } in;
-
- struct {
- /* static body buffer 8 (0x08) bytes */
- /* uint16_t buffer_code; 0x08 */
- /* uint16_t blob_ofs; */
- /* uint32_t blob_size; */
-
- /* dynamic body */
- DATA_BLOB blob;
- } out;
-};
-
-struct smb2_ioctl {
- struct {
- /* static body buffer 56 (0x38) bytes */
- /* uint16_t buffer_code; 0x39 = 0x38 + 1 */
- uint16_t _pad;
- uint32_t function;
- struct smb2_handle handle;
- /* uint32_t out_ofs; */
- /* uint32_t out_size; */
- uint32_t unknown2;
- /* uint32_t in_ofs; */
- /* uint32_t in_size; */
- uint32_t max_response_size;
- uint64_t flags;
-
- /* dynamic body */
- DATA_BLOB out;
- DATA_BLOB in;
- } in;
-
- struct {
- /* static body buffer 48 (0x30) bytes */
- /* uint16_t buffer_code; 0x31 = 0x30 + 1 */
- uint16_t _pad;
- uint32_t function;
- struct smb2_handle handle;
- /* uint32_t in_ofs; */
- /* uint32_t in_size; */
- /* uint32_t out_ofs; */
- /* uint32_t out_size; */
- uint32_t unknown2;
- uint32_t unknown3;
-
- /* dynamic body */
- DATA_BLOB in;
- DATA_BLOB out;
- } out;
-};
-
-struct smb2_flush {
- struct {
- uint32_t unknown;
- struct smb2_handle handle;
- } in;
-};
-
struct cli_credentials;
struct event_context;
#include "libcli/smb2/smb2_proto.h"
diff --git a/source4/libcli/smb2/write.c b/source4/libcli/smb2/write.c
index 1edce3f773..760aadcd8e 100644
--- a/source4/libcli/smb2/write.c
+++ b/source4/libcli/smb2/write.c
@@ -42,7 +42,7 @@ struct smb2_request *smb2_write_send(struct smb2_tree *tree, struct smb2_write *
}
SBVAL(req->out.body, 0x08, io->in.offset);
- smb2_push_handle(req->out.body+0x10, &io->in.handle);
+ smb2_push_handle(req->out.body+0x10, &io->in.file.handle);
SBVAL(req->out.body, 0x20, io->in.unknown1);
SBVAL(req->out.body, 0x28, io->in.unknown2);