diff options
author | Gordon Ross <gwr@racktopsystems.com> | 2022-01-08 14:14:18 -0500 |
---|---|---|
committer | Toomas Soome <tsoome@me.com> | 2022-10-17 18:47:55 +0300 |
commit | 08f2ce59ccfd4e449c92dd87b23e756e439d4daa (patch) | |
tree | ca8021cad5bf7dc0e40128794634402a0e612a4d /usr | |
parent | b716e3d049e8cb44c4b9c72022cafffb39c2f355 (diff) | |
download | illumos-joyent-08f2ce59ccfd4e449c92dd87b23e756e439d4daa.tar.gz |
15074 SMB Server should return STATUS_INVALID_DEVICE_REQUEST for unsupported FSCTLs
Reviewed by: Matt Barden <mbarden@tintri.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Andy Stormont <astormont@racktopsystems.com>
Reviewed by: Albert Lee <alee@racktopsystems.com>
Approved by: Dan McDonald <danmcd@mnx.io>
Diffstat (limited to 'usr')
-rw-r--r-- | usr/src/uts/common/fs/smbsrv/smb2_fsctl_fs.c | 25 | ||||
-rw-r--r-- | usr/src/uts/common/fs/smbsrv/smb2_fsctl_odx.c | 5 | ||||
-rw-r--r-- | usr/src/uts/common/fs/smbsrv/smb2_qinfo_quota.c | 14 | ||||
-rw-r--r-- | usr/src/uts/common/fs/smbsrv/smb2_setinfo_quota.c | 17 | ||||
-rw-r--r-- | usr/src/uts/common/smb/winioctl.h | 4 |
5 files changed, 45 insertions, 20 deletions
diff --git a/usr/src/uts/common/fs/smbsrv/smb2_fsctl_fs.c b/usr/src/uts/common/fs/smbsrv/smb2_fsctl_fs.c index 381fd7663e..d6da839e05 100644 --- a/usr/src/uts/common/fs/smbsrv/smb2_fsctl_fs.c +++ b/usr/src/uts/common/fs/smbsrv/smb2_fsctl_fs.c @@ -11,6 +11,7 @@ /* * Copyright 2019 Nexenta by DDN, Inc. All rights reserved. + * Copyright 2022 RackTop Systems, Inc. */ /* @@ -23,10 +24,6 @@ #include <smbsrv/smb_fsops.h> #include <smb/winioctl.h> -/* - * XXX: Should use smb2_fsctl_invalid in place of smb2_fsctl_notsup - * but that will require some re-testing. - */ static uint32_t smb2_fsctl_invalid(smb_request_t *sr, smb_fsctl_t *fsctl) { @@ -40,7 +37,7 @@ smb2_fsctl_notsup(smb_request_t *sr, smb_fsctl_t *fsctl) } /* - * Same as smb2_fsctl_notsup, but make some noise (if DEBUG) + * Same as smb2_fsctl_invalid, but make some noise (if DEBUG) * so we'll learn about new fsctl codes clients start using. */ /* ARGSUSED */ @@ -50,7 +47,7 @@ smb2_fsctl_unknown(smb_request_t *sr, smb_fsctl_t *fsctl) #ifdef DEBUG cmn_err(CE_NOTE, "smb2_fsctl_unknown: code 0x%x", fsctl->CtlCode); #endif - return (NT_STATUS_NOT_SUPPORTED); + return (NT_STATUS_INVALID_DEVICE_REQUEST); } /* @@ -145,7 +142,7 @@ smb2_fsctl_fs(smb_request_t *sr, smb_fsctl_t *fsctl) break; case FSCTL_SET_REPARSE_POINT: /* 41 */ case FSCTL_GET_REPARSE_POINT: /* 42 */ - func = smb2_fsctl_notsup; + func = smb2_fsctl_invalid; break; case FSCTL_CREATE_OR_GET_OBJECT_ID: /* 48 */ func = smb2_fsctl_invalid; @@ -160,7 +157,7 @@ smb2_fsctl_fs(smb_request_t *sr, smb_fsctl_t *fsctl) func = smb2_fsctl_query_alloc_ranges; break; case FSCTL_FILE_LEVEL_TRIM: /* 130 */ - func = smb2_fsctl_notsup; + func = smb2_fsctl_invalid; break; case FSCTL_OFFLOAD_READ: /* 153 */ func = smb2_fsctl_odx_read; @@ -168,13 +165,19 @@ smb2_fsctl_fs(smb_request_t *sr, smb_fsctl_t *fsctl) case FSCTL_OFFLOAD_WRITE: /* 154 */ func = smb2_fsctl_odx_write; break; + case FSCTL_GET_INTEGRITY_INFORMATION: /* 159 */ case FSCTL_SET_INTEGRITY_INFORMATION: /* 160 */ - func = smb2_fsctl_notsup; + func = smb2_fsctl_invalid; break; case FSCTL_QUERY_FILE_REGIONS: /* 161 */ func = smb2_fsctl_query_file_regions; break; + case FSCTL_REFS_STREAM_SNAPSHOT_MANAGEMENT: + /* WPTS wants NOT_SUPPORTED here. */ + func = smb2_fsctl_notsup; + break; + default: func = smb2_fsctl_unknown; break; @@ -213,14 +216,14 @@ smb2_fsctl_netfs(smb_request_t *sr, smb_fsctl_t *fsctl) func = smb2_fsctl_copychunk; break; case FSCTL_SRV_READ_HASH: /* 0x6e */ - func = smb2_fsctl_notsup; + func = smb2_fsctl_invalid; break; case FSCTL_LMR_REQUEST_RESILIENCY: /* 0x75 */ func = smb2_fsctl_set_resilient; break; case FSCTL_QUERY_NETWORK_INTERFACE_INFO: /* 0x7f */ need_disk_file = B_FALSE; - func = smb2_fsctl_notsup; + func = smb2_fsctl_invalid; break; case FSCTL_VALIDATE_NEGOTIATE_INFO: /* 0x81 */ need_disk_file = B_FALSE; diff --git a/usr/src/uts/common/fs/smbsrv/smb2_fsctl_odx.c b/usr/src/uts/common/fs/smbsrv/smb2_fsctl_odx.c index ebf59f6a59..cc37664ffb 100644 --- a/usr/src/uts/common/fs/smbsrv/smb2_fsctl_odx.c +++ b/usr/src/uts/common/fs/smbsrv/smb2_fsctl_odx.c @@ -11,6 +11,7 @@ /* * Copyright 2018-2021 Tintri by DDN, Inc. All rights reserved. + * Copyright 2022 RackTop Systems, Inc. */ /* @@ -197,7 +198,7 @@ smb2_fsctl_odx_read(smb_request_t *sr, smb_fsctl_t *fsctl) int rc; if (smb2_odx_enable == 0) - return (NT_STATUS_NOT_SUPPORTED); + return (NT_STATUS_INVALID_DEVICE_REQUEST); /* * Make sure the (src) ofile granted access allows read. @@ -391,7 +392,7 @@ smb2_fsctl_odx_write(smb_request_t *sr, smb_fsctl_t *fsctl) args.out_struct_size = 16; if (smb2_odx_enable == 0) - return (NT_STATUS_NOT_SUPPORTED); + return (NT_STATUS_INVALID_DEVICE_REQUEST); /* * Make sure the (dst) ofile granted_access allows write. diff --git a/usr/src/uts/common/fs/smbsrv/smb2_qinfo_quota.c b/usr/src/uts/common/fs/smbsrv/smb2_qinfo_quota.c index da2b0176b8..496c6fe414 100644 --- a/usr/src/uts/common/fs/smbsrv/smb2_qinfo_quota.c +++ b/usr/src/uts/common/fs/smbsrv/smb2_qinfo_quota.c @@ -22,6 +22,7 @@ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2013 Nexenta Systems, Inc. All rights reserved. + * Copyright 2022 RackTop Systems, Inc. */ /* @@ -32,6 +33,15 @@ #include <smbsrv/smb_fsops.h> #include <smbsrv/ntifs.h> +/* + * MS-FSA 2.1.5.20 Server Requests Querying Quota Information + * + * Support for this operation is optional. If the object store does not + * implement this functionality, the operation MUST be failed with + * STATUS_INVALID_DEVICE_REQUEST + * + * Similar to smb_nt_transact_query_quota() + */ uint32_t smb2_qinfo_quota(smb_request_t *sr, smb_queryinfo_t *qi) { @@ -49,11 +59,11 @@ smb2_qinfo_quota(smb_request_t *sr, smb_queryinfo_t *qi) bzero(&reply, sizeof (smb_quota_response_t)); if (!smb_tree_has_feature(sr->tid_tree, SMB_TREE_QUOTA)) - return (NT_STATUS_NOT_SUPPORTED); + return (NT_STATUS_INVALID_DEVICE_REQUEST); if ((ofile->f_node == NULL) || (ofile->f_ftype != SMB_FTYPE_DISK)) - return (NT_STATUS_NOT_SUPPORTED); + return (NT_STATUS_INVALID_DEVICE_REQUEST); rc = smb_mbc_decodef( &sr->smb_data, "bb..lll", diff --git a/usr/src/uts/common/fs/smbsrv/smb2_setinfo_quota.c b/usr/src/uts/common/fs/smbsrv/smb2_setinfo_quota.c index bdeda05ba7..6dcf0112b3 100644 --- a/usr/src/uts/common/fs/smbsrv/smb2_setinfo_quota.c +++ b/usr/src/uts/common/fs/smbsrv/smb2_setinfo_quota.c @@ -22,6 +22,7 @@ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2013 Nexenta Systems, Inc. All rights reserved. + * Copyright 2022 RackTop Systems, Inc. */ /* @@ -33,6 +34,12 @@ #include <smbsrv/ntifs.h> /* + * MS-FSA 2.1.5.21 Server Requests Setting Quota Information + * + * Support for this operation is optional. If the object store does not + * implement this functionality, the operation MUST be failed with + * STATUS_INVALID_DEVICE_REQUEST + * * Similar to smb_nt_transact_set_quota() */ uint32_t @@ -44,18 +51,18 @@ smb2_setinfo_quota(smb_request_t *sr, smb_setinfo_t *si) smb_node_t *tnode; smb_quota_set_t request; uint32_t reply; - list_t *quota_list; + list_t *quota_list; bzero(&request, sizeof (smb_quota_set_t)); if (!smb_tree_has_feature(sr->tid_tree, SMB_TREE_QUOTA)) - return (NT_STATUS_NOT_SUPPORTED); - - if (!smb_user_is_admin(sr->uid_user)) - return (NT_STATUS_ACCESS_DENIED); + return (NT_STATUS_INVALID_DEVICE_REQUEST); if ((ofile->f_node == NULL) || (ofile->f_ftype != SMB_FTYPE_DISK)) + return (NT_STATUS_INVALID_DEVICE_REQUEST); + + if (!smb_user_is_admin(sr->uid_user)) return (NT_STATUS_ACCESS_DENIED); tnode = sr->tid_tree->t_snode; diff --git a/usr/src/uts/common/smb/winioctl.h b/usr/src/uts/common/smb/winioctl.h index 0f322cc4ef..a991841b4e 100644 --- a/usr/src/uts/common/smb/winioctl.h +++ b/usr/src/uts/common/smb/winioctl.h @@ -23,6 +23,7 @@ * Use is subject to license terms. * * Copyright 2018 Nexenta Systems, Inc. All rights reserved. + * Copyright 2022 RackTop Systems, Inc. */ #ifndef _SMB_WINIOCTL_H #define _SMB_WINIOCTL_H @@ -483,6 +484,9 @@ extern "C" { #define FSCTL_QUERY_FILE_REGIONS \ CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 161, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSCTL_REFS_STREAM_SNAPSHOT_MANAGEMENT \ + CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 272, METHOD_BUFFERED, FILE_ANY_ACCESS) + /* FILE_DEVICE_NETWORK_FILE_SYSTEM */ /* Read the snapshot info for Volume Shadow Copy Services */ #define FSCTL_SRV_ENUMERATE_SNAPSHOTS \ |