2 Unix SMB/CIFS implementation.
4 test suite for SMB2 compounded requests
6 Copyright (C) Stefan Metzmacher 2009
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include "libcli/smb2/smb2.h"
24 #include "libcli/smb2/smb2_calls.h"
25 #include "torture/torture.h"
26 #include "torture/smb2/proto.h"
27 #include "../libcli/smb/smbXcli_base.h"
29 #define CHECK_STATUS(status, correct) do { \
30 if (!NT_STATUS_EQUAL(status, correct)) { \
31 torture_result(tctx, TORTURE_FAIL, __location__": Incorrect status %s - should be %s", \
32 nt_errstr(status), nt_errstr(correct)); \
37 #define TARGET_IS_W2K8(_tctx) (torture_setting_bool(_tctx, "w2k8", false))
38 #define TARGET_IS_WIN7(_tctx) (torture_setting_bool(_tctx, "win7", false))
40 static bool test_compound_related1(struct torture_context
*tctx
,
41 struct smb2_tree
*tree
)
43 struct smb2_handle hd
;
44 struct smb2_create cr
;
46 const char *fname
= "compound_related1.dat";
49 struct smb2_request
*req
[2];
50 struct smbXcli_tcon
*saved_tcon
= tree
->smbXcli
;
51 struct smbXcli_session
*saved_session
= tree
->session
->smbXcli
;
53 smb2_transport_credits_ask_num(tree
->session
->transport
, 2);
55 smb2_util_unlink(tree
, fname
);
57 smb2_transport_credits_ask_num(tree
->session
->transport
, 1);
60 cr
.in
.security_flags
= 0x00;
61 cr
.in
.oplock_level
= 0;
62 cr
.in
.impersonation_level
= NTCREATEX_IMPERSONATION_IMPERSONATION
;
63 cr
.in
.create_flags
= 0x00000000;
64 cr
.in
.reserved
= 0x00000000;
65 cr
.in
.desired_access
= SEC_RIGHTS_FILE_ALL
;
66 cr
.in
.file_attributes
= FILE_ATTRIBUTE_NORMAL
;
67 cr
.in
.share_access
= NTCREATEX_SHARE_ACCESS_READ
|
68 NTCREATEX_SHARE_ACCESS_WRITE
|
69 NTCREATEX_SHARE_ACCESS_DELETE
;
70 cr
.in
.create_disposition
= NTCREATEX_DISP_OPEN_IF
;
71 cr
.in
.create_options
= NTCREATEX_OPTIONS_SEQUENTIAL_ONLY
|
72 NTCREATEX_OPTIONS_ASYNC_ALERT
|
73 NTCREATEX_OPTIONS_NON_DIRECTORY_FILE
|
77 smb2_transport_compound_start(tree
->session
->transport
, 2);
79 req
[0] = smb2_create_send(tree
, &cr
);
81 smb2_transport_compound_set_related(tree
->session
->transport
, true);
83 hd
.data
[0] = UINT64_MAX
;
84 hd
.data
[1] = UINT64_MAX
;
87 cl
.in
.file
.handle
= hd
;
89 tree
->smbXcli
= smbXcli_tcon_create(tree
);
90 smb2cli_tcon_set_values(tree
->smbXcli
,
92 0xFFFFFFFF, /* tcon_id */
96 0 /* maximal_access */);
98 tree
->session
->smbXcli
= smbXcli_session_create(tree
->session
,
99 tree
->session
->transport
->conn
);
100 smb2cli_session_set_id_and_flags(tree
->session
->smbXcli
, UINT64_MAX
, 0);
102 req
[1] = smb2_close_send(tree
, &cl
);
104 status
= smb2_create_recv(req
[0], tree
, &cr
);
105 CHECK_STATUS(status
, NT_STATUS_OK
);
106 status
= smb2_close_recv(req
[1], &cl
);
107 CHECK_STATUS(status
, NT_STATUS_OK
);
109 TALLOC_FREE(tree
->smbXcli
);
110 tree
->smbXcli
= saved_tcon
;
111 TALLOC_FREE(tree
->session
->smbXcli
);
112 tree
->session
->smbXcli
= saved_session
;
114 smb2_util_unlink(tree
, fname
);
119 static bool test_compound_related2(struct torture_context
*tctx
,
120 struct smb2_tree
*tree
)
122 struct smb2_handle hd
;
123 struct smb2_create cr
;
125 const char *fname
= "compound_related2.dat";
126 struct smb2_close cl
;
128 struct smb2_request
*req
[5];
129 struct smbXcli_tcon
*saved_tcon
= tree
->smbXcli
;
130 struct smbXcli_session
*saved_session
= tree
->session
->smbXcli
;
132 smb2_transport_credits_ask_num(tree
->session
->transport
, 5);
134 smb2_util_unlink(tree
, fname
);
136 smb2_transport_credits_ask_num(tree
->session
->transport
, 1);
139 cr
.in
.security_flags
= 0x00;
140 cr
.in
.oplock_level
= 0;
141 cr
.in
.impersonation_level
= NTCREATEX_IMPERSONATION_IMPERSONATION
;
142 cr
.in
.create_flags
= 0x00000000;
143 cr
.in
.reserved
= 0x00000000;
144 cr
.in
.desired_access
= SEC_RIGHTS_FILE_ALL
;
145 cr
.in
.file_attributes
= FILE_ATTRIBUTE_NORMAL
;
146 cr
.in
.share_access
= NTCREATEX_SHARE_ACCESS_READ
|
147 NTCREATEX_SHARE_ACCESS_WRITE
|
148 NTCREATEX_SHARE_ACCESS_DELETE
;
149 cr
.in
.create_disposition
= NTCREATEX_DISP_OPEN_IF
;
150 cr
.in
.create_options
= NTCREATEX_OPTIONS_SEQUENTIAL_ONLY
|
151 NTCREATEX_OPTIONS_ASYNC_ALERT
|
152 NTCREATEX_OPTIONS_NON_DIRECTORY_FILE
|
156 smb2_transport_compound_start(tree
->session
->transport
, 5);
158 req
[0] = smb2_create_send(tree
, &cr
);
160 hd
.data
[0] = UINT64_MAX
;
161 hd
.data
[1] = UINT64_MAX
;
163 smb2_transport_compound_set_related(tree
->session
->transport
, true);
166 cl
.in
.file
.handle
= hd
;
168 tree
->smbXcli
= smbXcli_tcon_create(tree
);
169 smb2cli_tcon_set_values(tree
->smbXcli
,
171 0xFFFFFFFF, /* tcon_id */
174 0, /* capabilities */
175 0 /* maximal_access */);
177 tree
->session
->smbXcli
= smbXcli_session_create(tree
->session
,
178 tree
->session
->transport
->conn
);
179 smb2cli_session_set_id_and_flags(tree
->session
->smbXcli
, UINT64_MAX
, 0);
181 req
[1] = smb2_close_send(tree
, &cl
);
182 req
[2] = smb2_close_send(tree
, &cl
);
183 req
[3] = smb2_close_send(tree
, &cl
);
184 req
[4] = smb2_close_send(tree
, &cl
);
186 status
= smb2_create_recv(req
[0], tree
, &cr
);
187 CHECK_STATUS(status
, NT_STATUS_OK
);
188 status
= smb2_close_recv(req
[1], &cl
);
189 CHECK_STATUS(status
, NT_STATUS_OK
);
190 status
= smb2_close_recv(req
[2], &cl
);
191 CHECK_STATUS(status
, NT_STATUS_FILE_CLOSED
);
192 status
= smb2_close_recv(req
[3], &cl
);
193 CHECK_STATUS(status
, NT_STATUS_INVALID_PARAMETER
);
194 status
= smb2_close_recv(req
[4], &cl
);
195 CHECK_STATUS(status
, NT_STATUS_INVALID_PARAMETER
);
197 TALLOC_FREE(tree
->smbXcli
);
198 tree
->smbXcli
= saved_tcon
;
199 TALLOC_FREE(tree
->session
->smbXcli
);
200 tree
->session
->smbXcli
= saved_session
;
202 smb2_util_unlink(tree
, fname
);
207 static bool test_compound_unrelated1(struct torture_context
*tctx
,
208 struct smb2_tree
*tree
)
210 struct smb2_handle hd
;
211 struct smb2_create cr
;
213 const char *fname
= "compound_unrelated1.dat";
214 struct smb2_close cl
;
216 struct smb2_request
*req
[5];
218 smb2_transport_credits_ask_num(tree
->session
->transport
, 5);
220 smb2_util_unlink(tree
, fname
);
222 smb2_transport_credits_ask_num(tree
->session
->transport
, 1);
225 cr
.in
.security_flags
= 0x00;
226 cr
.in
.oplock_level
= 0;
227 cr
.in
.impersonation_level
= NTCREATEX_IMPERSONATION_IMPERSONATION
;
228 cr
.in
.create_flags
= 0x00000000;
229 cr
.in
.reserved
= 0x00000000;
230 cr
.in
.desired_access
= SEC_RIGHTS_FILE_ALL
;
231 cr
.in
.file_attributes
= FILE_ATTRIBUTE_NORMAL
;
232 cr
.in
.share_access
= NTCREATEX_SHARE_ACCESS_READ
|
233 NTCREATEX_SHARE_ACCESS_WRITE
|
234 NTCREATEX_SHARE_ACCESS_DELETE
;
235 cr
.in
.create_disposition
= NTCREATEX_DISP_OPEN_IF
;
236 cr
.in
.create_options
= NTCREATEX_OPTIONS_SEQUENTIAL_ONLY
|
237 NTCREATEX_OPTIONS_ASYNC_ALERT
|
238 NTCREATEX_OPTIONS_NON_DIRECTORY_FILE
|
242 smb2_transport_compound_start(tree
->session
->transport
, 5);
244 req
[0] = smb2_create_send(tree
, &cr
);
246 hd
.data
[0] = UINT64_MAX
;
247 hd
.data
[1] = UINT64_MAX
;
250 cl
.in
.file
.handle
= hd
;
251 req
[1] = smb2_close_send(tree
, &cl
);
252 req
[2] = smb2_close_send(tree
, &cl
);
253 req
[3] = smb2_close_send(tree
, &cl
);
254 req
[4] = smb2_close_send(tree
, &cl
);
256 status
= smb2_create_recv(req
[0], tree
, &cr
);
257 CHECK_STATUS(status
, NT_STATUS_OK
);
258 status
= smb2_close_recv(req
[1], &cl
);
259 CHECK_STATUS(status
, NT_STATUS_FILE_CLOSED
);
260 status
= smb2_close_recv(req
[2], &cl
);
261 CHECK_STATUS(status
, NT_STATUS_FILE_CLOSED
);
262 status
= smb2_close_recv(req
[3], &cl
);
263 CHECK_STATUS(status
, NT_STATUS_FILE_CLOSED
);
264 status
= smb2_close_recv(req
[4], &cl
);
265 CHECK_STATUS(status
, NT_STATUS_FILE_CLOSED
);
267 smb2_util_unlink(tree
, fname
);
272 static bool test_compound_invalid1(struct torture_context
*tctx
,
273 struct smb2_tree
*tree
)
275 struct smb2_handle hd
;
276 struct smb2_create cr
;
278 const char *fname
= "compound_invalid1.dat";
279 struct smb2_close cl
;
281 struct smb2_request
*req
[2];
283 smb2_transport_credits_ask_num(tree
->session
->transport
, 2);
285 smb2_util_unlink(tree
, fname
);
287 smb2_transport_credits_ask_num(tree
->session
->transport
, 1);
290 cr
.in
.security_flags
= 0x00;
291 cr
.in
.oplock_level
= 0;
292 cr
.in
.impersonation_level
= NTCREATEX_IMPERSONATION_IMPERSONATION
;
293 cr
.in
.create_flags
= 0x00000000;
294 cr
.in
.reserved
= 0x00000000;
295 cr
.in
.desired_access
= SEC_RIGHTS_FILE_ALL
;
296 cr
.in
.file_attributes
= FILE_ATTRIBUTE_NORMAL
;
297 cr
.in
.share_access
= NTCREATEX_SHARE_ACCESS_READ
|
298 NTCREATEX_SHARE_ACCESS_WRITE
|
299 NTCREATEX_SHARE_ACCESS_DELETE
;
300 cr
.in
.create_disposition
= NTCREATEX_DISP_OPEN_IF
;
301 cr
.in
.create_options
= NTCREATEX_OPTIONS_SEQUENTIAL_ONLY
|
302 NTCREATEX_OPTIONS_ASYNC_ALERT
|
303 NTCREATEX_OPTIONS_NON_DIRECTORY_FILE
|
307 smb2_transport_compound_start(tree
->session
->transport
, 2);
309 /* passing the first request with the related flag is invalid */
310 smb2_transport_compound_set_related(tree
->session
->transport
, true);
312 req
[0] = smb2_create_send(tree
, &cr
);
314 hd
.data
[0] = UINT64_MAX
;
315 hd
.data
[1] = UINT64_MAX
;
318 cl
.in
.file
.handle
= hd
;
319 req
[1] = smb2_close_send(tree
, &cl
);
321 status
= smb2_create_recv(req
[0], tree
, &cr
);
322 /* TODO: check why this fails with --signing=required */
323 CHECK_STATUS(status
, NT_STATUS_INVALID_PARAMETER
);
324 status
= smb2_close_recv(req
[1], &cl
);
325 CHECK_STATUS(status
, NT_STATUS_INVALID_PARAMETER
);
327 smb2_util_unlink(tree
, fname
);
332 static bool test_compound_invalid2(struct torture_context
*tctx
,
333 struct smb2_tree
*tree
)
335 struct smb2_handle hd
;
336 struct smb2_create cr
;
338 const char *fname
= "compound_invalid2.dat";
339 struct smb2_close cl
;
341 struct smb2_request
*req
[5];
342 struct smbXcli_tcon
*saved_tcon
= tree
->smbXcli
;
343 struct smbXcli_session
*saved_session
= tree
->session
->smbXcli
;
345 smb2_transport_credits_ask_num(tree
->session
->transport
, 5);
347 smb2_util_unlink(tree
, fname
);
349 smb2_transport_credits_ask_num(tree
->session
->transport
, 1);
352 cr
.in
.security_flags
= 0x00;
353 cr
.in
.oplock_level
= 0;
354 cr
.in
.impersonation_level
= NTCREATEX_IMPERSONATION_IMPERSONATION
;
355 cr
.in
.create_flags
= 0x00000000;
356 cr
.in
.reserved
= 0x00000000;
357 cr
.in
.desired_access
= SEC_RIGHTS_FILE_ALL
;
358 cr
.in
.file_attributes
= FILE_ATTRIBUTE_NORMAL
;
359 cr
.in
.share_access
= NTCREATEX_SHARE_ACCESS_READ
|
360 NTCREATEX_SHARE_ACCESS_WRITE
|
361 NTCREATEX_SHARE_ACCESS_DELETE
;
362 cr
.in
.create_disposition
= NTCREATEX_DISP_OPEN_IF
;
363 cr
.in
.create_options
= NTCREATEX_OPTIONS_SEQUENTIAL_ONLY
|
364 NTCREATEX_OPTIONS_ASYNC_ALERT
|
365 NTCREATEX_OPTIONS_NON_DIRECTORY_FILE
|
369 smb2_transport_compound_start(tree
->session
->transport
, 5);
371 req
[0] = smb2_create_send(tree
, &cr
);
373 hd
.data
[0] = UINT64_MAX
;
374 hd
.data
[1] = UINT64_MAX
;
376 smb2_transport_compound_set_related(tree
->session
->transport
, true);
379 cl
.in
.file
.handle
= hd
;
381 tree
->smbXcli
= smbXcli_tcon_create(tree
);
382 smb2cli_tcon_set_values(tree
->smbXcli
,
384 0xFFFFFFFF, /* tcon_id */
387 0, /* capabilities */
388 0 /* maximal_access */);
390 tree
->session
->smbXcli
= smbXcli_session_create(tree
->session
,
391 tree
->session
->transport
->conn
);
392 smb2cli_session_set_id_and_flags(tree
->session
->smbXcli
, UINT64_MAX
, 0);
394 req
[1] = smb2_close_send(tree
, &cl
);
395 /* strange that this is not generating invalid parameter */
396 smb2_transport_compound_set_related(tree
->session
->transport
, false);
397 req
[2] = smb2_close_send(tree
, &cl
);
398 req
[3] = smb2_close_send(tree
, &cl
);
399 smb2_transport_compound_set_related(tree
->session
->transport
, true);
400 req
[4] = smb2_close_send(tree
, &cl
);
402 status
= smb2_create_recv(req
[0], tree
, &cr
);
403 CHECK_STATUS(status
, NT_STATUS_OK
);
404 status
= smb2_close_recv(req
[1], &cl
);
405 CHECK_STATUS(status
, NT_STATUS_OK
);
406 status
= smb2_close_recv(req
[2], &cl
);
407 CHECK_STATUS(status
, NT_STATUS_USER_SESSION_DELETED
);
408 status
= smb2_close_recv(req
[3], &cl
);
409 CHECK_STATUS(status
, NT_STATUS_USER_SESSION_DELETED
);
410 status
= smb2_close_recv(req
[4], &cl
);
411 CHECK_STATUS(status
, NT_STATUS_INVALID_PARAMETER
);
413 TALLOC_FREE(tree
->smbXcli
);
414 tree
->smbXcli
= saved_tcon
;
415 TALLOC_FREE(tree
->session
->smbXcli
);
416 tree
->session
->smbXcli
= saved_session
;
418 smb2_util_unlink(tree
, fname
);
423 static bool test_compound_invalid3(struct torture_context
*tctx
,
424 struct smb2_tree
*tree
)
426 struct smb2_handle hd
;
427 struct smb2_create cr
;
429 const char *fname
= "compound_invalid3.dat";
430 struct smb2_close cl
;
432 struct smb2_request
*req
[5];
434 smb2_transport_credits_ask_num(tree
->session
->transport
, 5);
436 smb2_util_unlink(tree
, fname
);
438 smb2_transport_credits_ask_num(tree
->session
->transport
, 1);
441 cr
.in
.security_flags
= 0x00;
442 cr
.in
.oplock_level
= 0;
443 cr
.in
.impersonation_level
= NTCREATEX_IMPERSONATION_IMPERSONATION
;
444 cr
.in
.create_flags
= 0x00000000;
445 cr
.in
.reserved
= 0x00000000;
446 cr
.in
.desired_access
= SEC_RIGHTS_FILE_ALL
;
447 cr
.in
.file_attributes
= FILE_ATTRIBUTE_NORMAL
;
448 cr
.in
.share_access
= NTCREATEX_SHARE_ACCESS_READ
|
449 NTCREATEX_SHARE_ACCESS_WRITE
|
450 NTCREATEX_SHARE_ACCESS_DELETE
;
451 cr
.in
.create_disposition
= NTCREATEX_DISP_OPEN_IF
;
452 cr
.in
.create_options
= NTCREATEX_OPTIONS_SEQUENTIAL_ONLY
|
453 NTCREATEX_OPTIONS_ASYNC_ALERT
|
454 NTCREATEX_OPTIONS_NON_DIRECTORY_FILE
|
458 smb2_transport_compound_start(tree
->session
->transport
, 5);
460 req
[0] = smb2_create_send(tree
, &cr
);
462 hd
.data
[0] = UINT64_MAX
;
463 hd
.data
[1] = UINT64_MAX
;
466 cl
.in
.file
.handle
= hd
;
467 req
[1] = smb2_close_send(tree
, &cl
);
468 req
[2] = smb2_close_send(tree
, &cl
);
469 /* flipping the related flag is invalid */
470 smb2_transport_compound_set_related(tree
->session
->transport
, true);
471 req
[3] = smb2_close_send(tree
, &cl
);
472 req
[4] = smb2_close_send(tree
, &cl
);
474 status
= smb2_create_recv(req
[0], tree
, &cr
);
475 CHECK_STATUS(status
, NT_STATUS_OK
);
476 status
= smb2_close_recv(req
[1], &cl
);
477 CHECK_STATUS(status
, NT_STATUS_FILE_CLOSED
);
478 status
= smb2_close_recv(req
[2], &cl
);
479 CHECK_STATUS(status
, NT_STATUS_FILE_CLOSED
);
480 status
= smb2_close_recv(req
[3], &cl
);
481 CHECK_STATUS(status
, NT_STATUS_INVALID_PARAMETER
);
482 status
= smb2_close_recv(req
[4], &cl
);
483 CHECK_STATUS(status
, NT_STATUS_INVALID_PARAMETER
);
485 smb2_util_unlink(tree
, fname
);
490 /* Send a compound request where we expect the last request (Create, Notify)
491 * to go asynchronous. This works against a Win7 server and the reply is
492 * sent in two different packets. */
493 static bool test_compound_interim1(struct torture_context
*tctx
,
494 struct smb2_tree
*tree
)
496 struct smb2_handle hd
;
497 struct smb2_create cr
;
498 NTSTATUS status
= NT_STATUS_OK
;
499 const char *dname
= "compound_interim_dir";
500 struct smb2_notify nt
;
502 struct smb2_request
*req
[2];
504 /* Win7 compound request implementation deviates substantially from the
505 * SMB2 spec as noted in MS-SMB2 <159>, <162>. This, test currently
506 * verifies the Windows behavior, not the general spec behavior. */
507 if (!TARGET_IS_WIN7(tctx
) && !TARGET_IS_W2K8(tctx
)) {
508 torture_skip(tctx
, "Interim test is specific to Windows server "
512 smb2_transport_credits_ask_num(tree
->session
->transport
, 5);
514 smb2_deltree(tree
, dname
);
516 smb2_transport_credits_ask_num(tree
->session
->transport
, 1);
519 cr
.in
.desired_access
= SEC_RIGHTS_FILE_ALL
;
520 cr
.in
.create_options
= NTCREATEX_OPTIONS_DIRECTORY
;
521 cr
.in
.file_attributes
= FILE_ATTRIBUTE_DIRECTORY
;
522 cr
.in
.share_access
= NTCREATEX_SHARE_ACCESS_READ
|
523 NTCREATEX_SHARE_ACCESS_WRITE
|
524 NTCREATEX_SHARE_ACCESS_DELETE
;
525 cr
.in
.create_disposition
= NTCREATEX_DISP_CREATE
;
528 smb2_transport_compound_start(tree
->session
->transport
, 2);
530 req
[0] = smb2_create_send(tree
, &cr
);
532 smb2_transport_compound_set_related(tree
->session
->transport
, true);
534 hd
.data
[0] = UINT64_MAX
;
535 hd
.data
[1] = UINT64_MAX
;
538 nt
.in
.recursive
= true;
539 nt
.in
.buffer_size
= 0x1000;
540 nt
.in
.file
.handle
= hd
;
541 nt
.in
.completion_filter
= FILE_NOTIFY_CHANGE_NAME
;
542 nt
.in
.unknown
= 0x00000000;
544 req
[1] = smb2_notify_send(tree
, &nt
);
546 status
= smb2_create_recv(req
[0], tree
, &cr
);
547 CHECK_STATUS(status
, NT_STATUS_OK
);
550 status
= smb2_notify_recv(req
[1], tree
, &nt
);
551 CHECK_STATUS(status
, NT_STATUS_CANCELLED
);
553 smb2_util_close(tree
, cr
.out
.file
.handle
);
555 smb2_deltree(tree
, dname
);
560 /* Send a compound request where we expect the middle request (Create, Notify,
561 * GetInfo) to go asynchronous. Against Win7 the sync request succeed while
562 * the async fails. All are returned in the same compound response. */
563 static bool test_compound_interim2(struct torture_context
*tctx
,
564 struct smb2_tree
*tree
)
566 struct smb2_handle hd
;
567 struct smb2_create cr
;
568 NTSTATUS status
= NT_STATUS_OK
;
569 const char *dname
= "compound_interim_dir";
570 struct smb2_getinfo gf
;
571 struct smb2_notify nt
;
573 struct smb2_request
*req
[3];
575 /* Win7 compound request implementation deviates substantially from the
576 * SMB2 spec as noted in MS-SMB2 <159>, <162>. This, test currently
577 * verifies the Windows behavior, not the general spec behavior. */
578 if (!TARGET_IS_WIN7(tctx
) && !TARGET_IS_W2K8(tctx
)) {
579 torture_skip(tctx
, "Interim test is specific to Windows server "
583 smb2_transport_credits_ask_num(tree
->session
->transport
, 5);
585 smb2_deltree(tree
, dname
);
587 smb2_transport_credits_ask_num(tree
->session
->transport
, 1);
590 cr
.in
.desired_access
= SEC_RIGHTS_FILE_ALL
;
591 cr
.in
.create_options
= NTCREATEX_OPTIONS_DIRECTORY
;
592 cr
.in
.file_attributes
= FILE_ATTRIBUTE_DIRECTORY
;
593 cr
.in
.share_access
= NTCREATEX_SHARE_ACCESS_READ
|
594 NTCREATEX_SHARE_ACCESS_WRITE
|
595 NTCREATEX_SHARE_ACCESS_DELETE
;
596 cr
.in
.create_disposition
= NTCREATEX_DISP_CREATE
;
599 smb2_transport_compound_start(tree
->session
->transport
, 3);
601 req
[0] = smb2_create_send(tree
, &cr
);
603 smb2_transport_compound_set_related(tree
->session
->transport
, true);
605 hd
.data
[0] = UINT64_MAX
;
606 hd
.data
[1] = UINT64_MAX
;
609 nt
.in
.recursive
= true;
610 nt
.in
.buffer_size
= 0x1000;
611 nt
.in
.file
.handle
= hd
;
612 nt
.in
.completion_filter
= FILE_NOTIFY_CHANGE_NAME
;
613 nt
.in
.unknown
= 0x00000000;
615 req
[1] = smb2_notify_send(tree
, &nt
);
618 gf
.in
.file
.handle
= hd
;
619 gf
.in
.info_type
= SMB2_GETINFO_FILE
;
620 gf
.in
.info_class
= 0x04; /* FILE_BASIC_INFORMATION */
621 gf
.in
.output_buffer_length
= 0x1000;
622 gf
.in
.input_buffer_length
= 0;
624 req
[2] = smb2_getinfo_send(tree
, &gf
);
626 status
= smb2_create_recv(req
[0], tree
, &cr
);
627 CHECK_STATUS(status
, NT_STATUS_OK
);
629 status
= smb2_notify_recv(req
[1], tree
, &nt
);
630 CHECK_STATUS(status
, NT_STATUS_INTERNAL_ERROR
);
632 status
= smb2_getinfo_recv(req
[2], tree
, &gf
);
633 CHECK_STATUS(status
, NT_STATUS_OK
);
635 smb2_util_close(tree
, cr
.out
.file
.handle
);
637 smb2_deltree(tree
, dname
);
642 struct torture_suite
*torture_smb2_compound_init(void)
644 struct torture_suite
*suite
= torture_suite_create(talloc_autofree_context(), "compound");
646 torture_suite_add_1smb2_test(suite
, "related1", test_compound_related1
);
647 torture_suite_add_1smb2_test(suite
, "related2", test_compound_related2
);
648 torture_suite_add_1smb2_test(suite
, "unrelated1", test_compound_unrelated1
);
649 torture_suite_add_1smb2_test(suite
, "invalid1", test_compound_invalid1
);
650 torture_suite_add_1smb2_test(suite
, "invalid2", test_compound_invalid2
);
651 torture_suite_add_1smb2_test(suite
, "invalid3", test_compound_invalid3
);
652 torture_suite_add_1smb2_test(suite
, "interim1", test_compound_interim1
);
653 torture_suite_add_1smb2_test(suite
, "interim2", test_compound_interim2
);
655 suite
->description
= talloc_strdup(suite
, "SMB2-COMPOUND tests");