summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGordon Ross <gwr@racktopsystems.com>2022-01-16 21:09:18 -0500
committerToomas Soome <tsoome@me.com>2022-11-28 21:17:20 +0200
commit0cab3dcd1eb7944361370218fd81d56d85907ed1 (patch)
tree7a55f309916040f13f8b6e80842bd3ae12c7627a
parent6e7e68d69a0c906a89a14afbb5663a30d0f202f0 (diff)
downloadillumos-gate-0cab3dcd1eb7944361370218fd81d56d85907ed1.tar.gz
15158 WPTS FSA FileInfo_Set_FileBasicInformation_Dir_Negative
Reviewed by: Joyce McIntosh <jmcintosh@racktopsystems.com> Reviewed by: Andy Stormont <andyjstormont@gmail.com> Reviewed by: Matt Barden <mbarden@racktopsystems.com> Approved by: Patrick Mooney <pmooney@pfmooney.com>
-rw-r--r--usr/src/uts/common/fs/smbsrv/smb_cmn_setfile.c17
-rw-r--r--usr/src/uts/common/fs/smbsrv/smb_common_open.c7
2 files changed, 21 insertions, 3 deletions
diff --git a/usr/src/uts/common/fs/smbsrv/smb_cmn_setfile.c b/usr/src/uts/common/fs/smbsrv/smb_cmn_setfile.c
index 304eb93a39..1b9ed07060 100644
--- a/usr/src/uts/common/fs/smbsrv/smb_cmn_setfile.c
+++ b/usr/src/uts/common/fs/smbsrv/smb_cmn_setfile.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2020 Tintri by DDN, Inc. All rights reserved.
+ * Copyright 2022 RackTop Systems, Inc.
*/
/*
@@ -62,9 +63,19 @@ smb_set_basic_info(smb_request_t *sr, smb_setinfo_t *si)
&crtime, &atime, &mtime, &ctime, &attributes) != 0)
return (NT_STATUS_INFO_LENGTH_MISMATCH);
- if ((attributes & FILE_ATTRIBUTE_DIRECTORY) &&
- (!smb_node_is_dir(node)))
- return (NT_STATUS_INVALID_PARAMETER);
+ /*
+ * MS-FSA 2.1.5.14.2 FileBasicInformation
+ * Return STATUS_INVALID_PARAMETER if:
+ * FILE_ATTRIBUTE_TEMPORARY on a directory,
+ * FILE_ATTRIBUTE_DIRECTORY on a non-directory.
+ */
+ if (smb_node_is_dir(node)) {
+ if ((attributes & FILE_ATTRIBUTE_TEMPORARY) != 0)
+ return (NT_STATUS_INVALID_PARAMETER);
+ } else {
+ if ((attributes & FILE_ATTRIBUTE_DIRECTORY) != 0)
+ return (NT_STATUS_INVALID_PARAMETER);
+ }
bzero(attr, sizeof (*attr));
if (atime != 0 && atime != (uint64_t)-1) {
diff --git a/usr/src/uts/common/fs/smbsrv/smb_common_open.c b/usr/src/uts/common/fs/smbsrv/smb_common_open.c
index 2fe367e4c3..cf8ed57a8d 100644
--- a/usr/src/uts/common/fs/smbsrv/smb_common_open.c
+++ b/usr/src/uts/common/fs/smbsrv/smb_common_open.c
@@ -22,6 +22,7 @@
/*
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2020 Tintri by DDN, Inc. All rights reserved.
+ * Copyright 2022 RackTop Systems, Inc.
*/
/*
@@ -938,6 +939,12 @@ create:
goto errout;
}
+ if (is_dir != 0 &&
+ (op->dattr & FILE_ATTRIBUTE_TEMPORARY) != 0) {
+ status = NT_STATUS_INVALID_PARAMETER;
+ goto errout;
+ }
+
if ((op->desired_access & ACCESS_SYSTEM_SECURITY) != 0 &&
!smb_user_has_security_priv(sr->uid_user, sr->user_cr)) {
status = NT_STATUS_ACCESS_DENIED;