From 3850d47fef103c4118f1baff4b91b403ab4dde71 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 2 Jun 2008 11:02:57 +1000 Subject: updated some info levels based on WSPP docs (This used to be commit f84620324a8cebcd2fd19388d910928ca1ad1334) --- source4/libcli/raw/interfaces.h | 17 +++++++++++++---- source4/libcli/raw/rawsetfileinfo.c | 29 +++++++++++++++++++++++------ source4/libcli/raw/trans2.h | 27 ++++++++++++++++----------- 3 files changed, 52 insertions(+), 21 deletions(-) (limited to 'source4/libcli') diff --git a/source4/libcli/raw/interfaces.h b/source4/libcli/raw/interfaces.h index 19d51893a6..8e23510f06 100644 --- a/source4/libcli/raw/interfaces.h +++ b/source4/libcli/raw/interfaces.h @@ -906,15 +906,24 @@ enum smb_setfileinfo_level { RAW_SFILEINFO_RENAME_INFORMATION = SMB_SFILEINFO_RENAME_INFORMATION, RAW_SFILEINFO_DISPOSITION_INFORMATION = SMB_SFILEINFO_DISPOSITION_INFORMATION, RAW_SFILEINFO_POSITION_INFORMATION = SMB_SFILEINFO_POSITION_INFORMATION, + RAW_SFILEINFO_FULL_EA_INFORMATION = SMB_SFILEINFO_FULL_EA_INFORMATION, RAW_SFILEINFO_MODE_INFORMATION = SMB_SFILEINFO_MODE_INFORMATION, RAW_SFILEINFO_ALLOCATION_INFORMATION = SMB_SFILEINFO_ALLOCATION_INFORMATION, RAW_SFILEINFO_END_OF_FILE_INFORMATION = SMB_SFILEINFO_END_OF_FILE_INFORMATION, - RAW_SFILEINFO_1023 = SMB_SFILEINFO_1023, + RAW_SFILEINFO_PIPE_INFORMATION = SMB_SFILEINFO_PIPE_INFORMATION, + RAW_SFILEINFO_VALID_DATA_INFORMATION = SMB_SFILEINFO_VALID_DATA_INFORMATION, + RAW_SFILEINFO_SHORT_NAME_INFORMATION = SMB_SFILEINFO_SHORT_NAME_INFORMATION, RAW_SFILEINFO_1025 = SMB_SFILEINFO_1025, + RAW_SFILEINFO_1027 = SMB_SFILEINFO_1027, RAW_SFILEINFO_1029 = SMB_SFILEINFO_1029, + RAW_SFILEINFO_1030 = SMB_SFILEINFO_1030, + RAW_SFILEINFO_1031 = SMB_SFILEINFO_1031, RAW_SFILEINFO_1032 = SMB_SFILEINFO_1032, - RAW_SFILEINFO_1039 = SMB_SFILEINFO_1039, - RAW_SFILEINFO_1040 = SMB_SFILEINFO_1040, + RAW_SFILEINFO_1036 = SMB_SFILEINFO_1036, + RAW_SFILEINFO_1041 = SMB_SFILEINFO_1041, + RAW_SFILEINFO_1042 = SMB_SFILEINFO_1042, + RAW_SFILEINFO_1043 = SMB_SFILEINFO_1043, + RAW_SFILEINFO_1044 = SMB_SFILEINFO_1044, /* cope with breakage in SMB2 */ RAW_SFILEINFO_RENAME_INFORMATION_SMB2 = SMB_SFILEINFO_RENAME_INFORMATION|0x80000000, @@ -1901,7 +1910,7 @@ union smb_lock { uint16_t ulock_cnt; uint16_t lock_cnt; struct smb_lock_entry { - uint16_t pid; + uint32_t pid; /* 16 bits in SMB1 */ uint64_t offset; uint64_t count; } *locks; /* unlocks are first in the arrray */ diff --git a/source4/libcli/raw/rawsetfileinfo.c b/source4/libcli/raw/rawsetfileinfo.c index 16052e8708..5a4706778a 100644 --- a/source4/libcli/raw/rawsetfileinfo.c +++ b/source4/libcli/raw/rawsetfileinfo.c @@ -110,12 +110,20 @@ bool smb_raw_setfileinfo_passthru(TALLOC_CTX *mem_ctx, } /* Unhandled levels */ - case RAW_SFILEINFO_1023: + case RAW_SFILEINFO_PIPE_INFORMATION: + case RAW_SFILEINFO_VALID_DATA_INFORMATION: + case RAW_SFILEINFO_SHORT_NAME_INFORMATION: case RAW_SFILEINFO_1025: + case RAW_SFILEINFO_1027: case RAW_SFILEINFO_1029: + case RAW_SFILEINFO_1030: + case RAW_SFILEINFO_1031: case RAW_SFILEINFO_1032: - case RAW_SFILEINFO_1039: - case RAW_SFILEINFO_1040: + case RAW_SFILEINFO_1036: + case RAW_SFILEINFO_1041: + case RAW_SFILEINFO_1042: + case RAW_SFILEINFO_1043: + case RAW_SFILEINFO_1044: break; default: @@ -227,12 +235,21 @@ static bool smb_raw_setinfo_backend(struct smbcli_tree *tree, parms, blob); /* Unhandled passthru levels */ - case RAW_SFILEINFO_1023: + case RAW_SFILEINFO_PIPE_INFORMATION: + case RAW_SFILEINFO_VALID_DATA_INFORMATION: + case RAW_SFILEINFO_SHORT_NAME_INFORMATION: + case RAW_SFILEINFO_FULL_EA_INFORMATION: case RAW_SFILEINFO_1025: + case RAW_SFILEINFO_1027: case RAW_SFILEINFO_1029: + case RAW_SFILEINFO_1030: + case RAW_SFILEINFO_1031: case RAW_SFILEINFO_1032: - case RAW_SFILEINFO_1039: - case RAW_SFILEINFO_1040: + case RAW_SFILEINFO_1036: + case RAW_SFILEINFO_1041: + case RAW_SFILEINFO_1042: + case RAW_SFILEINFO_1043: + case RAW_SFILEINFO_1044: return smb_raw_setfileinfo_passthru(mem_ctx, parms->generic.level, parms, blob); diff --git a/source4/libcli/raw/trans2.h b/source4/libcli/raw/trans2.h index 5b7987aa8c..63632eb5ed 100644 --- a/source4/libcli/raw/trans2.h +++ b/source4/libcli/raw/trans2.h @@ -217,32 +217,37 @@ Found 13 valid levels #define SMB_SFILEINFO_UNIX_INFO2 0x20b #define SMB_SFILEINFO_BASIC_INFORMATION 1004 #define SMB_SFILEINFO_RENAME_INFORMATION 1010 +#define SMB_SFILEINFO_LINK_INFORMATION 1011 #define SMB_SFILEINFO_DISPOSITION_INFORMATION 1013 #define SMB_SFILEINFO_POSITION_INFORMATION 1014 +#define SMB_SFILEINFO_FULL_EA_INFORMATION 1015 #define SMB_SFILEINFO_MODE_INFORMATION 1016 #define SMB_SFILEINFO_ALLOCATION_INFORMATION 1019 #define SMB_SFILEINFO_END_OF_FILE_INFORMATION 1020 - -/* filemon shows FilePipeInformation */ -#define SMB_SFILEINFO_1023 1023 +#define SMB_SFILEINFO_PIPE_INFORMATION 1023 +#define SMB_SFILEINFO_VALID_DATA_INFORMATION 1039 +#define SMB_SFILEINFO_SHORT_NAME_INFORMATION 1040 /* filemon shows FilePipeRemoteInformation */ #define SMB_SFILEINFO_1025 1025 +/* vista scan responds */ +#define SMB_SFILEINFO_1027 1027 + /* filemon shows CopyOnWriteInformation */ #define SMB_SFILEINFO_1029 1029 /* filemon shows OleClassIdInformation */ #define SMB_SFILEINFO_1032 1032 -/* seems to be the file size - perhaps valid data size? - filemon shows 'InheritContentIndexInfo' -*/ -#define SMB_SFILEINFO_1039 1039 - -/* OLE_INFORMATION? */ -#define SMB_SFILEINFO_1040 1040 - +/* vista scan responds to these */ +#define SMB_SFILEINFO_1030 1030 +#define SMB_SFILEINFO_1031 1031 +#define SMB_SFILEINFO_1036 1036 +#define SMB_SFILEINFO_1041 1041 +#define SMB_SFILEINFO_1042 1042 +#define SMB_SFILEINFO_1043 1043 +#define SMB_SFILEINFO_1044 1044 /* trans2 findfirst levels */ /* -- cgit From 7c926ff1150133127c73b9b46d82524f57b3c616 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 3 Jun 2008 14:29:27 +1000 Subject: SMB2 signing now works. The spec was wrong (and will be fixed in the next version) (This used to be commit 436cb17b869e2d6cc57936ccc5e81680fb992341) --- source4/libcli/smb2/signing.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'source4/libcli') diff --git a/source4/libcli/smb2/signing.c b/source4/libcli/smb2/signing.c index 01f7576134..16c0ff99c1 100644 --- a/source4/libcli/smb2/signing.c +++ b/source4/libcli/smb2/signing.c @@ -23,7 +23,7 @@ #include "libcli/raw/libcliraw.h" #include "libcli/smb2/smb2.h" #include "libcli/smb2/smb2_calls.h" -#include "heimdal/lib/hcrypto/sha.h" +#include "lib/crypto/crypto.h" /* NOTE: this code does not yet interoperate with the windows SMB2 @@ -54,7 +54,7 @@ NTSTATUS smb2_sign_message(struct smb2_request *req) { struct smb2_request_buffer *buf = &req->out; uint64_t session_id; - SHA256_CTX m; + struct HMACSHA256Context m; uint8_t res[32]; if (!req->transport->signing.doing_signing || @@ -85,11 +85,9 @@ NTSTATUS smb2_sign_message(struct smb2_request *req) SIVAL(buf->hdr, SMB2_HDR_FLAGS, IVAL(buf->hdr, SMB2_HDR_FLAGS) | SMB2_HDR_FLAG_SIGNED); ZERO_STRUCT(m); - SHA256_Init(&m); - SHA256_Update(&m, req->transport->signing.session_key.data, - req->transport->signing.session_key.length); - SHA256_Update(&m, buf->buffer+NBT_HDR_SIZE, buf->size-NBT_HDR_SIZE); - SHA256_Final(res, &m); + hmac_sha256_init(req->transport->signing.session_key.data, 16, &m); + hmac_sha256_update(buf->buffer+NBT_HDR_SIZE, buf->size-NBT_HDR_SIZE, &m); + hmac_sha256_final(res, &m); DEBUG(5,("signed SMB2 message of size %u\n", (unsigned)buf->size - NBT_HDR_SIZE)); @@ -110,7 +108,7 @@ NTSTATUS smb2_check_signature(struct smb2_transport *transport, uint8_t *buffer, uint_t length) { uint64_t session_id; - SHA256_CTX m; + struct HMACSHA256Context m; uint8_t res[SHA256_DIGEST_LENGTH]; uint8_t sig[16]; @@ -147,10 +145,9 @@ NTSTATUS smb2_check_signature(struct smb2_transport *transport, memset(buffer + NBT_HDR_SIZE + SMB2_HDR_SIGNATURE, 0, 16); ZERO_STRUCT(m); - SHA256_Init(&m); - SHA256_Update(&m, transport->signing.session_key.data, 16); - SHA256_Update(&m, buffer+NBT_HDR_SIZE, length-NBT_HDR_SIZE); - SHA256_Final(res, &m); + hmac_sha256_init(transport->signing.session_key.data, 16, &m); + hmac_sha256_update(buffer+NBT_HDR_SIZE, length-NBT_HDR_SIZE, &m); + hmac_sha256_final(res, &m); memcpy(buffer+NBT_HDR_SIZE+SMB2_HDR_SIGNATURE, sig, 16); -- cgit