diff options
author | Gordon Ross <gwr@racktopsystems.com> | 2022-01-11 19:09:09 -0500 |
---|---|---|
committer | Toomas Soome <tsoome@me.com> | 2022-11-09 19:39:58 +0200 |
commit | 0d5d3873da6f8c195c095c01db06e31cedc0aa5a (patch) | |
tree | f97d1e0088712dc76bb130a350b037413dbb0aeb /usr | |
parent | 76c08ae9d10f4e0b653a6ea98c06a7868246164b (diff) | |
download | illumos-gate-0d5d3873da6f8c195c095c01db06e31cedc0aa5a.tar.gz |
15101 WPTS FSA QueryDirectory test cases with ShortName errors
Reviewed by: Andy Stormont <astormont@racktopsystems.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Matt Barden <mbarden@tintri.com>
Approved by: Dan McDonald <danmcd@mnx.io>
Diffstat (limited to 'usr')
-rw-r--r-- | usr/src/uts/common/fs/smbsrv/smb2_query_dir.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/usr/src/uts/common/fs/smbsrv/smb2_query_dir.c b/usr/src/uts/common/fs/smbsrv/smb2_query_dir.c index 61a42da2be..6558d88980 100644 --- a/usr/src/uts/common/fs/smbsrv/smb2_query_dir.c +++ b/usr/src/uts/common/fs/smbsrv/smb2_query_dir.c @@ -23,6 +23,7 @@ * Use is subject to license terms. * * Copyright 2017 Nexenta Systems, Inc. All rights reserved. + * Copyright 2022 RackTop Systems, Inc. */ /* @@ -441,7 +442,7 @@ smb2_find_mbc_encode(smb_request_t *sr, smb2_find_args_t *args) int shortlen = 0; int rc, starting_offset; uint32_t next_entry_offset; - uint32_t mb_flags = SMB_MSGBUF_UNICODE; + uint32_t mb_flags = SMB_MSGBUF_UNICODE | SMB_MSGBUF_NOTERM; uint32_t resume_key; namelen = smb_wcequiv_strlen(fileinfo->fi_name); @@ -527,8 +528,11 @@ smb2_find_mbc_encode(smb_request_t *sr, smb2_find_args_t *args) case FileBothDirectoryInformation: /* 3 */ bzero(buf83, sizeof (buf83)); smb_msgbuf_init(&mb, buf83, sizeof (buf83), mb_flags); - if (!smb_msgbuf_encode(&mb, "U", fileinfo->fi_shortname)) - shortlen = smb_wcequiv_strlen(fileinfo->fi_shortname); + shortlen = smb_msgbuf_encode(&mb, "U", fileinfo->fi_shortname); + if (shortlen < 0) { + shortlen = 0; + bzero(buf83, sizeof (buf83)); + } rc = smb_mbc_encodef( &sr->raw_data, "llTTTTqqlllb.24c", @@ -553,8 +557,11 @@ smb2_find_mbc_encode(smb_request_t *sr, smb2_find_args_t *args) case FileIdBothDirectoryInformation: /* 37 */ bzero(buf83, sizeof (buf83)); smb_msgbuf_init(&mb, buf83, sizeof (buf83), mb_flags); - if (!smb_msgbuf_encode(&mb, "U", fileinfo->fi_shortname)) - shortlen = smb_wcequiv_strlen(fileinfo->fi_shortname); + shortlen = smb_msgbuf_encode(&mb, "U", fileinfo->fi_shortname); + if (shortlen < 0) { + shortlen = 0; + bzero(buf83, sizeof (buf83)); + } rc = smb_mbc_encodef( &sr->raw_data, "llTTTTqqlllb.24c..q", |