Print this page
NEX-15959 SMB 2.1 negotiation failure after NEX-9808
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
NEX-15959 SMB 2.1 negotiation failure after NEX-9808
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
NEX-9808 SMB3 persistent handles
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-9808 SMB3 persistent handles
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-1643 dtrace provider for smbsrv
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Matt Barden <matt.barden@nexenta.com>
NEX-5273 SMB 3 Encryption
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
SMB-122 smbd core dumps in smbd_dc_update / smb_log
SMB-117 Win7 fails to open security properties
SMB-96 Codenomicon: SMB2 TC: 141500 - Panic in smb2_decode_create_ctx
SMB-11 SMB2 message parse & dispatch
SMB-12 SMB2 Negotiate Protocol
SMB-13 SMB2 Session Setup
SMB-14 SMB2 Logoff
SMB-15 SMB2 Tree Connect
SMB-16 SMB2 Tree Disconnect
SMB-17 SMB2 Create
SMB-18 SMB2 Close
SMB-19 SMB2 Flush
SMB-20 SMB2 Read
SMB-21 SMB2 Write
SMB-22 SMB2 Lock/Unlock
SMB-23 SMB2 Ioctl
SMB-24 SMB2 Cancel
SMB-25 SMB2 Echo
SMB-26 SMB2 Query Dir
SMB-27 SMB2 Change Notify
SMB-28 SMB2 Query Info
SMB-29 SMB2 Set Info
SMB-30 SMB2 Oplocks
SMB-53 SMB2 Create Context options
(SMB2 code review cleanup 1, 2, 3)
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/fs/smbsrv/smb2_tree_connect.c
+++ new/usr/src/uts/common/fs/smbsrv/smb2_tree_connect.c
1 1 /*
2 2 * This file and its contents are supplied under the terms of the
|
↓ open down ↓ |
2 lines elided |
↑ open up ↑ |
3 3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 4 * You may only use this file in accordance with the terms of version
5 5 * 1.0 of the CDDL.
6 6 *
7 7 * A full copy of the text of the CDDL should have accompanied this
8 8 * source. A copy of the CDDL is also available via the Internet at
9 9 * http://www.illumos.org/license/CDDL.
10 10 */
11 11
12 12 /*
13 - * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
13 + * Copyright 2017 Nexenta Systems, Inc. All rights reserved.
14 14 */
15 15
16 16 /*
17 17 * Dispatch function for SMB2_TREE_CONNECT
18 18 */
19 19
20 20 #include <smbsrv/smb2_kproto.h>
21 21
22 +#define SMB2_SHARE_CAP_CA SMB2_SHARE_CAP_CONTINUOUS_AVAILABILITY
23 +
22 24 smb_sdrc_t
23 25 smb2_tree_connect(smb_request_t *sr)
24 26 {
25 27 smb_arg_tcon_t *tcon = &sr->sr_tcon;
26 28 smb_tree_t *tree = NULL;
27 29 uint16_t StructureSize;
28 30 uint16_t PathOffset;
29 31 uint16_t PathLength;
30 32 uint8_t ShareType;
31 33 uint32_t ShareFlags;
32 34 uint32_t Capabilities;
33 35 uint32_t status;
34 36 int skip;
35 37 int rc = 0;
36 38
37 39 /*
38 40 * SMB2 Tree Connect request
39 41 */
40 42 rc = smb_mbc_decodef(
41 43 &sr->smb_data, "w..ww",
42 44 &StructureSize,
43 45 /* reserved */
44 46 &PathOffset,
45 47 &PathLength);
46 48 if (rc)
47 49 return (SDRC_ERROR);
48 50
49 51 /*
50 52 * We're normally positioned at the path name now,
51 53 * but there could be some padding before it.
52 54 */
53 55 skip = (PathOffset + sr->smb2_cmd_hdr) -
54 56 sr->smb_data.chain_offset;
55 57 if (skip < 0)
56 58 return (SDRC_ERROR);
57 59 if (skip > 0)
58 60 (void) smb_mbc_decodef(&sr->smb_data, "#.", skip);
|
↓ open down ↓ |
27 lines elided |
↑ open up ↑ |
59 61
60 62 /*
61 63 * Get the path name
62 64 */
63 65 rc = smb_mbc_decodef(
64 66 &sr->smb_data, "%#U",
65 67 sr, (uint_t)PathLength, &tcon->path);
66 68 if (rc)
67 69 return (SDRC_ERROR);
68 70
71 + DTRACE_SMB2_START(op__TreeConnect, smb_request_t *, sr);
72 +
73 + /*
74 + * [MS-SMB2] 3.3.5.7 Receiving an SMB2 TREE_CONNECT Request
75 + *
76 + * If RejectUnencryptedAccess is TRUE,
77 + * global EncryptData or Share.EncryptData is TRUE,
78 + * we support 3.x, and srv_cap doesn't indicate encryption support,
79 + * return ACCESS_DENIED.
80 + *
81 + * This also applies to SMB1, so do it in smb_tree_connect_core.
82 + */
69 83 status = smb_tree_connect(sr);
84 +
85 + sr->smb2_status = status;
86 + DTRACE_SMB2_DONE(op__TreeConnect, smb_request_t *, sr);
87 +
70 88 if (status) {
71 89 (void) smb2sr_put_error(sr, status);
72 90 return (SDRC_SUCCESS);
73 91 }
74 92 tree = sr->tid_tree;
75 93
76 94 /*
77 95 * Report the share type.
78 96 */
79 97 switch (tree->t_res_type & STYPE_MASK) {
80 98 case STYPE_IPC:
81 99 ShareType = SMB2_SHARE_TYPE_PIPE;
82 100 break;
83 101 case STYPE_PRINTQ:
84 102 ShareType = SMB2_SHARE_TYPE_PRINT;
|
↓ open down ↓ |
5 lines elided |
↑ open up ↑ |
85 103 break;
86 104 case STYPE_DISKTREE:
87 105 default:
88 106 ShareType = SMB2_SHARE_TYPE_DISK;
89 107 break;
90 108 }
91 109
92 110 /*
93 111 * XXX These need work..
94 112 */
95 - ShareFlags = 0;
113 + if (tree->t_encrypt != SMB_CONFIG_DISABLED)
114 + ShareFlags = SMB2_SHAREFLAG_ENCRYPT_DATA;
115 + else
116 + ShareFlags = 0;
117 +
96 118 Capabilities = 0;
119 + if ((tree->t_flags & SMB_TREE_DFSROOT) != 0)
120 + Capabilities |= SMB2_SHARE_CAP_DFS;
121 + if ((tree->t_flags & SMB_TREE_CA) != 0)
122 + Capabilities |= SMB2_SHARE_CAP_CA;
97 123
98 124 /*
99 125 * SMB2 Tree Connect reply
100 126 */
101 - rc = smb_mbc_encodef(
127 + (void) smb_mbc_encodef(
102 128 &sr->reply,
103 129 "wb.lll",
104 130 16, /* StructSize */ /* w */
105 131 ShareType, /* b */
106 132 ShareFlags, /* l */
107 133 Capabilities, /* l */
108 134 tree->t_access); /* l */
109 - if (rc)
110 - return (SDRC_ERROR);
111 135
112 136 return (SDRC_SUCCESS);
113 137 }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX