X-Git-Url: http://git.samba.org/samba.git/?a=blobdiff_plain;f=libcli%2Fsmb%2Fsmb2_constants.h;h=7ebff8d5c07eb4f44fd4df7c215fd6501f2e4482;hb=9aaeb67084185c71869f5dc297af1f7da5b4cdab;hp=f8736403cc5aec961889baf5945052e90f3b9c04;hpb=db632fdd2c5d14bcd05edc424ff66d7a3248dc2a;p=sharpe%2Fsamba-autobuild%2F.git diff --git a/libcli/smb/smb2_constants.h b/libcli/smb/smb2_constants.h index f8736403cc5..7ebff8d5c07 100644 --- a/libcli/smb/smb2_constants.h +++ b/libcli/smb/smb2_constants.h @@ -22,12 +22,28 @@ #ifndef __LIBCLI_SMB2_SMB2_CONSTANTS_H__ #define __LIBCLI_SMB2_SMB2_CONSTANTS_H__ +/* offsets into SMB2_TRANSFORM header elements */ +#define SMB2_TF_PROTOCOL_ID 0x00 /* 4 bytes */ +#define SMB2_TF_SIGNATURE 0x04 /* 16 bytes */ +#define SMB2_TF_NONCE 0x14 /* 16 bytes */ +#define SMB2_TF_MSG_SIZE 0x24 /* 4 bytes */ +#define SMB2_TF_RESERVED 0x28 /* 2 bytes */ +#define SMB2_TF_FLAGS 0x2A /* 2 bytes */ +#define SMB2_TF_SESSION_ID 0x2C /* 8 bytes */ + +#define SMB2_TF_HDR_SIZE 0x34 /* 52 bytes */ + +#define SMB2_TF_MAGIC 0x424D53FD /* 0xFD 'S' 'M' 'B' */ + +#define SMB2_TF_FLAGS_ENCRYPTED 0x0001 + /* offsets into header elements for a sync SMB2 request */ #define SMB2_HDR_PROTOCOL_ID 0x00 #define SMB2_HDR_LENGTH 0x04 #define SMB2_HDR_CREDIT_CHARGE 0x06 #define SMB2_HDR_EPOCH SMB2_HDR_CREDIT_CHARGE /* TODO: remove this */ #define SMB2_HDR_STATUS 0x08 +#define SMB2_HDR_CHANNEL_SEQUENCE SMB2_HDR_STATUS /* in requests */ #define SMB2_HDR_OPCODE 0x0c #define SMB2_HDR_CREDIT 0x0e #define SMB2_HDR_FLAGS 0x10 @@ -47,28 +63,33 @@ #define SMB2_HDR_FLAG_ASYNC 0x02 #define SMB2_HDR_FLAG_CHAINED 0x04 #define SMB2_HDR_FLAG_SIGNED 0x08 +#define SMB2_HDR_FLAG_PRIORITY_MASK 0x70 #define SMB2_HDR_FLAG_DFS 0x10000000 +#define SMB2_HDR_FLAG_REPLAY_OPERATION 0x20000000 + +#define SMB2_PRIORITY_MASK_TO_VALUE(__m) (((__m) & SMB2_HDR_FLAG_PRIORITY_MASK) >> 4) +#define SMB2_PRIORITY_VALUE_TO_MASK(__v) (((__v) << 4) & SMB2_HDR_FLAG_PRIORITY_MASK) /* SMB2 opcodes */ -#define SMB2_OP_NEGPROT 0x00 -#define SMB2_OP_SESSSETUP 0x01 -#define SMB2_OP_LOGOFF 0x02 -#define SMB2_OP_TCON 0x03 -#define SMB2_OP_TDIS 0x04 -#define SMB2_OP_CREATE 0x05 -#define SMB2_OP_CLOSE 0x06 -#define SMB2_OP_FLUSH 0x07 -#define SMB2_OP_READ 0x08 -#define SMB2_OP_WRITE 0x09 -#define SMB2_OP_LOCK 0x0a -#define SMB2_OP_IOCTL 0x0b -#define SMB2_OP_CANCEL 0x0c -#define SMB2_OP_KEEPALIVE 0x0d -#define SMB2_OP_FIND 0x0e -#define SMB2_OP_NOTIFY 0x0f -#define SMB2_OP_GETINFO 0x10 -#define SMB2_OP_SETINFO 0x11 -#define SMB2_OP_BREAK 0x12 +#define SMB2_OP_NEGPROT 0x00 +#define SMB2_OP_SESSSETUP 0x01 +#define SMB2_OP_LOGOFF 0x02 +#define SMB2_OP_TCON 0x03 +#define SMB2_OP_TDIS 0x04 +#define SMB2_OP_CREATE 0x05 +#define SMB2_OP_CLOSE 0x06 +#define SMB2_OP_FLUSH 0x07 +#define SMB2_OP_READ 0x08 +#define SMB2_OP_WRITE 0x09 +#define SMB2_OP_LOCK 0x0a +#define SMB2_OP_IOCTL 0x0b +#define SMB2_OP_CANCEL 0x0c +#define SMB2_OP_KEEPALIVE 0x0d +#define SMB2_OP_QUERY_DIRECTORY 0x0e +#define SMB2_OP_NOTIFY 0x0f +#define SMB2_OP_GETINFO 0x10 +#define SMB2_OP_SETINFO 0x11 +#define SMB2_OP_BREAK 0x12 #define SMB2_MAGIC 0x424D53FE /* 0xFE 'S' 'M' 'B' */ @@ -78,6 +99,10 @@ #define SMB2_DIALECT_REVISION_210 0x0210 #define SMB2_DIALECT_REVISION_222 0x0222 #define SMB2_DIALECT_REVISION_224 0x0224 +#define SMB3_DIALECT_REVISION_300 0x0300 +#define SMB3_DIALECT_REVISION_302 0x0302 +#define SMB3_DIALECT_REVISION_310 0x0310 +#define SMB3_DIALECT_REVISION_311 0x0311 #define SMB2_DIALECT_REVISION_2FF 0x02FF /* SMB2 negotiate security_mode */ @@ -100,12 +125,31 @@ SMB2_CAP_LARGE_MTU | \ SMB2_CAP_MULTI_CHANNEL | \ SMB2_CAP_PERSISTENT_HANDLES | \ + SMB2_CAP_DIRECTORY_LEASING | \ SMB2_CAP_ENCRYPTION) +/* Types of SMB2 Negotiate Contexts - only in dialect >= 0x310 */ +#define SMB2_PREAUTH_INTEGRITY_CAPABILITIES 0x0001 +#define SMB2_ENCRYPTION_CAPABILITIES 0x0002 + +/* Values for the SMB2_PREAUTH_INTEGRITY_CAPABILITIES Context (>= 0x310) */ +#define SMB2_PREAUTH_INTEGRITY_SHA512 0x0001 + +/* Values for the SMB2_ENCRYPTION_CAPABILITIES Context (>= 0x310) */ +#define SMB2_ENCRYPTION_AES128_CCM 0x0001 /* only in dialect >= 0x224 */ +#define SMB2_ENCRYPTION_AES128_GCM 0x0002 /* only in dialect >= 0x310 */ -/* SMB2 session flags */ +/* SMB2 session (request) flags */ +#define SMB2_SESSION_FLAG_BINDING 0x01 +/* SMB2_SESSION_FLAG_ENCRYPT_DATA 0x04 only in dialect >= 0x310 */ + +/* SMB2 session (response) flags */ #define SMB2_SESSION_FLAG_IS_GUEST 0x0001 #define SMB2_SESSION_FLAG_IS_NULL 0x0002 +#define SMB2_SESSION_FLAG_ENCRYPT_DATA 0x0004 /* in dialect >= 0x224 */ + +/* SMB2 tree connect (request) flags */ +#define SMB2_SHAREFLAG_CLUSTER_RECONNECT 0x0001 /* only in dialect >= 0x310 */ /* SMB2 sharetype flags */ #define SMB2_SHARE_TYPE_DISK 0x1 @@ -134,6 +178,7 @@ #define SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY 0x10 /* in dialect >= 0x222 */ #define SMB2_SHARE_CAP_SCALEOUT 0x20 /* in dialect >= 0x222 */ #define SMB2_SHARE_CAP_CLUSTER 0x40 /* in dialect >= 0x222 */ +#define SMB2_SHARE_CAP_ASYMMETRIC 0x80 /* in dialect >= 0x302 */ /* SMB2 create security flags */ #define SMB2_SECURITY_DYNAMIC_TRACKING 0x01 @@ -156,9 +201,10 @@ /* SMB2 lease bits */ #define SMB2_LEASE_NONE 0x00 -#define SMB2_LEASE_READ 0x01 -#define SMB2_LEASE_HANDLE 0x02 -#define SMB2_LEASE_WRITE 0x04 + +/* SMB2 lease flags */ +#define SMB2_LEASE_FLAG_BREAK_IN_PROGRESS 0x00000002 +#define SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET 0x00000004 /* SMB2 lease break flags */ #define SMB2_NOTIFY_BREAK_LEASE_FLAG_ACK_REQUIRED 0x01 @@ -181,6 +227,8 @@ #define SMB2_CREATE_TAG_RQLS "RqLs" #define SMB2_CREATE_TAG_DH2Q "DH2Q" #define SMB2_CREATE_TAG_DH2C "DH2C" +#define SMB2_CREATE_TAG_AAPL "AAPL" +#define SMB2_CREATE_TAG_APP_INSTANCE_ID "\x45\xBC\xA6\x6A\xEF\xA7\xF7\x4A\x90\x08\xFA\x46\x2E\x14\x4D\x74" /* SMB2 notify flags */ #define SMB2_WATCH_TREE 0x0001 @@ -213,6 +261,17 @@ #define SMB2_CLOSE_FLAGS_FULL_INFORMATION (0x01) +#define SMB2_READFLAG_READ_UNBUFFERED 0x01 + #define SMB2_WRITEFLAG_WRITE_THROUGH 0x00000001 +#define SMB2_WRITEFLAG_WRITE_UNBUFFERED 0x00000002 + +/* 2.2.31 SMB2 IOCTL Request */ +#define SMB2_IOCTL_FLAG_IS_FSCTL 0x00000001 + +/* + * Flags for durable handle v2 requests + */ +#define SMB2_DHANDLE_FLAG_PERSISTENT 0x00000002 #endif