diff options
author | Gordon Ross <gwr@racktopsystems.com> | 2022-01-09 00:26:26 -0500 |
---|---|---|
committer | Toomas Soome <tsoome@me.com> | 2022-10-28 20:46:21 +0300 |
commit | cf56021bf3bfd6c5c3b246414ea6e6edfee73f49 (patch) | |
tree | 2b09082835f5ec0e5b069d158be4b7c13efbb54d | |
parent | 906c900b957aaea1b46e5b5115948389a6f91abc (diff) | |
download | illumos-joyent-cf56021bf3bfd6c5c3b246414ea6e6edfee73f49.tar.gz |
15094 WPTS BVT_SMB2Basic_Query_FileAllInformation
Reviewed by: Andy Stormont <astormont@racktopsystems.com>
Approved by: Dan McDonald <danmcd@mnx.io>
-rw-r--r-- | usr/src/uts/common/fs/smbsrv/smb2_qinfo_file.c | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/usr/src/uts/common/fs/smbsrv/smb2_qinfo_file.c b/usr/src/uts/common/fs/smbsrv/smb2_qinfo_file.c index 929f02522b..00198aa31f 100644 --- a/usr/src/uts/common/fs/smbsrv/smb2_qinfo_file.c +++ b/usr/src/uts/common/fs/smbsrv/smb2_qinfo_file.c @@ -11,6 +11,7 @@ /* * Copyright 2019 Nexenta by DDN, Inc. All rights reserved. + * Copyright 2022 RackTop Systems, Inc. */ /* @@ -72,7 +73,10 @@ smb2_qinfo_file(smb_request_t *sr, smb_queryinfo_t *qi) case FileAllInformation: mask = SMB_AT_ALL; getstd = B_TRUE; - getname = B_TRUE; + if (sr->session->dialect < SMB_VERS_3_11) { + /* See smb2_qif_all() */ + getname = B_TRUE; + } break; case FileNameInformation: @@ -196,6 +200,8 @@ smb2_qinfo_file(smb_request_t *sr, smb_queryinfo_t *qi) * FileModeInformation * FileAlignmentInformation * FileNameInformation + * + * Note: FileNameInformation is all zero on Win2016 and later. */ static uint32_t smb2_qif_all(smb_request_t *sr, smb_queryinfo_t *qi) @@ -223,11 +229,24 @@ smb2_qif_all(smb_request_t *sr, smb_queryinfo_t *qi) status = smb2_qif_alignment(sr, qi); if (status) return (status); - status = smb2_qif_name(sr, qi); - if (status) - return (status); - return (0); + /* + * MS-SMB2 3.3.5.20.1 says (in a windows behavior note) that + * 2012R2 and older fill in the FileNameInformation. + * We could let this depend on sr->sr_cfg->skc_version + * but doing it based on dialect is a lot easier and + * has nearly the same effect. + */ + if (sr->session->dialect < SMB_VERS_3_11) { + /* Win2012r2 and earlier fill it in. (SMB 3.0) */ + status = smb2_qif_name(sr, qi); + } else { + /* Win2016 and later just put zeros (SMB 3.11) */ + int rc = smb_mbc_encodef(&sr->raw_data, "10."); + status = (rc == 0) ? 0 : NT_STATUS_BUFFER_OVERFLOW; + } + + return (status); } /* |