aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorPavel Shilovsky <piastry@etersoft.ru>2011-12-27 07:12:43 -0500
committerPavel Shilovsky <pshilovsky@samba.org>2012-07-24 13:54:55 -0400
commitec2e4523fdba88317e06d0c7a88af3a0860447fc (patch)
tree474781811d075dfb2e01345911fd0ff585f2d64a /fs
parent3792c1732878822ebf5a1c7e83e23453b9bbb698 (diff)
CIFS: Add capability to send SMB2 negotiate message
and add negotiate request type to let set_credits know that we are only on negotiate stage and no need to make a decision about disabling echos and oplocks. Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/Makefile3
-rw-r--r--fs/cifs/cifsglob.h13
-rw-r--r--fs/cifs/cifssmb.c7
-rw-r--r--fs/cifs/smb2misc.c7
-rw-r--r--fs/cifs/smb2ops.c22
-rw-r--r--fs/cifs/smb2pdu.c330
-rw-r--r--fs/cifs/smb2pdu.h39
-rw-r--r--fs/cifs/smb2proto.h7
8 files changed, 417 insertions, 11 deletions
diff --git a/fs/cifs/Makefile b/fs/cifs/Makefile
index b77e9ec02bd1..daf6837d9e0e 100644
--- a/fs/cifs/Makefile
+++ b/fs/cifs/Makefile
@@ -16,4 +16,5 @@ cifs-$(CONFIG_CIFS_DFS_UPCALL) += dns_resolve.o cifs_dfs_ref.o
16 16
17cifs-$(CONFIG_CIFS_FSCACHE) += fscache.o cache.o 17cifs-$(CONFIG_CIFS_FSCACHE) += fscache.o cache.o
18 18
19cifs-$(CONFIG_CIFS_SMB2) += smb2ops.o smb2maperror.o smb2transport.o smb2misc.o 19cifs-$(CONFIG_CIFS_SMB2) += smb2ops.o smb2maperror.o smb2transport.o \
20 smb2misc.o smb2pdu.o
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 480b6385a9b6..2d48f880b130 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -313,6 +313,12 @@ get_rfc1002_length(void *buf)
313 return be32_to_cpu(*((__be32 *)buf)); 313 return be32_to_cpu(*((__be32 *)buf));
314} 314}
315 315
316static inline void
317inc_rfc1001_len(void *buf, int count)
318{
319 be32_add_cpu((__be32 *)buf, count);
320}
321
316struct TCP_Server_Info { 322struct TCP_Server_Info {
317 struct list_head tcp_ses_list; 323 struct list_head tcp_ses_list;
318 struct list_head smb_ses_list; 324 struct list_head smb_ses_list;
@@ -393,6 +399,10 @@ struct TCP_Server_Info {
393 atomic_t in_send; /* requests trying to send */ 399 atomic_t in_send; /* requests trying to send */
394 atomic_t num_waiters; /* blocked waiting to get in sendrecv */ 400 atomic_t num_waiters; /* blocked waiting to get in sendrecv */
395#endif 401#endif
402#ifdef CONFIG_CIFS_SMB2
403 unsigned int max_read;
404 unsigned int max_write;
405#endif /* CONFIG_CIFS_SMB2 */
396}; 406};
397 407
398static inline unsigned int 408static inline unsigned int
@@ -986,7 +996,8 @@ static inline void free_dfs_info_array(struct dfs_info3_param *param,
986/* Type of request operation */ 996/* Type of request operation */
987#define CIFS_ECHO_OP 0x080 /* echo request */ 997#define CIFS_ECHO_OP 0x080 /* echo request */
988#define CIFS_OBREAK_OP 0x0100 /* oplock break request */ 998#define CIFS_OBREAK_OP 0x0100 /* oplock break request */
989#define CIFS_OP_MASK 0x0180 /* mask request type */ 999#define CIFS_NEG_OP 0x0200 /* negotiate request */
1000#define CIFS_OP_MASK 0x0380 /* mask request type */
990 1001
991/* Security Flags: indicate type of session setup needed */ 1002/* Security Flags: indicate type of session setup needed */
992#define CIFSSEC_MAY_SIGN 0x00001 1003#define CIFSSEC_MAY_SIGN 0x00001
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 7a3b4a3b113b..dcb0ad87e173 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -388,13 +388,6 @@ vt2_err:
388 return -EINVAL; 388 return -EINVAL;
389} 389}
390 390
391static inline void inc_rfc1001_len(void *pSMB, int count)
392{
393 struct smb_hdr *hdr = (struct smb_hdr *)pSMB;
394
395 be32_add_cpu(&hdr->smb_buf_length, count);
396}
397
398int 391int
399CIFSSMBNegotiate(const unsigned int xid, struct cifs_ses *ses) 392CIFSSMBNegotiate(const unsigned int xid, struct cifs_ses *ses)
400{ 393{
diff --git a/fs/cifs/smb2misc.c b/fs/cifs/smb2misc.c
index d4226782ec88..e4dede4ae058 100644
--- a/fs/cifs/smb2misc.c
+++ b/fs/cifs/smb2misc.c
@@ -199,7 +199,7 @@ static const bool has_smb2_data_area[NUMBER_OF_SMB2_COMMANDS] = {
199 * Returns the pointer to the beginning of the data area. Length of the data 199 * Returns the pointer to the beginning of the data area. Length of the data
200 * area and the offset to it (from the beginning of the smb are also returned. 200 * area and the offset to it (from the beginning of the smb are also returned.
201 */ 201 */
202static char * 202char *
203smb2_get_data_area_len(int *off, int *len, struct smb2_hdr *hdr) 203smb2_get_data_area_len(int *off, int *len, struct smb2_hdr *hdr)
204{ 204{
205 *off = 0; 205 *off = 0;
@@ -218,6 +218,11 @@ smb2_get_data_area_len(int *off, int *len, struct smb2_hdr *hdr)
218 */ 218 */
219 switch (hdr->Command) { 219 switch (hdr->Command) {
220 case SMB2_NEGOTIATE: 220 case SMB2_NEGOTIATE:
221 *off = le16_to_cpu(
222 ((struct smb2_negotiate_rsp *)hdr)->SecurityBufferOffset);
223 *len = le16_to_cpu(
224 ((struct smb2_negotiate_rsp *)hdr)->SecurityBufferLength);
225 break;
221 case SMB2_SESSION_SETUP: 226 case SMB2_SESSION_SETUP:
222 case SMB2_CREATE: 227 case SMB2_CREATE:
223 case SMB2_READ: 228 case SMB2_READ:
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index c6f81541a635..2b5232b4f7e7 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -61,7 +61,7 @@ smb2_add_credits(struct TCP_Server_Info *server, const unsigned int add,
61 val = server->ops->get_credits_field(server, optype); 61 val = server->ops->get_credits_field(server, optype);
62 *val += add; 62 *val += add;
63 server->in_flight--; 63 server->in_flight--;
64 if (server->in_flight == 0) 64 if (server->in_flight == 0 && (optype & CIFS_OP_MASK) != CIFS_NEG_OP)
65 rc = change_conf(server); 65 rc = change_conf(server);
66 spin_unlock(&server->req_lock); 66 spin_unlock(&server->req_lock);
67 wake_up(&server->request_q); 67 wake_up(&server->request_q);
@@ -139,6 +139,24 @@ smb2_dump_detail(void *buf)
139#endif 139#endif
140} 140}
141 141
142static bool
143smb2_need_neg(struct TCP_Server_Info *server)
144{
145 return server->max_read == 0;
146}
147
148static int
149smb2_negotiate(const unsigned int xid, struct cifs_ses *ses)
150{
151 int rc;
152 ses->server->CurrentMid = 0;
153 rc = SMB2_negotiate(xid, ses);
154 /* BB we probably don't need to retry with modern servers */
155 if (rc == -EAGAIN)
156 rc = -EHOSTDOWN;
157 return rc;
158}
159
142struct smb_version_operations smb21_operations = { 160struct smb_version_operations smb21_operations = {
143 .setup_request = smb2_setup_request, 161 .setup_request = smb2_setup_request,
144 .check_receive = smb2_check_receive, 162 .check_receive = smb2_check_receive,
@@ -150,6 +168,8 @@ struct smb_version_operations smb21_operations = {
150 .find_mid = smb2_find_mid, 168 .find_mid = smb2_find_mid,
151 .check_message = smb2_check_message, 169 .check_message = smb2_check_message,
152 .dump_detail = smb2_dump_detail, 170 .dump_detail = smb2_dump_detail,
171 .need_neg = smb2_need_neg,
172 .negotiate = smb2_negotiate,
153}; 173};
154 174
155struct smb_version_values smb21_values = { 175struct smb_version_values smb21_values = {
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
new file mode 100644
index 000000000000..719e4c4f0307
--- /dev/null
+++ b/fs/cifs/smb2pdu.c
@@ -0,0 +1,330 @@
1/*
2 * fs/cifs/smb2pdu.c
3 *
4 * Copyright (C) International Business Machines Corp., 2009, 2011
5 * Etersoft, 2012
6 * Author(s): Steve French (sfrench@us.ibm.com)
7 * Pavel Shilovsky (pshilovsky@samba.org) 2012
8 *
9 * Contains the routines for constructing the SMB2 PDUs themselves
10 *
11 * This library is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published
13 * by the Free Software Foundation; either version 2.1 of the License, or
14 * (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
19 * the GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * along with this library; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25
26 /* SMB2 PDU handling routines here - except for leftovers (eg session setup) */
27 /* Note that there are handle based routines which must be */
28 /* treated slightly differently for reconnection purposes since we never */
29 /* want to reuse a stale file handle and only the caller knows the file info */
30
31#include <linux/fs.h>
32#include <linux/kernel.h>
33#include <linux/vfs.h>
34#include <linux/uaccess.h>
35#include <linux/xattr.h>
36#include "smb2pdu.h"
37#include "cifsglob.h"
38#include "cifsacl.h"
39#include "cifsproto.h"
40#include "smb2proto.h"
41#include "cifs_unicode.h"
42#include "cifs_debug.h"
43#include "ntlmssp.h"
44#include "smb2status.h"
45
46/*
47 * The following table defines the expected "StructureSize" of SMB2 requests
48 * in order by SMB2 command. This is similar to "wct" in SMB/CIFS requests.
49 *
50 * Note that commands are defined in smb2pdu.h in le16 but the array below is
51 * indexed by command in host byte order.
52 */
53static const int smb2_req_struct_sizes[NUMBER_OF_SMB2_COMMANDS] = {
54 /* SMB2_NEGOTIATE */ 36,
55 /* SMB2_SESSION_SETUP */ 25,
56 /* SMB2_LOGOFF */ 4,
57 /* SMB2_TREE_CONNECT */ 9,
58 /* SMB2_TREE_DISCONNECT */ 4,
59 /* SMB2_CREATE */ 57,
60 /* SMB2_CLOSE */ 24,
61 /* SMB2_FLUSH */ 24,
62 /* SMB2_READ */ 49,
63 /* SMB2_WRITE */ 49,
64 /* SMB2_LOCK */ 48,
65 /* SMB2_IOCTL */ 57,
66 /* SMB2_CANCEL */ 4,
67 /* SMB2_ECHO */ 4,
68 /* SMB2_QUERY_DIRECTORY */ 33,
69 /* SMB2_CHANGE_NOTIFY */ 32,
70 /* SMB2_QUERY_INFO */ 41,
71 /* SMB2_SET_INFO */ 33,
72 /* SMB2_OPLOCK_BREAK */ 24 /* BB this is 36 for LEASE_BREAK variant */
73};
74
75
76static void
77smb2_hdr_assemble(struct smb2_hdr *hdr, __le16 smb2_cmd /* command */ ,
78 const struct cifs_tcon *tcon)
79{
80 struct smb2_pdu *pdu = (struct smb2_pdu *)hdr;
81 char *temp = (char *)hdr;
82 /* lookup word count ie StructureSize from table */
83 __u16 parmsize = smb2_req_struct_sizes[le16_to_cpu(smb2_cmd)];
84
85 /*
86 * smaller than SMALL_BUFFER_SIZE but bigger than fixed area of
87 * largest operations (Create)
88 */
89 memset(temp, 0, 256);
90
91 /* Note this is only network field converted to big endian */
92 hdr->smb2_buf_length = cpu_to_be32(parmsize + sizeof(struct smb2_hdr)
93 - 4 /* RFC 1001 length field itself not counted */);
94
95 hdr->ProtocolId[0] = 0xFE;
96 hdr->ProtocolId[1] = 'S';
97 hdr->ProtocolId[2] = 'M';
98 hdr->ProtocolId[3] = 'B';
99 hdr->StructureSize = cpu_to_le16(64);
100 hdr->Command = smb2_cmd;
101 hdr->CreditRequest = cpu_to_le16(2); /* BB make this dynamic */
102 hdr->ProcessId = cpu_to_le32((__u16)current->tgid);
103
104 if (!tcon)
105 goto out;
106
107 hdr->TreeId = tcon->tid;
108 /* Uid is not converted */
109 if (tcon->ses)
110 hdr->SessionId = tcon->ses->Suid;
111 /* BB check following DFS flags BB */
112 /* BB do we have to add check for SHI1005_FLAGS_DFS_ROOT too? */
113 /* if (tcon->share_flags & SHI1005_FLAGS_DFS)
114 hdr->Flags |= SMB2_FLAGS_DFS_OPERATIONS; */
115 /* BB how does SMB2 do case sensitive? */
116 /* if (tcon->nocase)
117 hdr->Flags |= SMBFLG_CASELESS; */
118 /* if (tcon->ses && tcon->ses->server &&
119 (tcon->ses->server->sec_mode & SECMODE_SIGN_REQUIRED))
120 hdr->Flags |= SMB2_FLAGS_SIGNED; */
121out:
122 pdu->StructureSize2 = cpu_to_le16(parmsize);
123 return;
124}
125
126static int
127smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon)
128{
129 int rc = 0;
130 /* BB add missing code here */
131 return rc;
132}
133
134/*
135 * Allocate and return pointer to an SMB request hdr, and set basic
136 * SMB information in the SMB header. If the return code is zero, this
137 * function must have filled in request_buf pointer.
138 */
139static int
140small_smb2_init(__le16 smb2_command, struct cifs_tcon *tcon,
141 void **request_buf)
142{
143 int rc = 0;
144
145 rc = smb2_reconnect(smb2_command, tcon);
146 if (rc)
147 return rc;
148
149 /* BB eventually switch this to SMB2 specific small buf size */
150 *request_buf = cifs_small_buf_get();
151 if (*request_buf == NULL) {
152 /* BB should we add a retry in here if not a writepage? */
153 return -ENOMEM;
154 }
155
156 smb2_hdr_assemble((struct smb2_hdr *) *request_buf, smb2_command, tcon);
157
158 if (tcon != NULL) {
159#ifdef CONFIG_CIFS_STATS2
160 /*
161 uint16_t com_code = le16_to_cpu(smb2_command);
162 cifs_stats_inc(&tcon->stats.smb2_stats.smb2_com_sent[com_code]);
163 */
164#endif
165 cifs_stats_inc(&tcon->num_smbs_sent);
166 }
167
168 return rc;
169}
170
171static void
172free_rsp_buf(int resp_buftype, void *rsp)
173{
174 if (resp_buftype == CIFS_SMALL_BUFFER)
175 cifs_small_buf_release(rsp);
176 else if (resp_buftype == CIFS_LARGE_BUFFER)
177 cifs_buf_release(rsp);
178}
179
180#define SMB2_NUM_PROT 1
181
182#define SMB2_PROT 0
183#define SMB21_PROT 1
184#define BAD_PROT 0xFFFF
185
186#define SMB2_PROT_ID 0x0202
187#define SMB21_PROT_ID 0x0210
188#define BAD_PROT_ID 0xFFFF
189
190static struct {
191 int index;
192 __le16 name;
193} smb2protocols[] = {
194 {SMB2_PROT, cpu_to_le16(SMB2_PROT_ID)},
195 {SMB21_PROT, cpu_to_le16(SMB21_PROT_ID)},
196 {BAD_PROT, cpu_to_le16(BAD_PROT_ID)}
197};
198
199/*
200 *
201 * SMB2 Worker functions follow:
202 *
203 * The general structure of the worker functions is:
204 * 1) Call smb2_init (assembles SMB2 header)
205 * 2) Initialize SMB2 command specific fields in fixed length area of SMB
206 * 3) Call smb_sendrcv2 (sends request on socket and waits for response)
207 * 4) Decode SMB2 command specific fields in the fixed length area
208 * 5) Decode variable length data area (if any for this SMB2 command type)
209 * 6) Call free smb buffer
210 * 7) return
211 *
212 */
213
214int
215SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses)
216{
217 struct smb2_negotiate_req *req;
218 struct smb2_negotiate_rsp *rsp;
219 struct kvec iov[1];
220 int rc = 0;
221 int resp_buftype;
222 struct TCP_Server_Info *server;
223 unsigned int sec_flags;
224 u16 i;
225 u16 temp = 0;
226 int blob_offset, blob_length;
227 char *security_blob;
228 int flags = CIFS_NEG_OP;
229
230 cFYI(1, "Negotiate protocol");
231
232 if (ses->server)
233 server = ses->server;
234 else {
235 rc = -EIO;
236 return rc;
237 }
238
239 rc = small_smb2_init(SMB2_NEGOTIATE, NULL, (void **) &req);
240 if (rc)
241 return rc;
242
243 /* if any of auth flags (ie not sign or seal) are overriden use them */
244 if (ses->overrideSecFlg & (~(CIFSSEC_MUST_SIGN | CIFSSEC_MUST_SEAL)))
245 sec_flags = ses->overrideSecFlg; /* BB FIXME fix sign flags?*/
246 else /* if override flags set only sign/seal OR them with global auth */
247 sec_flags = global_secflags | ses->overrideSecFlg;
248
249 cFYI(1, "sec_flags 0x%x", sec_flags);
250
251 req->hdr.SessionId = 0;
252
253 for (i = 0; i < SMB2_NUM_PROT; i++)
254 req->Dialects[i] = smb2protocols[i].name;
255
256 req->DialectCount = cpu_to_le16(i);
257 inc_rfc1001_len(req, i * 2);
258
259 /* only one of SMB2 signing flags may be set in SMB2 request */
260 if ((sec_flags & CIFSSEC_MUST_SIGN) == CIFSSEC_MUST_SIGN)
261 temp = SMB2_NEGOTIATE_SIGNING_REQUIRED;
262 else if (sec_flags & CIFSSEC_MAY_SIGN) /* MAY_SIGN is a single flag */
263 temp = SMB2_NEGOTIATE_SIGNING_ENABLED;
264
265 req->SecurityMode = cpu_to_le16(temp);
266
267 req->Capabilities = cpu_to_le32(SMB2_GLOBAL_CAP_DFS);
268
269 iov[0].iov_base = (char *)req;
270 /* 4 for rfc1002 length field */
271 iov[0].iov_len = get_rfc1002_length(req) + 4;
272
273 rc = SendReceive2(xid, ses, iov, 1, &resp_buftype, flags);
274
275 rsp = (struct smb2_negotiate_rsp *)iov[0].iov_base;
276 /*
277 * No tcon so can't do
278 * cifs_stats_inc(&tcon->stats.smb2_stats.smb2_com_fail[SMB2...]);
279 */
280 if (rc != 0)
281 goto neg_exit;
282
283 if (rsp == NULL) {
284 rc = -EIO;
285 goto neg_exit;
286 }
287
288 cFYI(1, "mode 0x%x", rsp->SecurityMode);
289
290 if (rsp->DialectRevision == smb2protocols[SMB21_PROT].name)
291 cFYI(1, "negotiated smb2.1 dialect");
292 else if (rsp->DialectRevision == smb2protocols[SMB2_PROT].name)
293 cFYI(1, "negotiated smb2 dialect");
294 else {
295 cERROR(1, "Illegal dialect returned by server %d",
296 le16_to_cpu(rsp->DialectRevision));
297 rc = -EIO;
298 goto neg_exit;
299 }
300 server->dialect = le16_to_cpu(rsp->DialectRevision);
301
302 server->maxBuf = le32_to_cpu(rsp->MaxTransactSize);
303 server->max_read = le32_to_cpu(rsp->MaxReadSize);
304 server->max_write = le32_to_cpu(rsp->MaxWriteSize);
305 /* BB Do we need to validate the SecurityMode? */
306 server->sec_mode = le16_to_cpu(rsp->SecurityMode);
307 server->capabilities = le32_to_cpu(rsp->Capabilities);
308
309 security_blob = smb2_get_data_area_len(&blob_offset, &blob_length,
310 &rsp->hdr);
311 if (blob_length == 0) {
312 cERROR(1, "missing security blob on negprot");
313 rc = -EIO;
314 goto neg_exit;
315 }
316#ifdef CONFIG_SMB2_ASN1 /* BB REMOVEME when updated asn1.c ready */
317 rc = decode_neg_token_init(security_blob, blob_length,
318 &server->sec_type);
319 if (rc == 1)
320 rc = 0;
321 else if (rc == 0) {
322 rc = -EIO;
323 goto neg_exit;
324 }
325#endif
326
327neg_exit:
328 free_rsp_buf(resp_buftype, rsp);
329 return rc;
330}
diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h
index b08a277df896..ef8dae213f60 100644
--- a/fs/cifs/smb2pdu.h
+++ b/fs/cifs/smb2pdu.h
@@ -148,4 +148,43 @@ struct smb2_err_rsp {
148 __u8 ErrorData[1]; /* variable length */ 148 __u8 ErrorData[1]; /* variable length */
149} __packed; 149} __packed;
150 150
151struct smb2_negotiate_req {
152 struct smb2_hdr hdr;
153 __le16 StructureSize; /* Must be 36 */
154 __le16 DialectCount;
155 __le16 SecurityMode;
156 __le16 Reserved; /* MBZ */
157 __le32 Capabilities;
158 __u8 ClientGUID[16]; /* MBZ */
159 __le64 ClientStartTime; /* MBZ */
160 __le16 Dialects[2]; /* variable length */
161} __packed;
162
163/* SecurityMode flags */
164#define SMB2_NEGOTIATE_SIGNING_ENABLED 0x0001
165#define SMB2_NEGOTIATE_SIGNING_REQUIRED 0x0002
166/* Capabilities flags */
167#define SMB2_GLOBAL_CAP_DFS 0x00000001
168#define SMB2_GLOBAL_CAP_LEASING 0x00000002 /* Resp only New to SMB2.1 */
169#define SMB2_GLOBAL_CAP_LARGE_MTU 0X00000004 /* Resp only New to SMB2.1 */
170
171struct smb2_negotiate_rsp {
172 struct smb2_hdr hdr;
173 __le16 StructureSize; /* Must be 65 */
174 __le16 SecurityMode;
175 __le16 DialectRevision;
176 __le16 Reserved; /* MBZ */
177 __u8 ServerGUID[16];
178 __le32 Capabilities;
179 __le32 MaxTransactSize;
180 __le32 MaxReadSize;
181 __le32 MaxWriteSize;
182 __le64 SystemTime; /* MBZ */
183 __le64 ServerStartTime;
184 __le16 SecurityBufferOffset;
185 __le16 SecurityBufferLength;
186 __le32 Reserved2; /* may be any value, ignore */
187 __u8 Buffer[1]; /* variable length GSS security buffer */
188} __packed;
189
151#endif /* _SMB2PDU_H */ 190#endif /* _SMB2PDU_H */
diff --git a/fs/cifs/smb2proto.h b/fs/cifs/smb2proto.h
index 19bf987c2648..881767002807 100644
--- a/fs/cifs/smb2proto.h
+++ b/fs/cifs/smb2proto.h
@@ -35,10 +35,17 @@ struct statfs;
35extern int map_smb2_to_linux_error(char *buf, bool log_err); 35extern int map_smb2_to_linux_error(char *buf, bool log_err);
36extern int smb2_check_message(char *buf, unsigned int length); 36extern int smb2_check_message(char *buf, unsigned int length);
37extern unsigned int smb2_calc_size(struct smb2_hdr *hdr); 37extern unsigned int smb2_calc_size(struct smb2_hdr *hdr);
38extern char *smb2_get_data_area_len(int *off, int *len, struct smb2_hdr *hdr);
38 39
39extern int smb2_check_receive(struct mid_q_entry *mid, 40extern int smb2_check_receive(struct mid_q_entry *mid,
40 struct TCP_Server_Info *server, bool log_error); 41 struct TCP_Server_Info *server, bool log_error);
41extern int smb2_setup_request(struct cifs_ses *ses, struct kvec *iov, 42extern int smb2_setup_request(struct cifs_ses *ses, struct kvec *iov,
42 unsigned int nvec, struct mid_q_entry **ret_mid); 43 unsigned int nvec, struct mid_q_entry **ret_mid);
43 44
45/*
46 * SMB2 Worker functions - most of protocol specific implementation details
47 * are contained within these calls.
48 */
49extern int SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses);
50
44#endif /* _SMB2PROTO_H */ 51#endif /* _SMB2PROTO_H */