Changeset 988 for vendor/current/libcli/smb
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- Location:
- vendor/current/libcli/smb
- Files:
-
- 40 added
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/libcli/smb/smb2_constants.h
r746 r988 22 22 #ifndef __LIBCLI_SMB2_SMB2_CONSTANTS_H__ 23 23 #define __LIBCLI_SMB2_SMB2_CONSTANTS_H__ 24 25 /* offsets into SMB2_TRANSFORM header elements */ 26 #define SMB2_TF_PROTOCOL_ID 0x00 /* 4 bytes */ 27 #define SMB2_TF_SIGNATURE 0x04 /* 16 bytes */ 28 #define SMB2_TF_NONCE 0x14 /* 16 bytes */ 29 #define SMB2_TF_MSG_SIZE 0x24 /* 4 bytes */ 30 #define SMB2_TF_RESERVED 0x28 /* 2 bytes */ 31 #define SMB2_TF_FLAGS 0x2A /* 2 bytes */ 32 #define SMB2_TF_SESSION_ID 0x2C /* 8 bytes */ 33 34 #define SMB2_TF_HDR_SIZE 0x34 /* 52 bytes */ 35 36 #define SMB2_TF_MAGIC 0x424D53FD /* 0xFD 'S' 'M' 'B' */ 37 38 #define SMB2_TF_FLAGS_ENCRYPTED 0x0001 24 39 25 40 /* offsets into header elements for a sync SMB2 request */ … … 29 44 #define SMB2_HDR_EPOCH SMB2_HDR_CREDIT_CHARGE /* TODO: remove this */ 30 45 #define SMB2_HDR_STATUS 0x08 46 #define SMB2_HDR_CHANNEL_SEQUENCE SMB2_HDR_STATUS /* in requests */ 31 47 #define SMB2_HDR_OPCODE 0x0c 32 48 #define SMB2_HDR_CREDIT 0x0e … … 48 64 #define SMB2_HDR_FLAG_CHAINED 0x04 49 65 #define SMB2_HDR_FLAG_SIGNED 0x08 66 #define SMB2_HDR_FLAG_PRIORITY_MASK 0x70 50 67 #define SMB2_HDR_FLAG_DFS 0x10000000 68 #define SMB2_HDR_FLAG_REPLAY_OPERATION 0x20000000 69 70 #define SMB2_PRIORITY_MASK_TO_VALUE(__m) (((__m) & SMB2_HDR_FLAG_PRIORITY_MASK) >> 4) 71 #define SMB2_PRIORITY_VALUE_TO_MASK(__v) (((__v) << 4) & SMB2_HDR_FLAG_PRIORITY_MASK) 51 72 52 73 /* SMB2 opcodes */ 53 #define SMB2_OP_NEGPROT 54 #define SMB2_OP_SESSSETUP 55 #define SMB2_OP_LOGOFF 56 #define SMB2_OP_TCON 57 #define SMB2_OP_TDIS 58 #define SMB2_OP_CREATE 59 #define SMB2_OP_CLOSE 60 #define SMB2_OP_FLUSH 61 #define SMB2_OP_READ 62 #define SMB2_OP_WRITE 63 #define SMB2_OP_LOCK 64 #define SMB2_OP_IOCTL 65 #define SMB2_OP_CANCEL 66 #define SMB2_OP_KEEPALIVE 67 #define SMB2_OP_ FIND0x0e68 #define SMB2_OP_NOTIFY 69 #define SMB2_OP_GETINFO 70 #define SMB2_OP_SETINFO 71 #define SMB2_OP_BREAK 74 #define SMB2_OP_NEGPROT 0x00 75 #define SMB2_OP_SESSSETUP 0x01 76 #define SMB2_OP_LOGOFF 0x02 77 #define SMB2_OP_TCON 0x03 78 #define SMB2_OP_TDIS 0x04 79 #define SMB2_OP_CREATE 0x05 80 #define SMB2_OP_CLOSE 0x06 81 #define SMB2_OP_FLUSH 0x07 82 #define SMB2_OP_READ 0x08 83 #define SMB2_OP_WRITE 0x09 84 #define SMB2_OP_LOCK 0x0a 85 #define SMB2_OP_IOCTL 0x0b 86 #define SMB2_OP_CANCEL 0x0c 87 #define SMB2_OP_KEEPALIVE 0x0d 88 #define SMB2_OP_QUERY_DIRECTORY 0x0e 89 #define SMB2_OP_NOTIFY 0x0f 90 #define SMB2_OP_GETINFO 0x10 91 #define SMB2_OP_SETINFO 0x11 92 #define SMB2_OP_BREAK 0x12 72 93 73 94 #define SMB2_MAGIC 0x424D53FE /* 0xFE 'S' 'M' 'B' */ … … 77 98 #define SMB2_DIALECT_REVISION_202 0x0202 78 99 #define SMB2_DIALECT_REVISION_210 0x0210 100 #define SMB2_DIALECT_REVISION_222 0x0222 101 #define SMB2_DIALECT_REVISION_224 0x0224 102 #define SMB3_DIALECT_REVISION_300 0x0300 103 #define SMB3_DIALECT_REVISION_302 0x0302 104 #define SMB3_DIALECT_REVISION_310 0x0310 105 #define SMB3_DIALECT_REVISION_311 0x0311 79 106 #define SMB2_DIALECT_REVISION_2FF 0x02FF 80 107 … … 83 110 #define SMB2_NEGOTIATE_SIGNING_REQUIRED 0x02 84 111 85 /* SMB2 capabilities - only 1 so far. I'm sure more will be added */ 86 #define SMB2_CAP_DFS 0x00000001 87 #define SMB2_CAP_LEASING 0x00000002 /* only in dialect 0x210 */ 88 #define SMB2_CAP_LARGE_MTU 0x00000004 /* only in dialect 0x210 */ 112 /* SMB2 global capabilities */ 113 #define SMB2_CAP_DFS 0x00000001 114 #define SMB2_CAP_LEASING 0x00000002 /* only in dialect >= 0x210 */ 115 #define SMB2_CAP_LARGE_MTU 0x00000004 /* only in dialect >= 0x210 */ 116 #define SMB2_CAP_MULTI_CHANNEL 0x00000008 /* only in dialect >= 0x222 */ 117 #define SMB2_CAP_PERSISTENT_HANDLES 0x00000010 /* only in dialect >= 0x222 */ 118 #define SMB2_CAP_DIRECTORY_LEASING 0x00000020 /* only in dialect >= 0x222 */ 119 #define SMB2_CAP_ENCRYPTION 0x00000040 /* only in dialect >= 0x222 */ 120 89 121 /* so we can spot new caps as added */ 90 #define SMB2_CAP_ALL SMB2_CAP_DFS 91 92 /* SMB2 session flags */ 122 #define SMB2_CAP_ALL (\ 123 SMB2_CAP_DFS | \ 124 SMB2_CAP_LEASING | \ 125 SMB2_CAP_LARGE_MTU | \ 126 SMB2_CAP_MULTI_CHANNEL | \ 127 SMB2_CAP_PERSISTENT_HANDLES | \ 128 SMB2_CAP_DIRECTORY_LEASING | \ 129 SMB2_CAP_ENCRYPTION) 130 131 /* Types of SMB2 Negotiate Contexts - only in dialect >= 0x310 */ 132 #define SMB2_PREAUTH_INTEGRITY_CAPABILITIES 0x0001 133 #define SMB2_ENCRYPTION_CAPABILITIES 0x0002 134 135 /* Values for the SMB2_PREAUTH_INTEGRITY_CAPABILITIES Context (>= 0x310) */ 136 #define SMB2_PREAUTH_INTEGRITY_SHA512 0x0001 137 138 /* Values for the SMB2_ENCRYPTION_CAPABILITIES Context (>= 0x310) */ 139 #define SMB2_ENCRYPTION_AES128_CCM 0x0001 /* only in dialect >= 0x224 */ 140 #define SMB2_ENCRYPTION_AES128_GCM 0x0002 /* only in dialect >= 0x310 */ 141 #define SMB2_NONCE_HIGH_MAX(nonce_len_bytes) ((uint64_t)(\ 142 ((nonce_len_bytes) >= 16) ? UINT64_MAX : \ 143 ((nonce_len_bytes) <= 8) ? 0 : \ 144 (((uint64_t)1 << (((nonce_len_bytes) - 8)*8)) - 1) \ 145 )) 146 147 /* SMB2 session (request) flags */ 148 #define SMB2_SESSION_FLAG_BINDING 0x01 149 /* SMB2_SESSION_FLAG_ENCRYPT_DATA 0x04 only in dialect >= 0x310 */ 150 151 /* SMB2 session (response) flags */ 93 152 #define SMB2_SESSION_FLAG_IS_GUEST 0x0001 94 153 #define SMB2_SESSION_FLAG_IS_NULL 0x0002 154 #define SMB2_SESSION_FLAG_ENCRYPT_DATA 0x0004 /* in dialect >= 0x224 */ 155 156 /* SMB2 tree connect (request) flags */ 157 #define SMB2_SHAREFLAG_CLUSTER_RECONNECT 0x0001 /* only in dialect >= 0x310 */ 95 158 96 159 /* SMB2 sharetype flags */ … … 110 173 #define SMB2_SHAREFLAG_ALLOW_NAMESPACE_CACHING 0x0400 111 174 #define SMB2_SHAREFLAG_ACCESS_BASED_DIRECTORY_ENUM 0x0800 112 #define SMB2_SHAREFLAG_ALL 0x0F33 113 114 /* SMB2 share capafilities */ 115 #define SMB2_SHARE_CAP_DFS 0x8 175 #define SMB2_SHAREFLAG_FORCE_LEVELII_OPLOCKS 0x1000 176 #define SMB2_SHAREFLAG_ENABLE_HASH_V1 0x2000 177 #define SMB2_SHAREFLAG_ENABLE_HASH_V2 0x4000 178 #define SMB2_SHAREFLAG_ENCRYPT_DATA 0x8000 179 #define SMB2_SHAREFLAG_ALL 0xFF33 180 181 /* SMB2 share capabilities */ 182 #define SMB2_SHARE_CAP_DFS 0x8 183 #define SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY 0x10 /* in dialect >= 0x222 */ 184 #define SMB2_SHARE_CAP_SCALEOUT 0x20 /* in dialect >= 0x222 */ 185 #define SMB2_SHARE_CAP_CLUSTER 0x40 /* in dialect >= 0x222 */ 186 #define SMB2_SHARE_CAP_ASYMMETRIC 0x80 /* in dialect >= 0x302 */ 116 187 117 188 /* SMB2 create security flags */ … … 136 207 /* SMB2 lease bits */ 137 208 #define SMB2_LEASE_NONE 0x00 138 #define SMB2_LEASE_READ 0x01 139 #define SMB2_LEASE_HANDLE 0x02 140 #define SMB2_LEASE_WRITE 0x04 209 210 /* SMB2 lease flags */ 211 #define SMB2_LEASE_FLAG_BREAK_IN_PROGRESS 0x00000002 212 #define SMB2_LEASE_FLAG_PARENT_LEASE_KEY_SET 0x00000004 141 213 142 214 /* SMB2 lease break flags */ … … 159 231 #define SMB2_CREATE_TAG_QFID "QFid" 160 232 #define SMB2_CREATE_TAG_RQLS "RqLs" 233 #define SMB2_CREATE_TAG_DH2Q "DH2Q" 234 #define SMB2_CREATE_TAG_DH2C "DH2C" 235 #define SMB2_CREATE_TAG_AAPL "AAPL" 236 #define SMB2_CREATE_TAG_APP_INSTANCE_ID "\x45\xBC\xA6\x6A\xEF\xA7\xF7\x4A\x90\x08\xFA\x46\x2E\x14\x4D\x74" 237 #define SVHDX_OPEN_DEVICE_CONTEXT "\x9C\xCB\xCF\x9E\x04\xC1\xE6\x43\x98\x0E\x15\x8D\xA1\xF6\xEC\x83" 238 239 /* SMB2 notify flags */ 240 #define SMB2_WATCH_TREE 0x0001 161 241 162 242 /* SMB2 Create ignore some more create_options */ … … 188 268 #define SMB2_CLOSE_FLAGS_FULL_INFORMATION (0x01) 189 269 270 #define SMB2_READFLAG_READ_UNBUFFERED 0x01 271 272 #define SMB2_WRITEFLAG_WRITE_THROUGH 0x00000001 273 #define SMB2_WRITEFLAG_WRITE_UNBUFFERED 0x00000002 274 275 /* 2.2.31 SMB2 IOCTL Request */ 276 #define SMB2_IOCTL_FLAG_IS_FSCTL 0x00000001 277 278 /* 279 * Flags for durable handle v2 requests 280 */ 281 #define SMB2_DHANDLE_FLAG_PERSISTENT 0x00000002 282 190 283 #endif -
vendor/current/libcli/smb/smb2_create_blob.c
r746 r988 42 42 uint32_t next; 43 43 uint32_t name_offset, name_length; 44 uint32_t reserved,data_offset;44 uint32_t data_offset; 45 45 uint32_t data_length; 46 46 char *tag; … … 54 54 name_offset = SVAL(data, 4); 55 55 name_length = SVAL(data, 6); 56 #if 0 56 57 reserved = SVAL(data, 8); 58 #endif 57 59 data_offset = SVAL(data, 10); 58 60 data_length = IVAL(data, 12); … … 197 199 NT_STATUS_HAVE_NO_MEMORY(b->blobs[b->num_blobs].data.data); 198 200 } else { 199 b->blobs[b->num_blobs].data = data_blob (NULL, 0);201 b->blobs[b->num_blobs].data = data_blob_null; 200 202 } 201 203 -
vendor/current/libcli/smb/smb2_create_blob.h
r414 r988 34 34 }; 35 35 36 struct smb_create_returns { 37 uint8_t oplock_level; 38 uint32_t create_action; 39 NTTIME creation_time; 40 NTTIME last_access_time; 41 NTTIME last_write_time; 42 NTTIME change_time; 43 uint64_t allocation_size; 44 uint64_t end_of_file; 45 uint32_t file_attributes; 46 }; 47 36 48 /* 37 49 parse a set of SMB2 create blobs -
vendor/current/libcli/smb/smb_common.h
r414 r988 23 23 #define __LIBCLI_SMB_SMB_COMMON_H__ 24 24 25 #include "../libcli/smb/smb2_constants.h" 26 #include "../libcli/smb/smb2_create_blob.h" 25 #include "libcli/smb/smb_constants.h" 26 #include "libcli/smb/smb2_constants.h" 27 #include "libcli/smb/smb2_create_blob.h" 28 #include "libcli/smb/smb2_lease.h" 29 #include "libcli/smb/smb2_signing.h" 30 #include "libcli/smb/smb_util.h" 31 #include "libcli/smb/smb_unix_ext.h" 27 32 28 33 #endif
Note:
See TracChangeset
for help on using the changeset viewer.