Print this page
NEX-15069 smtorture smb2.create.blob is failed
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
NEX-15069 smtorture smb2.create.blob is failed
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-4458 Incorrect directory listing response for non-UNICODE clients
Reviewed by: Matt Barden <Matt.Barden@nexenta.com>
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
NEX-4540 SMB server declines EA support incorrectly
Reviewed by: Bayard Bell <bayard.bell@nexenta.com>
Reviewed by: Matt Barden <Matt.Barden@nexenta.com>
NEX-4053 Customer DIR command hangs with smb2 enabled
NEX-4080 SMB_ODIR_FLAG_WILDCARDS can be incorrectly inherited
Reviewed by: Gordon Ross <gordon.ross@nexenta.com>
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)
SMB-50 User-mode SMB server
Includes work by these authors:
Thomas Keiser <thomas.keiser@nexenta.com>
Albert Lee <trisk@nexenta.com>
SMB-63 taskq_create_proc ... TQ_DYNAMIC puts tasks in p0
re #11974 CIFS Share - Tree connect fails from Windows 7 Clients
re #10733 Windows 7 directory listing keeps restarting (fix lint)
re #10733 Windows 7 directory listing keeps restarting
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/fs/smbsrv/smb_trans2_find.c
+++ new/usr/src/uts/common/fs/smbsrv/smb_trans2_find.c
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
↓ open down ↓ |
14 lines elided |
↑ open up ↑ |
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 24 *
25 - * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
25 + * Copyright 2017 Nexenta Systems, Inc. All rights reserved.
26 26 */
27 27
28 28
29 29 /*
30 30 * This module provides functions for TRANS2_FIND_FIRST2 and
31 31 * TRANS2_FIND_NEXT2 requests. The requests allow the client to search
32 32 * for the file(s) which match the file specification. The search is
33 33 * started with TRANS2_FIND_FIRST2 and can be continued if necessary with
34 34 * TRANS2_FIND_NEXT2. There are numerous levels of information which may be
35 35 * obtained for the returned files, the desired level is specified in the
36 36 * InformationLevel field of the requests.
37 37 *
38 38 * InformationLevel Name Value
39 39 * ================================= ================
40 40 *
41 41 * SMB_INFO_STANDARD 1
42 42 * SMB_INFO_QUERY_EA_SIZE 2
43 43 * SMB_INFO_QUERY_EAS_FROM_LIST 3
44 44 * SMB_FIND_FILE_DIRECTORY_INFO 0x101
45 45 * SMB_FIND_FILE_FULL_DIRECTORY_INFO 0x102
46 46 * SMB_FIND_FILE_NAMES_INFO 0x103
47 47 * SMB_FIND_FILE_BOTH_DIRECTORY_INFO 0x104
48 48 * SMB_FIND_FILE_ID_FULL_DIRECTORY_INFO 0x105
49 49 * SMB_FIND_FILE_ID_BOTH_DIRECTORY_INFO 0x106
50 50 *
51 51 * The following sections detail the data returned for each
52 52 * InformationLevel. The requested information is placed in the Data
53 53 * portion of the transaction response. Note: a client which does not
54 54 * support long names can only request SMB_INFO_STANDARD.
55 55 *
56 56 * A four-byte resume key precedes each data item (described below) if bit
57 57 * 2 in the Flags field is set, i.e. if the request indicates the server
58 58 * should return resume keys. Note: it is not always the case. If the
59 59 * data item already includes the resume key, the resume key should not be
60 60 * added again.
61 61 *
62 62 * 4.3.4.1 SMB_INFO_STANDARD
63 63 *
64 64 * Response Field Description
65 65 * ================================ ==================================
66 66 *
67 67 * SMB_DATE CreationDate; Date when file was created
68 68 * SMB_TIME CreationTime; Time when file was created
69 69 * SMB_DATE LastAccessDate; Date of last file access
70 70 * SMB_TIME LastAccessTime; Time of last file access
71 71 * SMB_DATE LastWriteDate; Date of last write to the file
72 72 * SMB_TIME LastWriteTime; Time of last write to the file
73 73 * ULONG DataSize; File Size
74 74 * ULONG AllocationSize; Size of filesystem allocation unit
75 75 * USHORT Attributes; File Attributes
76 76 * UCHAR FileNameLength; Length of filename in bytes
77 77 * STRING FileName; Name of found file
78 78 *
79 79 * 4.3.4.2 SMB_INFO_QUERY_EA_SIZE
80 80 *
81 81 * Response Field Description
82 82 * ================================= ==================================
83 83 *
84 84 * SMB_DATE CreationDate; Date when file was created
85 85 * SMB_TIME CreationTime; Time when file was created
86 86 * SMB_DATE LastAccessDate; Date of last file access
87 87 * SMB_TIME LastAccessTime; Time of last file access
88 88 * SMB_DATE LastWriteDate; Date of last write to the file
89 89 * SMB_TIME LastWriteTime; Time of last write to the file
90 90 * ULONG DataSize; File Size
91 91 * ULONG AllocationSize; Size of filesystem allocation unit
92 92 * USHORT Attributes; File Attributes
93 93 * ULONG EaSize; Size of file's EA information
94 94 * UCHAR FileNameLength; Length of filename in bytes
95 95 * STRING FileName; Name of found file
96 96 *
97 97 * 4.3.4.3 SMB_INFO_QUERY_EAS_FROM_LIST
98 98 *
99 99 * This request returns the same information as SMB_INFO_QUERY_EA_SIZE, but
100 100 * only for files which have an EA list which match the EA information in
101 101 * the Data part of the request.
102 102 *
103 103 * 4.3.4.4 SMB_FIND_FILE_DIRECTORY_INFO
104 104 *
105 105 * Response Field Description
106 106 * ================================= ==================================
107 107 *
108 108 * ULONG NextEntryOffset; Offset from this structure to
109 109 * beginning of next one
110 110 * ULONG FileIndex;
111 111 * LARGE_INTEGER CreationTime; file creation time
112 112 * LARGE_INTEGER LastAccessTime; last access time
113 113 * LARGE_INTEGER LastWriteTime; last write time
114 114 * LARGE_INTEGER ChangeTime; last attribute change time
115 115 * LARGE_INTEGER EndOfFile; file size
116 116 * LARGE_INTEGER AllocationSize; size of filesystem allocation information
117 117 * ULONG ExtFileAttributes; Extended file attributes
118 118 * (see section 3.11)
119 119 * ULONG FileNameLength; Length of filename in bytes
120 120 * STRING FileName; Name of the file
121 121 *
122 122 * 4.3.4.5 SMB_FIND_FILE_FULL_DIRECTORY_INFO
123 123 *
124 124 * Response Field Description
125 125 * ================================= ==================================
126 126 *
127 127 * ULONG NextEntryOffset; Offset from this structure to
128 128 * beginning of next one
129 129 * ULONG FileIndex;
130 130 * LARGE_INTEGER CreationTime; file creation time
131 131 * LARGE_INTEGER LastAccessTime; last access time
132 132 * LARGE_INTEGER LastWriteTime; last write time
133 133 * LARGE_INTEGER ChangeTime; last attribute change time
134 134 * LARGE_INTEGER EndOfFile; file size
135 135 * LARGE_INTEGER AllocationSize; size of filesystem allocation information
136 136 * ULONG ExtFileAttributes; Extended file attributes
137 137 * (see section 3.11)
138 138 * ULONG FileNameLength; Length of filename in bytes
139 139 * ULONG EaSize; Size of file's extended attributes
140 140 * STRING FileName; Name of the file
141 141 *
142 142 *
143 143 * SMB_FIND_FILE_ID_FULL_DIRECTORY_INFO
144 144 *
145 145 * This is the same as SMB_FIND_FILE_FULL_DIRECTORY_INFO but with
146 146 * FileId inserted after EaSize. FileId is preceded by a 4 byte
147 147 * alignment padding.
148 148 *
149 149 * Response Field Description
150 150 * ================================= ==================================
151 151 * ...
152 152 * ULONG EaSize; Size of file's extended attributes
153 153 * UCHAR Reserved[4]
154 154 * LARGE_INTEGER FileId Internal file system unique id.
155 155 * STRING FileName; Name of the file
156 156 *
157 157 * 4.3.4.6 SMB_FIND_FILE_BOTH_DIRECTORY_INFO
158 158 *
159 159 * Response Field Description
160 160 * ================================= ==================================
161 161 *
162 162 * ULONG NextEntryOffset; Offset from this structure to
163 163 * beginning of next one
164 164 * ULONG FileIndex;
165 165 * LARGE_INTEGER CreationTime; file creation time
166 166 * LARGE_INTEGER LastAccessTime; last access time
167 167 * LARGE_INTEGER LastWriteTime; last write time
168 168 * LARGE_INTEGER ChangeTime; last attribute change time
169 169 * LARGE_INTEGER EndOfFile; file size
170 170 * LARGE_INTEGER AllocationSize; size of filesystem allocation information
171 171 * ULONG ExtFileAttributes; Extended file attributes
172 172 * (see section 3.11)
173 173 * ULONG FileNameLength; Length of FileName in bytes
174 174 * ULONG EaSize; Size of file's extended attributes
175 175 * UCHAR ShortNameLength; Length of file's short name in bytes
176 176 * UCHAR Reserved
177 177 * WCHAR ShortName[12]; File's 8.3 conformant name in Unicode
178 178 * STRING FileName; Files full length name
179 179 *
180 180 *
181 181 * SMB_FIND_FILE_ID_BOTH_DIRECTORY_INFO
182 182 *
183 183 * This is the same as SMB_FIND_FILE_BOTH_DIRECTORY_INFO but with
184 184 * FileId inserted after ShortName. FileId is preceded by a 2 byte
185 185 * alignment pad.
186 186 *
187 187 * Response Field Description
188 188 * ================================= ==================================
189 189 * ...
190 190 * WCHAR ShortName[12]; File's 8.3 conformant name in Unicode
191 191 * UCHAR Reserved[2]
192 192 * LARGE_INTEGER FileId Internal file system unique id.
193 193 * STRING FileName; Files full length name
194 194 *
195 195 * 4.3.4.7 SMB_FIND_FILE_NAMES_INFO
196 196 *
197 197 * Response Field Description
198 198 * ================================= ==================================
199 199 *
200 200 * ULONG NextEntryOffset; Offset from this structure to
201 201 * beginning of next one
202 202 * ULONG FileIndex;
203 203 * ULONG FileNameLength; Length of FileName in bytes
204 204 * STRING FileName; Files full length name
205 205 */
|
↓ open down ↓ |
170 lines elided |
↑ open up ↑ |
206 206
207 207 #include <smbsrv/smb_kproto.h>
208 208 #include <smbsrv/msgbuf.h>
209 209 #include <smbsrv/smb_fsops.h>
210 210
211 211 /*
212 212 * Args (and other state) that we carry around among the
213 213 * various functions involved in FindFirst, FindNext.
214 214 */
215 215 typedef struct smb_find_args {
216 - uint32_t fa_maxdata;
216 + uint32_t fa_fixedsize;
217 217 uint16_t fa_infolev;
218 218 uint16_t fa_maxcount;
219 219 uint16_t fa_fflag;
220 220 uint16_t fa_eos; /* End Of Search */
221 221 uint16_t fa_lno; /* Last Name Offset */
222 222 uint32_t fa_lastkey; /* Last resume key */
223 223 char fa_lastname[MAXNAMELEN]; /* and name */
224 224 } smb_find_args_t;
225 225
226 226 static int smb_trans2_find_entries(smb_request_t *, smb_xa_t *,
227 227 smb_odir_t *, smb_find_args_t *);
228 -static int smb_trans2_find_get_maxdata(smb_request_t *, uint16_t, uint16_t);
228 +static int smb_trans2_find_get_fixedsize(smb_request_t *, uint16_t, uint16_t);
229 229 static int smb_trans2_find_mbc_encode(smb_request_t *, smb_xa_t *,
230 230 smb_fileinfo_t *, smb_find_args_t *);
231 231
232 232 /*
233 233 * Tunable parameter to limit the maximum
234 234 * number of entries to be returned.
235 235 */
236 236 uint16_t smb_trans2_find_max = 128;
237 237
238 238 /*
239 239 * smb_com_trans2_find_first2
240 240 *
241 241 * Client Request Value
242 242 * ============================ ==================================
243 243 *
244 244 * UCHAR WordCount 15
245 245 * UCHAR TotalDataCount Total size of extended attribute list
246 246 * UCHAR SetupCount 1
247 247 * UCHAR Setup[0] TRANS2_FIND_FIRST2
248 248 *
249 249 * Parameter Block Encoding Description
250 250 * ============================ ==================================
251 251 * USHORT SearchAttributes;
252 252 * USHORT SearchCount; Maximum number of entries to return
253 253 * USHORT Flags; Additional information:
254 254 * Bit 0 - close search after this request
255 255 * Bit 1 - close search if end of search
256 256 * reached
257 257 * Bit 2 - return resume keys for each
258 258 * entry found
259 259 * Bit 3 - continue search from previous
260 260 * ending place
261 261 * Bit 4 - find with backup intent
262 262 * USHORT InformationLevel; See below
263 263 * ULONG SearchStorageType;
264 264 * STRING FileName; Pattern for the search
265 265 * UCHAR Data[ TotalDataCount ] FEAList if InformationLevel is
266 266 * QUERY_EAS_FROM_LIST
267 267 *
268 268 * Response Parameter Block Description
269 269 * ============================ ==================================
270 270 *
271 271 * USHORT Sid; Search handle
272 272 * USHORT SearchCount; Number of entries returned
273 273 * USHORT EndOfSearch; Was last entry returned?
274 274 * USHORT EaErrorOffset; Offset into EA list if EA error
275 275 * USHORT LastNameOffset; Offset into data to file name of last
276 276 * entry, if server needs it to resume
277 277 * search; else 0
278 278 * UCHAR Data[ TotalDataCount ] Level dependent info about the matches
279 279 * found in the search
280 280 */
281 281 smb_sdrc_t
282 282 smb_com_trans2_find_first2(smb_request_t *sr, smb_xa_t *xa)
283 283 {
284 284 int count;
285 285 uint16_t sattr;
286 286 smb_pathname_t *pn;
287 287 smb_odir_t *od;
288 288 smb_find_args_t args;
289 289 uint32_t status;
290 290 uint32_t odir_flags = 0;
291 291
292 292 bzero(&args, sizeof (smb_find_args_t));
293 293
294 294 if (!STYPE_ISDSK(sr->tid_tree->t_res_type)) {
295 295 smbsr_error(sr, NT_STATUS_ACCESS_DENIED,
296 296 ERRDOS, ERROR_ACCESS_DENIED);
297 297 return (SDRC_ERROR);
298 298 }
299 299
300 300 pn = &sr->arg.dirop.fqi.fq_path;
301 301
302 302 if (smb_mbc_decodef(&xa->req_param_mb, "%wwww4.u", sr, &sattr,
303 303 &args.fa_maxcount, &args.fa_fflag, &args.fa_infolev,
304 304 &pn->pn_path) != 0) {
305 305 return (SDRC_ERROR);
306 306 }
307 307
308 308 smb_pathname_init(sr, pn, pn->pn_path);
309 309 if (!smb_pathname_validate(sr, pn))
310 310 return (-1);
311 311
312 312 if (smb_is_stream_name(pn->pn_path)) {
|
↓ open down ↓ |
74 lines elided |
↑ open up ↑ |
313 313 smbsr_error(sr, NT_STATUS_OBJECT_NAME_INVALID,
314 314 ERRDOS, ERROR_INVALID_NAME);
315 315 return (SDRC_ERROR);
316 316 }
317 317
318 318 if (args.fa_fflag & SMB_FIND_WITH_BACKUP_INTENT) {
319 319 sr->user_cr = smb_user_getprivcred(sr->uid_user);
320 320 odir_flags = SMB_ODIR_OPENF_BACKUP_INTENT;
321 321 }
322 322
323 - args.fa_maxdata =
324 - smb_trans2_find_get_maxdata(sr, args.fa_infolev, args.fa_fflag);
325 - if (args.fa_maxdata == 0)
323 + args.fa_fixedsize =
324 + smb_trans2_find_get_fixedsize(sr, args.fa_infolev, args.fa_fflag);
325 + if (args.fa_fixedsize == 0)
326 326 return (SDRC_ERROR);
327 327
328 328 status = smb_odir_openpath(sr, pn->pn_path, sattr, odir_flags, &od);
329 329 if (status != 0) {
330 330 smbsr_error(sr, status, 0, 0);
331 331 return (SDRC_ERROR);
332 332 }
333 333 if (od == NULL)
334 334 return (SDRC_ERROR);
335 335
336 336 count = smb_trans2_find_entries(sr, xa, od, &args);
|
↓ open down ↓ |
1 lines elided |
↑ open up ↑ |
337 337
338 338 if (count == -1) {
339 339 smb_odir_close(od);
340 340 smb_odir_release(od);
341 341 return (SDRC_ERROR);
342 342 }
343 343
344 344 if (count == 0) {
345 345 smb_odir_close(od);
346 346 smb_odir_release(od);
347 - smbsr_errno(sr, ENOENT);
347 + smbsr_status(sr, NT_STATUS_NO_SUCH_FILE,
348 + ERRDOS, ERROR_FILE_NOT_FOUND);
348 349 return (SDRC_ERROR);
349 350 }
350 351
351 352 if ((args.fa_fflag & SMB_FIND_CLOSE_AFTER_REQUEST) ||
352 353 (args.fa_eos && (args.fa_fflag & SMB_FIND_CLOSE_AT_EOS))) {
353 354 smb_odir_close(od);
354 355 } /* else leave odir open for trans2_find_next2 */
355 356
356 357 (void) smb_mbc_encodef(&xa->rep_param_mb, "wwwww",
357 358 od->d_odid, /* Search ID */
358 359 count, /* Search Count */
359 360 args.fa_eos, /* End Of Search */
360 361 0, /* EA Error Offset */
361 362 args.fa_lno); /* Last Name Offset */
362 363
363 364 smb_odir_release(od);
364 365
365 366 return (SDRC_SUCCESS);
366 367 }
367 368
368 369 /*
369 370 * smb_com_trans2_find_next2
370 371 *
371 372 * Client Request Value
372 373 * ================================== =================================
373 374 *
374 375 * WordCount 15
375 376 * SetupCount 1
376 377 * Setup[0] TRANS2_FIND_NEXT2
377 378 *
378 379 * Parameter Block Encoding Description
379 380 * ================================== =================================
380 381 *
381 382 * USHORT Sid; Search handle
382 383 * USHORT SearchCount; Maximum number of entries to
383 384 * return
384 385 * USHORT InformationLevel; Levels described in
385 386 * TRANS2_FIND_FIRST2 request
386 387 * ULONG ResumeKey; Value returned by previous find2
387 388 * call
388 389 * USHORT Flags; Additional information: bit set-
389 390 * 0 - close search after this
390 391 * request
391 392 * 1 - close search if end of search
392 393 * reached
393 394 * 2 - return resume keys for each
394 395 * entry found
395 396 * 3 - resume/continue from previous
396 397 * ending place
397 398 * 4 - find with backup intent
398 399 * STRING FileName; Resume file name
399 400 *
400 401 * Sid is the value returned by a previous successful TRANS2_FIND_FIRST2
401 402 * call. If Bit3 of Flags is set, then FileName may be the NULL string,
402 403 * since the search is continued from the previous TRANS2_FIND request.
403 404 * Otherwise, FileName must not be more than 256 characters long.
404 405 *
405 406 * Response Field Description
406 407 * ================================== =================================
407 408 *
408 409 * USHORT SearchCount; Number of entries returned
409 410 * USHORT EndOfSearch; Was last entry returned?
410 411 * USHORT EaErrorOffset; Offset into EA list if EA error
411 412 * USHORT LastNameOffset; Offset into data to file name of
412 413 * last entry, if server needs it to
413 414 * resume search; else 0
414 415 * UCHAR Data[TotalDataCount] Level dependent info about the
415 416 * matches found in the search
416 417 *
417 418 *
418 419 * The last parameter in the request is a filename, which is a
419 420 * null-terminated unicode string.
420 421 *
421 422 * smb_mbc_decodef(&xa->req_param_mb, "%www lwu", sr,
422 423 * &odid, &fa_maxcount, &fa_infolev, &cookie, &fa_fflag, &fname)
423 424 *
424 425 * The filename parameter is not currently decoded because we
425 426 * expect a 2-byte null but Mac OS 10 clients send a 1-byte null,
426 427 * which leads to a decode error.
427 428 * Thus, we do not support resume by filename. We treat a request
428 429 * to resume by filename as SMB_FIND_CONTINUE_FROM_LAST.
429 430 */
430 431 smb_sdrc_t
431 432 smb_com_trans2_find_next2(smb_request_t *sr, smb_xa_t *xa)
432 433 {
433 434 int count;
434 435 uint16_t odid;
435 436 smb_odir_t *od;
436 437 smb_find_args_t args;
437 438 smb_odir_resume_t odir_resume;
438 439
439 440 bzero(&args, sizeof (args));
440 441 bzero(&odir_resume, sizeof (odir_resume));
441 442
442 443 if (!STYPE_ISDSK(sr->tid_tree->t_res_type)) {
443 444 smbsr_error(sr, NT_STATUS_ACCESS_DENIED,
444 445 ERRDOS, ERROR_ACCESS_DENIED);
445 446 return (SDRC_ERROR);
446 447 }
447 448
|
↓ open down ↓ |
90 lines elided |
↑ open up ↑ |
448 449 if (smb_mbc_decodef(&xa->req_param_mb, "%wwwlwu", sr,
449 450 &odid, &args.fa_maxcount, &args.fa_infolev,
450 451 &odir_resume.or_cookie, &args.fa_fflag,
451 452 &odir_resume.or_fname) != 0) {
452 453 return (SDRC_ERROR);
453 454 }
454 455
455 456 if (args.fa_fflag & SMB_FIND_WITH_BACKUP_INTENT)
456 457 sr->user_cr = smb_user_getprivcred(sr->uid_user);
457 458
458 - args.fa_maxdata =
459 - smb_trans2_find_get_maxdata(sr, args.fa_infolev, args.fa_fflag);
460 - if (args.fa_maxdata == 0)
459 + args.fa_fixedsize =
460 + smb_trans2_find_get_fixedsize(sr, args.fa_infolev, args.fa_fflag);
461 + if (args.fa_fixedsize == 0)
461 462 return (SDRC_ERROR);
462 463
463 464 od = smb_tree_lookup_odir(sr, odid);
464 465 if (od == NULL) {
465 466 smbsr_error(sr, NT_STATUS_INVALID_HANDLE,
466 467 ERRDOS, ERROR_INVALID_HANDLE);
467 468 return (SDRC_ERROR);
468 469 }
469 470
470 471 /*
471 472 * Set the correct position in the directory.
472 473 *
473 474 * "Continue from last" is easy, but due to a history of
474 475 * buggy server implementations, most clients don't use
475 476 * that method. The most widely used (and reliable) is
476 477 * resume by file name. Unfortunately, that can't really
477 478 * be fully supported unless your file system stores all
478 479 * directory entries in some sorted order (like NTFS).
479 480 * We can partially support resume by name, where the only
480 481 * name we're ever asked to resume on is the same as the
481 482 * most recent we returned. That's always what the client
482 483 * gives us as the resume name, so we can simply remember
483 484 * the last name/offset pair and use that to position on
484 485 * the following FindNext call. In the unlikely event
485 486 * that the client asks to resume somewhere else, we'll
486 487 * use the numeric resume key, and hope the client gives
487 488 * correctly uses one of the resume keys we provided.
488 489 */
489 490 if (args.fa_fflag & SMB_FIND_CONTINUE_FROM_LAST) {
490 491 odir_resume.or_type = SMB_ODIR_RESUME_CONT;
491 492 } else {
492 493 odir_resume.or_type = SMB_ODIR_RESUME_FNAME;
493 494 }
494 495 smb_odir_resume_at(od, &odir_resume);
495 496
496 497 count = smb_trans2_find_entries(sr, xa, od, &args);
497 498 if (count == -1) {
498 499 smb_odir_close(od);
499 500 smb_odir_release(od);
500 501 return (SDRC_ERROR);
501 502 }
502 503
503 504 if ((args.fa_fflag & SMB_FIND_CLOSE_AFTER_REQUEST) ||
504 505 (args.fa_eos && (args.fa_fflag & SMB_FIND_CLOSE_AT_EOS))) {
505 506 smb_odir_close(od);
506 507 } /* else leave odir open for trans2_find_next2 */
507 508
508 509 smb_odir_release(od);
509 510
510 511 (void) smb_mbc_encodef(&xa->rep_param_mb, "wwww",
511 512 count, /* Search Count */
512 513 args.fa_eos, /* End Of Search */
513 514 0, /* EA Error Offset */
514 515 args.fa_lno); /* Last Name Offset */
515 516
516 517 return (SDRC_SUCCESS);
517 518 }
518 519
519 520
520 521 /*
521 522 * smb_trans2_find_entries
522 523 *
523 524 * Find and encode up to args->fa_maxcount directory entries.
524 525 * For compatibilty with Windows, if args->fa_maxcount is zero treat it as 1.
525 526 *
526 527 * Returns:
527 528 * count - count of entries encoded
528 529 * *eos = B_TRUE if no more directory entries
|
↓ open down ↓ |
58 lines elided |
↑ open up ↑ |
529 530 * -1 - error
530 531 */
531 532 static int
532 533 smb_trans2_find_entries(smb_request_t *sr, smb_xa_t *xa, smb_odir_t *od,
533 534 smb_find_args_t *args)
534 535 {
535 536 smb_fileinfo_t fileinfo;
536 537 smb_odir_resume_t odir_resume;
537 538 uint16_t count, maxcount;
538 539 int rc = -1;
540 + int LastEntryOffset = 0;
539 541 boolean_t need_rewind = B_FALSE;
540 542
543 + /*
544 + * EAs are not current supported, so a search for level
545 + * SMB_INFO_QUERY_EAS_FROM_LIST should always return an
546 + * empty list. Returning zero for this case gives the
547 + * client an empty response, which is better than an
548 + * NT_STATUS_INVALID_LEVEL return (and test failures).
549 + *
550 + * If and when we do support EAs, this level will modify
551 + * the search here, and then return results just like
552 + * SMB_INFO_QUERY_EA_SIZE, but only including files
553 + * that have an EA in the provided list.
554 + */
555 + if (args->fa_infolev == SMB_INFO_QUERY_EAS_FROM_LIST)
556 + return (0);
557 +
541 558 if ((maxcount = args->fa_maxcount) == 0)
542 559 maxcount = 1;
543 560
544 561 if ((smb_trans2_find_max != 0) && (maxcount > smb_trans2_find_max))
545 562 maxcount = smb_trans2_find_max;
546 563
547 564 count = 0;
548 565 while (count < maxcount) {
549 566 rc = smb_odir_read_fileinfo(sr, od, &fileinfo, &args->fa_eos);
550 567 if (rc != 0 || args->fa_eos != 0)
551 568 break;
552 569
570 + LastEntryOffset = xa->rep_data_mb.chain_offset;
553 571 rc = smb_trans2_find_mbc_encode(sr, xa, &fileinfo, args);
554 572 if (rc == -1)
555 573 return (-1); /* fatal encoding error */
556 574 if (rc == 1) {
557 575 need_rewind = B_TRUE;
558 576 break; /* output space exhausted */
559 577 }
560 578
561 579 /*
562 580 * Save the info about the last file returned.
563 581 */
564 582 args->fa_lastkey = fileinfo.fi_cookie;
565 583 bcopy(fileinfo.fi_name, args->fa_lastname, MAXNAMELEN);
566 584
567 585 ++count;
568 586 }
569 587 if (args->fa_eos != 0 && rc == ENOENT)
570 588 rc = 0;
571 589
590 + /*
591 + * All but the ancient info levels start with NextEntryOffset.
592 + * That's supposed to be zero in the last entry returned.
593 + */
594 + if (args->fa_infolev >= SMB_FIND_FILE_DIRECTORY_INFO) {
595 + (void) smb_mbc_poke(&xa->rep_data_mb,
596 + LastEntryOffset, "l", 0);
597 + }
598 +
572 599 /* save the last cookie returned to client */
573 600 if (count != 0)
574 601 smb_odir_save_fname(od, args->fa_lastkey, args->fa_lastname);
575 602
576 603 /*
577 604 * If all retrieved entries have been successfully encoded
578 605 * and eos has not already been detected, check if there are
579 606 * any more entries. eos will be set if there are no more.
580 607 */
581 608 if ((rc == 0) && (args->fa_eos == 0)) {
582 609 rc = smb_odir_read_fileinfo(sr, od, &fileinfo, &args->fa_eos);
583 610 /*
584 611 * If rc == ENOENT, we did not read any additional data.
585 612 * if rc != 0, there's no need to rewind.
586 613 */
587 614 if (rc == 0)
588 615 need_rewind = B_TRUE;
589 616 }
590 617
591 618 /*
592 619 * When the last entry we read from the directory did not
593 620 * fit in the return buffer, we will have read one entry
594 621 * that will not be returned in this call. That, and the
595 622 * check for EOS just above both can leave the directory
596 623 * position incorrect for the next call. Fix that now.
597 624 */
598 625 if (need_rewind) {
|
↓ open down ↓ |
17 lines elided |
↑ open up ↑ |
599 626 bzero(&odir_resume, sizeof (odir_resume));
600 627 odir_resume.or_type = SMB_ODIR_RESUME_COOKIE;
601 628 odir_resume.or_cookie = args->fa_lastkey;
602 629 smb_odir_resume_at(od, &odir_resume);
603 630 }
604 631
605 632 return (count);
606 633 }
607 634
608 635 /*
609 - * smb_trans2_find_get_maxdata
636 + * smb_trans2_find_get_fixedsize
610 637 *
611 - * Calculate the minimum response space required for the specified
612 - * information level.
638 + * Calculate the sizeof the fixed part of the response for the
639 + * specified information level.
613 640 *
614 - * A non-zero return value provides the minimum space required.
641 + * A non-zero return value provides the fixed size.
615 642 * A return value of zero indicates an unknown information level.
616 643 */
617 644 static int
618 -smb_trans2_find_get_maxdata(smb_request_t *sr, uint16_t infolev, uint16_t fflag)
645 +smb_trans2_find_get_fixedsize(smb_request_t *sr, uint16_t infolev,
646 + uint16_t fflag)
619 647 {
620 - int maxdata;
648 + int maxdata = 0;
621 649
622 - maxdata = smb_ascii_or_unicode_null_len(sr);
623 -
624 650 switch (infolev) {
625 651 case SMB_INFO_STANDARD :
626 652 if (fflag & SMB_FIND_RETURN_RESUME_KEYS)
627 653 maxdata += sizeof (int32_t);
628 654 maxdata += 2 + 2 + 2 + 4 + 4 + 2 + 1;
629 655 break;
630 656
631 657 case SMB_INFO_QUERY_EA_SIZE:
658 + case SMB_INFO_QUERY_EAS_FROM_LIST:
632 659 if (fflag & SMB_FIND_RETURN_RESUME_KEYS)
633 660 maxdata += sizeof (int32_t);
634 661 maxdata += 2 + 2 + 2 + 4 + 4 + 2 + 4 + 1;
635 662 break;
636 663
637 664 case SMB_FIND_FILE_DIRECTORY_INFO:
638 665 maxdata += 4 + 4 + 8 + 8 + 8 + 8 + 8 + 8 + 4 + 4;
639 666 break;
640 667
641 668 case SMB_FIND_FILE_FULL_DIRECTORY_INFO:
642 669 maxdata += 4 + 4 + 8 + 8 + 8 + 8 + 8 + 8 + 4 + 4 + 4;
643 670 break;
644 671
645 672 case SMB_FIND_FILE_ID_FULL_DIRECTORY_INFO:
646 673 maxdata += 4 + 4 + 8 + 8 + 8 + 8 + 8 + 8 + 4 + 4 + 4 + 4 + 8;
647 674 break;
648 675
649 676 case SMB_FIND_FILE_BOTH_DIRECTORY_INFO:
650 677 maxdata += 4 + 4 + 8 + 8 + 8 + 8 + 8 + 8 + 4 + 4 + 4 + 2 + 24;
651 678 break;
652 679
653 680 case SMB_FIND_FILE_ID_BOTH_DIRECTORY_INFO:
654 681 maxdata += 4 + 4 + 8 + 8 + 8 + 8 + 8 + 8 + 4 + 4 + 4 + 2 + 24
655 682 + 2 + 8;
656 683 break;
657 684
658 685 case SMB_FIND_FILE_NAMES_INFO:
659 686 maxdata += 4 + 4 + 4;
660 687 break;
661 688
662 689 case SMB_MAC_FIND_BOTH_HFS_INFO:
663 690 maxdata += 4 + 4 + 8 + 8 + 8 + 8 + 8 + 8 + 8 + 4 + 1 + 1 + 2 +
664 691 4 + 32 + 4 + 1 + 1 + 24 + 4;
665 692 break;
666 693
667 694 default:
668 695 maxdata = 0;
669 696 smbsr_error(sr, NT_STATUS_INVALID_LEVEL,
670 697 ERRDOS, ERROR_INVALID_LEVEL);
671 698 }
672 699
673 700 return (maxdata);
674 701 }
675 702
676 703 /*
677 704 * This is an experimental feature that allows us to return zero
678 705 * for all numeric resume keys, to match Windows behavior with an
679 706 * NTFS share. Setting this variable to zero does that.
680 707 *
681 708 * It's possible we could remove this variable and always set
682 709 * numeric resume keys to zero, but that would leave us unable
683 710 * to handle a FindNext call with an arbitrary start position.
684 711 * In practice we never see these, but in theory we could.
685 712 *
686 713 * See the long comment above smb_com_trans2_find_next2() for
687 714 * more details about resume key / resume name handling.
688 715 */
689 716 int smbd_use_resume_keys = 1;
690 717
691 718 /*
692 719 * smb_trans2_mbc_encode
693 720 *
694 721 * This function encodes the mbc for one directory entry.
695 722 *
696 723 * The function returns -1 when the max data requested by client
697 724 * is reached. If the entry is valid and successful encoded, 0
698 725 * will be returned; otherwise, 1 will be returned.
699 726 *
700 727 * We always null terminate the filename. The space for the null
701 728 * is included in the maxdata calculation and is therefore included
702 729 * in the next_entry_offset. namelen is the unterminated length of
703 730 * the filename. For levels except STANDARD and EA_SIZE, if the
704 731 * filename is ascii the name length returned to the client should
705 732 * include the null terminator. Otherwise the length returned to
706 733 * the client should not include the terminator.
707 734 *
708 735 * Returns: 0 - data successfully encoded
709 736 * 1 - client request's maxdata limit reached
710 737 * -1 - error
711 738 */
712 739 static int
|
↓ open down ↓ |
71 lines elided |
↑ open up ↑ |
713 740 smb_trans2_find_mbc_encode(smb_request_t *sr, smb_xa_t *xa,
714 741 smb_fileinfo_t *fileinfo, smb_find_args_t *args)
715 742 {
716 743 int namelen, shortlen;
717 744 uint32_t next_entry_offset;
718 745 uint32_t dsize32, asize32;
719 746 uint32_t mb_flags = 0;
720 747 uint32_t resume_key;
721 748 char buf83[26];
722 749 smb_msgbuf_t mb;
750 + int pad = 0;
723 751
724 752 namelen = smb_ascii_or_unicode_strlen(sr, fileinfo->fi_name);
725 753 if (namelen == -1)
726 754 return (-1);
727 755
728 - /*
729 - * If ascii the filename length returned to the client should
730 - * include the null terminator for levels except STANDARD and
731 - * EASIZE.
732 - */
733 - if (!(sr->smb_flg2 & SMB_FLAGS2_UNICODE)) {
734 - if ((args->fa_infolev != SMB_INFO_STANDARD) &&
735 - (args->fa_infolev != SMB_INFO_QUERY_EA_SIZE))
756 + if (args->fa_infolev < SMB_FIND_FILE_DIRECTORY_INFO) {
757 + /*
758 + * Ancient info levels don't have a NextEntryOffset
759 + * field, so there's no padding for alignment.
760 + * The client expects a null after the file name,
761 + * and then the next entry. The namelength field
762 + * never includes the null for these old levels.
763 + * Using the pad value to write the null because
764 + * we don't want to add that to namelen.
765 + * [MS-CIFS] sec. 2.8.1.{1-3}
766 + */
767 + if ((sr->smb_flg2 & SMB_FLAGS2_UNICODE) != 0)
768 + pad = 2; /* Unicode null */
769 + else
770 + pad = 1; /* ascii null */
771 + next_entry_offset = args->fa_fixedsize + namelen + pad;
772 + if (!MBC_ROOM_FOR(&xa->rep_data_mb, next_entry_offset))
773 + return (1);
774 + } else {
775 + /*
776 + * Later info levels: The file name is written WITH
777 + * null termination, and the size of that null _is_
778 + * included in the namelen field. There may also
779 + * be padding, and we pad to align(4) like Windows.
780 + * Don't include the padding in the "room for" test
781 + * because we want to ignore any error writing the
782 + * pad bytes after the last element.
783 + */
784 + if ((sr->smb_flg2 & SMB_FLAGS2_UNICODE) != 0)
785 + namelen += 2;
786 + else
736 787 namelen += 1;
788 + next_entry_offset = args->fa_fixedsize + namelen;
789 + if (!MBC_ROOM_FOR(&xa->rep_data_mb, next_entry_offset))
790 + return (1);
791 + if ((next_entry_offset & 3) != 0) {
792 + pad = 4 - (next_entry_offset & 3);
793 + next_entry_offset += pad;
794 + }
737 795 }
738 796
739 - next_entry_offset = args->fa_maxdata + namelen;
740 -
741 - if (MBC_ROOM_FOR(&xa->rep_data_mb, (args->fa_maxdata + namelen)) == 0)
742 - return (1);
743 -
744 797 mb_flags = (sr->smb_flg2 & SMB_FLAGS2_UNICODE) ? SMB_MSGBUF_UNICODE : 0;
745 798 dsize32 = (fileinfo->fi_size > UINT_MAX) ?
746 799 UINT_MAX : (uint32_t)fileinfo->fi_size;
747 800 asize32 = (fileinfo->fi_alloc_size > UINT_MAX) ?
748 801 UINT_MAX : (uint32_t)fileinfo->fi_alloc_size;
749 802
750 803 resume_key = fileinfo->fi_cookie;
751 804 if (smbd_use_resume_keys == 0)
752 805 resume_key = 0;
753 806
754 807 /*
755 808 * This switch handles all the "information levels" (formats)
756 809 * that we support. Note that all formats have the file name
757 810 * placed after some fixed-size data, and the code to write
758 811 * the file name is factored out at the end of this switch.
759 812 */
760 813 switch (args->fa_infolev) {
761 814 case SMB_INFO_STANDARD:
762 815 if (args->fa_fflag & SMB_FIND_RETURN_RESUME_KEYS)
763 816 (void) smb_mbc_encodef(&xa->rep_data_mb, "l",
764 817 resume_key);
765 818
766 819 (void) smb_mbc_encodef(&xa->rep_data_mb, "%yyyllwb", sr,
|
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
767 820 smb_time_gmt_to_local(sr, fileinfo->fi_crtime.tv_sec),
768 821 smb_time_gmt_to_local(sr, fileinfo->fi_atime.tv_sec),
769 822 smb_time_gmt_to_local(sr, fileinfo->fi_mtime.tv_sec),
770 823 dsize32,
771 824 asize32,
772 825 fileinfo->fi_dosattr,
773 826 namelen);
774 827 break;
775 828
776 829 case SMB_INFO_QUERY_EA_SIZE:
830 + case SMB_INFO_QUERY_EAS_FROM_LIST:
777 831 if (args->fa_fflag & SMB_FIND_RETURN_RESUME_KEYS)
778 832 (void) smb_mbc_encodef(&xa->rep_data_mb, "l",
779 833 resume_key);
780 834
781 835 (void) smb_mbc_encodef(&xa->rep_data_mb, "%yyyllwlb", sr,
782 836 smb_time_gmt_to_local(sr, fileinfo->fi_crtime.tv_sec),
783 837 smb_time_gmt_to_local(sr, fileinfo->fi_atime.tv_sec),
784 838 smb_time_gmt_to_local(sr, fileinfo->fi_mtime.tv_sec),
785 839 dsize32,
786 840 asize32,
787 841 fileinfo->fi_dosattr,
788 842 0L, /* EA Size */
789 843 namelen);
790 844 break;
791 845
792 846 case SMB_FIND_FILE_DIRECTORY_INFO:
793 847 (void) smb_mbc_encodef(&xa->rep_data_mb, "%llTTTTqqll", sr,
794 848 next_entry_offset,
795 849 resume_key,
796 850 &fileinfo->fi_crtime,
797 851 &fileinfo->fi_atime,
798 852 &fileinfo->fi_mtime,
799 853 &fileinfo->fi_ctime,
800 854 fileinfo->fi_size,
801 855 fileinfo->fi_alloc_size,
802 856 fileinfo->fi_dosattr,
803 857 namelen);
804 858 break;
805 859
806 860 case SMB_FIND_FILE_FULL_DIRECTORY_INFO:
807 861 (void) smb_mbc_encodef(&xa->rep_data_mb, "%llTTTTqqlll", sr,
808 862 next_entry_offset,
809 863 resume_key,
810 864 &fileinfo->fi_crtime,
811 865 &fileinfo->fi_atime,
812 866 &fileinfo->fi_mtime,
813 867 &fileinfo->fi_ctime,
814 868 fileinfo->fi_size,
815 869 fileinfo->fi_alloc_size,
816 870 fileinfo->fi_dosattr,
817 871 namelen,
818 872 0L);
819 873 break;
820 874
821 875 case SMB_FIND_FILE_ID_FULL_DIRECTORY_INFO:
822 876 (void) smb_mbc_encodef(&xa->rep_data_mb, "%llTTTTqqlll4.q", sr,
823 877 next_entry_offset,
824 878 resume_key,
825 879 &fileinfo->fi_crtime,
826 880 &fileinfo->fi_atime,
827 881 &fileinfo->fi_mtime,
828 882 &fileinfo->fi_ctime,
829 883 fileinfo->fi_size,
830 884 fileinfo->fi_alloc_size,
831 885 fileinfo->fi_dosattr,
832 886 namelen,
833 887 0L,
834 888 fileinfo->fi_nodeid);
835 889 break;
836 890
837 891 case SMB_FIND_FILE_BOTH_DIRECTORY_INFO:
838 892 bzero(buf83, sizeof (buf83));
839 893 smb_msgbuf_init(&mb, (uint8_t *)buf83, sizeof (buf83),
840 894 mb_flags);
841 895 if (smb_msgbuf_encode(&mb, "U", fileinfo->fi_shortname) < 0) {
842 896 smb_msgbuf_term(&mb);
843 897 return (-1);
844 898 }
845 899 shortlen = smb_wcequiv_strlen(fileinfo->fi_shortname);
846 900
847 901 (void) smb_mbc_encodef(&xa->rep_data_mb, "%llTTTTqqlllb.24c",
848 902 sr,
849 903 next_entry_offset,
850 904 resume_key,
851 905 &fileinfo->fi_crtime,
852 906 &fileinfo->fi_atime,
853 907 &fileinfo->fi_mtime,
854 908 &fileinfo->fi_ctime,
855 909 fileinfo->fi_size,
856 910 fileinfo->fi_alloc_size,
857 911 fileinfo->fi_dosattr,
858 912 namelen,
859 913 0L,
860 914 shortlen,
861 915 buf83);
862 916
863 917 smb_msgbuf_term(&mb);
864 918 break;
865 919
866 920 case SMB_FIND_FILE_ID_BOTH_DIRECTORY_INFO:
867 921 bzero(buf83, sizeof (buf83));
868 922 smb_msgbuf_init(&mb, (uint8_t *)buf83, sizeof (buf83),
869 923 mb_flags);
870 924 if (smb_msgbuf_encode(&mb, "u", fileinfo->fi_shortname) < 0) {
871 925 smb_msgbuf_term(&mb);
872 926 return (-1);
873 927 }
874 928 shortlen = smb_ascii_or_unicode_strlen(sr,
875 929 fileinfo->fi_shortname);
876 930
877 931 (void) smb_mbc_encodef(&xa->rep_data_mb,
878 932 "%llTTTTqqlllb.24c2.q",
879 933 sr,
880 934 next_entry_offset,
881 935 resume_key,
882 936 &fileinfo->fi_crtime,
883 937 &fileinfo->fi_atime,
884 938 &fileinfo->fi_mtime,
885 939 &fileinfo->fi_ctime,
886 940 fileinfo->fi_size,
887 941 fileinfo->fi_alloc_size,
888 942 fileinfo->fi_dosattr,
889 943 namelen,
890 944 0L,
891 945 shortlen,
892 946 buf83,
893 947 fileinfo->fi_nodeid);
894 948
895 949 smb_msgbuf_term(&mb);
896 950 break;
897 951
898 952 case SMB_FIND_FILE_NAMES_INFO:
899 953 (void) smb_mbc_encodef(&xa->rep_data_mb, "%lll", sr,
900 954 next_entry_offset,
901 955 resume_key,
902 956 namelen);
903 957 break;
904 958
905 959 default:
906 960 /* invalid info. level */
907 961 return (-1);
908 962 }
909 963
910 964 /*
911 965 * At this point we have written all the fixed-size data
912 966 * for the specified info. level, and we're about to put
913 967 * the file name string in the message. We may later
|
↓ open down ↓ |
127 lines elided |
↑ open up ↑ |
914 968 * need the offset in the trans2 data where this string
915 969 * is placed, so save the message position now. Note:
916 970 * We also need to account for the alignment padding
917 971 * that may precede the unicode string.
918 972 */
919 973 args->fa_lno = xa->rep_data_mb.chain_offset;
920 974 if ((sr->smb_flg2 & SMB_FLAGS2_UNICODE) != 0 &&
921 975 (args->fa_lno & 1) != 0)
922 976 args->fa_lno++;
923 977
924 - (void) smb_mbc_encodef(&xa->rep_data_mb, "%u", sr,
925 - fileinfo->fi_name);
978 + (void) smb_mbc_encodef(&xa->rep_data_mb, "%#u", sr,
979 + namelen, fileinfo->fi_name);
926 980
981 + if (pad)
982 + (void) smb_mbc_encodef(&xa->rep_data_mb, "#.", pad);
983 +
927 984 return (0);
928 985 }
929 986
930 987 /*
931 988 * Close a search started by a Trans2FindFirst2 request.
932 989 */
933 990 smb_sdrc_t
934 991 smb_pre_find_close2(smb_request_t *sr)
935 992 {
936 - DTRACE_SMB_1(op__FindClose2__start, smb_request_t *, sr);
993 + DTRACE_SMB_START(op__FindClose2, smb_request_t *, sr);
937 994 return (SDRC_SUCCESS);
938 995 }
939 996
940 997 void
941 998 smb_post_find_close2(smb_request_t *sr)
942 999 {
943 - DTRACE_SMB_1(op__FindClose2__done, smb_request_t *, sr);
1000 + DTRACE_SMB_DONE(op__FindClose2, smb_request_t *, sr);
944 1001 }
945 1002
946 1003 smb_sdrc_t
947 1004 smb_com_find_close2(smb_request_t *sr)
948 1005 {
949 1006 uint16_t odid;
950 1007 smb_odir_t *od;
951 1008
952 1009 if (smbsr_decode_vwv(sr, "w", &odid) != 0)
953 1010 return (SDRC_ERROR);
954 1011
955 1012 od = smb_tree_lookup_odir(sr, odid);
956 1013 if (od == NULL) {
957 1014 smbsr_error(sr, NT_STATUS_INVALID_HANDLE,
958 1015 ERRDOS, ERROR_INVALID_HANDLE);
959 1016 return (SDRC_ERROR);
960 1017 }
961 1018
962 1019 smb_odir_close(od);
963 1020 smb_odir_release(od);
964 1021
965 1022 if (smbsr_encode_empty_result(sr))
966 1023 return (SDRC_ERROR);
967 1024
968 1025 return (SDRC_SUCCESS);
969 1026 }
|
↓ open down ↓ |
16 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX