1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
23  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
24  */
25 
26 /*
27  * Dispatch function for SMB2_SET_INFO
28  *
29  * [MS-FSCC 2.5] If a file system does not implement ...
30  * an Information Classs, NT_STATUS_INVALID_PARAMETER...
31  */
32 
33 #include <smbsrv/smb2_kproto.h>
34 #include <smbsrv/smb_fsops.h>
35 #include <smbsrv/ntifs.h>
36 
37 uint32_t smb2_setfs_control(smb_request_t *, smb_setinfo_t *);
38 uint32_t smb2_setfs_obj_id(smb_request_t *, smb_setinfo_t *);
39 
40 uint32_t
smb2_setinfo_fs(smb_request_t * sr,smb_setinfo_t * si,int InfoClass)41 smb2_setinfo_fs(smb_request_t *sr, smb_setinfo_t *si, int InfoClass)
42 {
43 	uint32_t status;
44 
45 	switch (InfoClass) {
46 
47 	/* pg 153 */
48 
49 	case FileFsControlInformation:	/* 6 */
50 		status = smb2_setfs_control(sr, si);
51 		break;
52 	case FileFsObjectIdInformation:	/* 8 */
53 		status = smb2_setfs_obj_id(sr, si);
54 		break;
55 
56 	default:
57 		status = NT_STATUS_INVALID_INFO_CLASS;
58 		break;
59 	}
60 
61 	return (status);
62 }
63 
64 /*
65  * FileFsControlInformation
66  */
67 uint32_t
smb2_setfs_control(smb_request_t * sr,smb_setinfo_t * si)68 smb2_setfs_control(smb_request_t *sr, smb_setinfo_t *si)
69 {
70 	_NOTE(ARGUNUSED(si))
71 	smb_tree_t *tree = sr->tid_tree;
72 
73 	if (!STYPE_ISDSK(tree->t_res_type))
74 		return (NT_STATUS_INVALID_PARAMETER);
75 
76 	return (0);
77 }
78 
79 /*
80  * FileFsObjectIdInformation
81  */
82 /* ARGSUSED */
83 uint32_t
smb2_setfs_obj_id(smb_request_t * sr,smb_setinfo_t * si)84 smb2_setfs_obj_id(smb_request_t *sr, smb_setinfo_t *si)
85 {
86 	/*
87 	 * Return an error per. [MS-FSCC 2.5.7]
88 	 * which means we can't change object IDs.
89 	 */
90 	return (NT_STATUS_INVALID_PARAMETER);
91 }
92