diff options
author | Zach Loafman <zachary.loafman@isilon.com> | 2009-03-27 19:12:43 -0700 |
---|---|---|
committer | Steven Danneman <steven.danneman@isilon.com> | 2009-03-28 01:01:47 -0700 |
commit | 92f3686c962d67a5feab00b9e8abdb87ddb832a6 (patch) | |
tree | 2a5d7f2b2cc61195a6704157766d58fbc1164581 /source4/libcli/smb2 | |
parent | 0b890ae19a6e9dad9bdff248ada3fdee9416ab96 (diff) | |
download | samba-92f3686c962d67a5feab00b9e8abdb87ddb832a6.tar.gz samba-92f3686c962d67a5feab00b9e8abdb87ddb832a6.tar.bz2 samba-92f3686c962d67a5feab00b9e8abdb87ddb832a6.zip |
s4:smb2: Add rudimentary SMB2.1 lease support to libcli
Add the structures, constants, and marshalling for SMB2.1 leases.
Diffstat (limited to 'source4/libcli/smb2')
-rw-r--r-- | source4/libcli/smb2/create.c | 30 | ||||
-rw-r--r-- | source4/libcli/smb2/smb2.h | 8 |
2 files changed, 38 insertions, 0 deletions
diff --git a/source4/libcli/smb2/create.c b/source4/libcli/smb2/create.c index 8a40e56a00..344be60f6e 100644 --- a/source4/libcli/smb2/create.c +++ b/source4/libcli/smb2/create.c @@ -312,6 +312,23 @@ struct smb2_request *smb2_create_send(struct smb2_tree *tree, struct smb2_create } } + if (io->in.lease_request) { + uint8_t data[32]; + + memcpy(&data[0], io->in.lease_request->lease_key, 16); + SIVAL(data, 16, io->in.lease_request->lease_state); + SIVAL(data, 20, io->in.lease_request->lease_flags); + SBVAL(data, 24, io->in.lease_request->lease_duration); + + status = smb2_create_blob_add(req, &blobs, + SMB2_CREATE_TAG_RQLS, + data_blob_const(data, 32)); + if (!NT_STATUS_IS_OK(status)) { + talloc_free(req); + return NULL; + } + } + /* and any custom blobs */ for (i=0;i<io->in.blobs.num_blobs;i++) { status = smb2_create_blob_add(req, &blobs, @@ -402,6 +419,19 @@ NTSTATUS smb2_create_recv(struct smb2_request *req, TALLOC_CTX *mem_ctx, struct } memcpy(io->out.on_disk_id, io->out.blobs.blobs[i].data.data, 32); } + if (strcmp(io->out.blobs.blobs[i].tag, SMB2_CREATE_TAG_RQLS) == 0) { + uint8_t *data; + if (io->out.blobs.blobs[i].data.length != 32) { + smb2_request_destroy(req); + return NT_STATUS_INVALID_NETWORK_RESPONSE; + } + + data = io->out.blobs.blobs[i].data.data; + memcpy(io->out.lease_response.lease_key, data, 16); + io->out.lease_response.lease_state = IVAL(data, 16); + io->out.lease_response.lease_flags = IVAL(data, 20); + io->out.lease_response.lease_duration = BVAL(data, 24); + } } data_blob_free(&blob); diff --git a/source4/libcli/smb2/smb2.h b/source4/libcli/smb2/smb2.h index 7c07c84740..fd961ce5f3 100644 --- a/source4/libcli/smb2/smb2.h +++ b/source4/libcli/smb2/smb2.h @@ -263,6 +263,13 @@ struct smb2_request { #define SMB2_OPLOCK_LEVEL_II 0x01 #define SMB2_OPLOCK_LEVEL_EXCLUSIVE 0x08 #define SMB2_OPLOCK_LEVEL_BATCH 0x09 +#define SMB2_OPLOCK_LEVEL_LEASE 0xFF + +/* SMB2 lease bits */ +#define SMB2_LEASE_NONE 0x00 +#define SMB2_LEASE_READ 0x01 +#define SMB2_LEASE_HANDLE 0x02 +#define SMB2_LEASE_WRITE 0x04 /* SMB2 impersonation levels */ #define SMB2_IMPERSONATION_ANONYMOUS 0x00 @@ -279,6 +286,7 @@ struct smb2_request { #define SMB2_CREATE_TAG_ALSI "AlSi" #define SMB2_CREATE_TAG_TWRP "TWrp" #define SMB2_CREATE_TAG_QFID "QFid" +#define SMB2_CREATE_TAG_RQLS "RqLs" /* SMB2 Create ignore some more create_options */ #define SMB2_CREATE_OPTIONS_NOT_SUPPORTED_MASK (NTCREATEX_OPTIONS_TREE_CONNECTION | \ |