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
,
91 0xFFFFFFFF, /* tcon_id */
95 0 /* maximal_access */);
97 tree
->session
->smbXcli
= smbXcli_session_create(tree
->session
,
98 tree
->session
->transport
->conn
);
99 smb2cli_session_set_id_and_flags(tree
->session
->smbXcli
, UINT64_MAX
, 0);
101 req
[1] = smb2_close_send(tree
, &cl
);
103 status
= smb2_create_recv(req
[0], tree
, &cr
);
104 CHECK_STATUS(status
, NT_STATUS_OK
);
105 status
= smb2_close_recv(req
[1], &cl
);
106 CHECK_STATUS(status
, NT_STATUS_OK
);
108 TALLOC_FREE(tree
->smbXcli
);
109 tree
->smbXcli
= saved_tcon
;
110 TALLOC_FREE(tree
->session
->smbXcli
);
111 tree
->session
->smbXcli
= saved_session
;
113 smb2_util_unlink(tree
, fname
);
118 static bool test_compound_related2(struct torture_context
*tctx
,
119 struct smb2_tree
*tree
)
121 struct smb2_handle hd
;
122 struct smb2_create cr
;
124 const char *fname
= "compound_related2.dat";
125 struct smb2_close cl
;
127 struct smb2_request
*req
[5];
128 struct smbXcli_tcon
*saved_tcon
= tree
->smbXcli
;
129 struct smbXcli_session
*saved_session
= tree
->session
->smbXcli
;
131 smb2_transport_credits_ask_num(tree
->session
->transport
, 5);
133 smb2_util_unlink(tree
, fname
);
135 smb2_transport_credits_ask_num(tree
->session
->transport
, 1);
138 cr
.in
.security_flags
= 0x00;
139 cr
.in
.oplock_level
= 0;
140 cr
.in
.impersonation_level
= NTCREATEX_IMPERSONATION_IMPERSONATION
;
141 cr
.in
.create_flags
= 0x00000000;
142 cr
.in
.reserved
= 0x00000000;
143 cr
.in
.desired_access
= SEC_RIGHTS_FILE_ALL
;
144 cr
.in
.file_attributes
= FILE_ATTRIBUTE_NORMAL
;
145 cr
.in
.share_access
= NTCREATEX_SHARE_ACCESS_READ
|
146 NTCREATEX_SHARE_ACCESS_WRITE
|
147 NTCREATEX_SHARE_ACCESS_DELETE
;
148 cr
.in
.create_disposition
= NTCREATEX_DISP_OPEN_IF
;
149 cr
.in
.create_options
= NTCREATEX_OPTIONS_SEQUENTIAL_ONLY
|
150 NTCREATEX_OPTIONS_ASYNC_ALERT
|
151 NTCREATEX_OPTIONS_NON_DIRECTORY_FILE
|
155 smb2_transport_compound_start(tree
->session
->transport
, 5);
157 req
[0] = smb2_create_send(tree
, &cr
);
159 hd
.data
[0] = UINT64_MAX
;
160 hd
.data
[1] = UINT64_MAX
;
162 smb2_transport_compound_set_related(tree
->session
->transport
, true);
165 cl
.in
.file
.handle
= hd
;
167 tree
->smbXcli
= smbXcli_tcon_create(tree
);
168 smb2cli_tcon_set_values(tree
->smbXcli
,
169 0xFFFFFFFF, /* tcon_id */
172 0, /* capabilities */
173 0 /* maximal_access */);
175 tree
->session
->smbXcli
= smbXcli_session_create(tree
->session
,
176 tree
->session
->transport
->conn
);
177 smb2cli_session_set_id_and_flags(tree
->session
->smbXcli
, UINT64_MAX
, 0);
179 req
[1] = smb2_close_send(tree
, &cl
);
180 req
[2] = smb2_close_send(tree
, &cl
);
181 req
[3] = smb2_close_send(tree
, &cl
);
182 req
[4] = smb2_close_send(tree
, &cl
);
184 status
= smb2_create_recv(req
[0], tree
, &cr
);
185 CHECK_STATUS(status
, NT_STATUS_OK
);
186 status
= smb2_close_recv(req
[1], &cl
);
187 CHECK_STATUS(status
, NT_STATUS_OK
);
188 status
= smb2_close_recv(req
[2], &cl
);
189 CHECK_STATUS(status
, NT_STATUS_FILE_CLOSED
);
190 status
= smb2_close_recv(req
[3], &cl
);
191 CHECK_STATUS(status
, NT_STATUS_INVALID_PARAMETER
);
192 status
= smb2_close_recv(req
[4], &cl
);
193 CHECK_STATUS(status
, NT_STATUS_INVALID_PARAMETER
);
195 TALLOC_FREE(tree
->smbXcli
);
196 tree
->smbXcli
= saved_tcon
;
197 TALLOC_FREE(tree
->session
->smbXcli
);
198 tree
->session
->smbXcli
= saved_session
;
200 smb2_util_unlink(tree
, fname
);
205 static bool test_compound_unrelated1(struct torture_context
*tctx
,
206 struct smb2_tree
*tree
)
208 struct smb2_handle hd
;
209 struct smb2_create cr
;
211 const char *fname
= "compound_unrelated1.dat";
212 struct smb2_close cl
;
214 struct smb2_request
*req
[5];
216 smb2_transport_credits_ask_num(tree
->session
->transport
, 5);
218 smb2_util_unlink(tree
, fname
);
220 smb2_transport_credits_ask_num(tree
->session
->transport
, 1);
223 cr
.in
.security_flags
= 0x00;
224 cr
.in
.oplock_level
= 0;
225 cr
.in
.impersonation_level
= NTCREATEX_IMPERSONATION_IMPERSONATION
;
226 cr
.in
.create_flags
= 0x00000000;
227 cr
.in
.reserved
= 0x00000000;
228 cr
.in
.desired_access
= SEC_RIGHTS_FILE_ALL
;
229 cr
.in
.file_attributes
= FILE_ATTRIBUTE_NORMAL
;
230 cr
.in
.share_access
= NTCREATEX_SHARE_ACCESS_READ
|
231 NTCREATEX_SHARE_ACCESS_WRITE
|
232 NTCREATEX_SHARE_ACCESS_DELETE
;
233 cr
.in
.create_disposition
= NTCREATEX_DISP_OPEN_IF
;
234 cr
.in
.create_options
= NTCREATEX_OPTIONS_SEQUENTIAL_ONLY
|
235 NTCREATEX_OPTIONS_ASYNC_ALERT
|
236 NTCREATEX_OPTIONS_NON_DIRECTORY_FILE
|
240 smb2_transport_compound_start(tree
->session
->transport
, 5);
242 req
[0] = smb2_create_send(tree
, &cr
);
244 hd
.data
[0] = UINT64_MAX
;
245 hd
.data
[1] = UINT64_MAX
;
248 cl
.in
.file
.handle
= hd
;
249 req
[1] = smb2_close_send(tree
, &cl
);
250 req
[2] = smb2_close_send(tree
, &cl
);
251 req
[3] = smb2_close_send(tree
, &cl
);
252 req
[4] = smb2_close_send(tree
, &cl
);
254 status
= smb2_create_recv(req
[0], tree
, &cr
);
255 CHECK_STATUS(status
, NT_STATUS_OK
);
256 status
= smb2_close_recv(req
[1], &cl
);
257 CHECK_STATUS(status
, NT_STATUS_FILE_CLOSED
);
258 status
= smb2_close_recv(req
[2], &cl
);
259 CHECK_STATUS(status
, NT_STATUS_FILE_CLOSED
);
260 status
= smb2_close_recv(req
[3], &cl
);
261 CHECK_STATUS(status
, NT_STATUS_FILE_CLOSED
);
262 status
= smb2_close_recv(req
[4], &cl
);
263 CHECK_STATUS(status
, NT_STATUS_FILE_CLOSED
);
265 smb2_util_unlink(tree
, fname
);
270 static bool test_compound_invalid1(struct torture_context
*tctx
,
271 struct smb2_tree
*tree
)
273 struct smb2_handle hd
;
274 struct smb2_create cr
;
276 const char *fname
= "compound_invalid1.dat";
277 struct smb2_close cl
;
279 struct smb2_request
*req
[2];
281 smb2_transport_credits_ask_num(tree
->session
->transport
, 2);
283 smb2_util_unlink(tree
, fname
);
285 smb2_transport_credits_ask_num(tree
->session
->transport
, 1);
288 cr
.in
.security_flags
= 0x00;
289 cr
.in
.oplock_level
= 0;
290 cr
.in
.impersonation_level
= NTCREATEX_IMPERSONATION_IMPERSONATION
;
291 cr
.in
.create_flags
= 0x00000000;
292 cr
.in
.reserved
= 0x00000000;
293 cr
.in
.desired_access
= SEC_RIGHTS_FILE_ALL
;
294 cr
.in
.file_attributes
= FILE_ATTRIBUTE_NORMAL
;
295 cr
.in
.share_access
= NTCREATEX_SHARE_ACCESS_READ
|
296 NTCREATEX_SHARE_ACCESS_WRITE
|
297 NTCREATEX_SHARE_ACCESS_DELETE
;
298 cr
.in
.create_disposition
= NTCREATEX_DISP_OPEN_IF
;
299 cr
.in
.create_options
= NTCREATEX_OPTIONS_SEQUENTIAL_ONLY
|
300 NTCREATEX_OPTIONS_ASYNC_ALERT
|
301 NTCREATEX_OPTIONS_NON_DIRECTORY_FILE
|
305 smb2_transport_compound_start(tree
->session
->transport
, 2);
307 /* passing the first request with the related flag is invalid */
308 smb2_transport_compound_set_related(tree
->session
->transport
, true);
310 req
[0] = smb2_create_send(tree
, &cr
);
312 hd
.data
[0] = UINT64_MAX
;
313 hd
.data
[1] = UINT64_MAX
;
316 cl
.in
.file
.handle
= hd
;
317 req
[1] = smb2_close_send(tree
, &cl
);
319 status
= smb2_create_recv(req
[0], tree
, &cr
);
320 /* TODO: check why this fails with --signing=required */
321 CHECK_STATUS(status
, NT_STATUS_INVALID_PARAMETER
);
322 status
= smb2_close_recv(req
[1], &cl
);
323 CHECK_STATUS(status
, NT_STATUS_INVALID_PARAMETER
);
325 smb2_util_unlink(tree
, fname
);
330 static bool test_compound_invalid2(struct torture_context
*tctx
,
331 struct smb2_tree
*tree
)
333 struct smb2_handle hd
;
334 struct smb2_create cr
;
336 const char *fname
= "compound_invalid2.dat";
337 struct smb2_close cl
;
339 struct smb2_request
*req
[5];
340 struct smbXcli_tcon
*saved_tcon
= tree
->smbXcli
;
341 struct smbXcli_session
*saved_session
= tree
->session
->smbXcli
;
343 smb2_transport_credits_ask_num(tree
->session
->transport
, 5);
345 smb2_util_unlink(tree
, fname
);
347 smb2_transport_credits_ask_num(tree
->session
->transport
, 1);
350 cr
.in
.security_flags
= 0x00;
351 cr
.in
.oplock_level
= 0;
352 cr
.in
.impersonation_level
= NTCREATEX_IMPERSONATION_IMPERSONATION
;
353 cr
.in
.create_flags
= 0x00000000;
354 cr
.in
.reserved
= 0x00000000;
355 cr
.in
.desired_access
= SEC_RIGHTS_FILE_ALL
;
356 cr
.in
.file_attributes
= FILE_ATTRIBUTE_NORMAL
;
357 cr
.in
.share_access
= NTCREATEX_SHARE_ACCESS_READ
|
358 NTCREATEX_SHARE_ACCESS_WRITE
|
359 NTCREATEX_SHARE_ACCESS_DELETE
;
360 cr
.in
.create_disposition
= NTCREATEX_DISP_OPEN_IF
;
361 cr
.in
.create_options
= NTCREATEX_OPTIONS_SEQUENTIAL_ONLY
|
362 NTCREATEX_OPTIONS_ASYNC_ALERT
|
363 NTCREATEX_OPTIONS_NON_DIRECTORY_FILE
|
367 smb2_transport_compound_start(tree
->session
->transport
, 5);
369 req
[0] = smb2_create_send(tree
, &cr
);
371 hd
.data
[0] = UINT64_MAX
;
372 hd
.data
[1] = UINT64_MAX
;
374 smb2_transport_compound_set_related(tree
->session
->transport
, true);
377 cl
.in
.file
.handle
= hd
;
379 tree
->smbXcli
= smbXcli_tcon_create(tree
);
380 smb2cli_tcon_set_values(tree
->smbXcli
,
381 0xFFFFFFFF, /* tcon_id */
384 0, /* capabilities */
385 0 /* maximal_access */);
387 tree
->session
->smbXcli
= smbXcli_session_create(tree
->session
,
388 tree
->session
->transport
->conn
);
389 smb2cli_session_set_id_and_flags(tree
->session
->smbXcli
, UINT64_MAX
, 0);
391 req
[1] = smb2_close_send(tree
, &cl
);
392 /* strange that this is not generating invalid parameter */
393 smb2_transport_compound_set_related(tree
->session
->transport
, false);
394 req
[2] = smb2_close_send(tree
, &cl
);
395 req
[3] = smb2_close_send(tree
, &cl
);
396 smb2_transport_compound_set_related(tree
->session
->transport
, true);
397 req
[4] = smb2_close_send(tree
, &cl
);
399 status
= smb2_create_recv(req
[0], tree
, &cr
);
400 CHECK_STATUS(status
, NT_STATUS_OK
);
401 status
= smb2_close_recv(req
[1], &cl
);
402 CHECK_STATUS(status
, NT_STATUS_OK
);
403 status
= smb2_close_recv(req
[2], &cl
);
404 CHECK_STATUS(status
, NT_STATUS_USER_SESSION_DELETED
);
405 status
= smb2_close_recv(req
[3], &cl
);
406 CHECK_STATUS(status
, NT_STATUS_USER_SESSION_DELETED
);
407 status
= smb2_close_recv(req
[4], &cl
);
408 CHECK_STATUS(status
, NT_STATUS_INVALID_PARAMETER
);
410 TALLOC_FREE(tree
->smbXcli
);
411 tree
->smbXcli
= saved_tcon
;
412 TALLOC_FREE(tree
->session
->smbXcli
);
413 tree
->session
->smbXcli
= saved_session
;
415 smb2_util_unlink(tree
, fname
);
420 static bool test_compound_invalid3(struct torture_context
*tctx
,
421 struct smb2_tree
*tree
)
423 struct smb2_handle hd
;
424 struct smb2_create cr
;
426 const char *fname
= "compound_invalid3.dat";
427 struct smb2_close cl
;
429 struct smb2_request
*req
[5];
431 smb2_transport_credits_ask_num(tree
->session
->transport
, 5);
433 smb2_util_unlink(tree
, fname
);
435 smb2_transport_credits_ask_num(tree
->session
->transport
, 1);
438 cr
.in
.security_flags
= 0x00;
439 cr
.in
.oplock_level
= 0;
440 cr
.in
.impersonation_level
= NTCREATEX_IMPERSONATION_IMPERSONATION
;
441 cr
.in
.create_flags
= 0x00000000;
442 cr
.in
.reserved
= 0x00000000;
443 cr
.in
.desired_access
= SEC_RIGHTS_FILE_ALL
;
444 cr
.in
.file_attributes
= FILE_ATTRIBUTE_NORMAL
;
445 cr
.in
.share_access
= NTCREATEX_SHARE_ACCESS_READ
|
446 NTCREATEX_SHARE_ACCESS_WRITE
|
447 NTCREATEX_SHARE_ACCESS_DELETE
;
448 cr
.in
.create_disposition
= NTCREATEX_DISP_OPEN_IF
;
449 cr
.in
.create_options
= NTCREATEX_OPTIONS_SEQUENTIAL_ONLY
|
450 NTCREATEX_OPTIONS_ASYNC_ALERT
|
451 NTCREATEX_OPTIONS_NON_DIRECTORY_FILE
|
455 smb2_transport_compound_start(tree
->session
->transport
, 5);
457 req
[0] = smb2_create_send(tree
, &cr
);
459 hd
.data
[0] = UINT64_MAX
;
460 hd
.data
[1] = UINT64_MAX
;
463 cl
.in
.file
.handle
= hd
;
464 req
[1] = smb2_close_send(tree
, &cl
);
465 req
[2] = smb2_close_send(tree
, &cl
);
466 /* flipping the related flag is invalid */
467 smb2_transport_compound_set_related(tree
->session
->transport
, true);
468 req
[3] = smb2_close_send(tree
, &cl
);
469 req
[4] = smb2_close_send(tree
, &cl
);
471 status
= smb2_create_recv(req
[0], tree
, &cr
);
472 CHECK_STATUS(status
, NT_STATUS_OK
);
473 status
= smb2_close_recv(req
[1], &cl
);
474 CHECK_STATUS(status
, NT_STATUS_FILE_CLOSED
);
475 status
= smb2_close_recv(req
[2], &cl
);
476 CHECK_STATUS(status
, NT_STATUS_FILE_CLOSED
);
477 status
= smb2_close_recv(req
[3], &cl
);
478 CHECK_STATUS(status
, NT_STATUS_INVALID_PARAMETER
);
479 status
= smb2_close_recv(req
[4], &cl
);
480 CHECK_STATUS(status
, NT_STATUS_INVALID_PARAMETER
);
482 smb2_util_unlink(tree
, fname
);
487 /* Send a compound request where we expect the last request (Create, Notify)
488 * to go asynchronous. This works against a Win7 server and the reply is
489 * sent in two different packets. */
490 static bool test_compound_interim1(struct torture_context
*tctx
,
491 struct smb2_tree
*tree
)
493 struct smb2_handle hd
;
494 struct smb2_create cr
;
495 NTSTATUS status
= NT_STATUS_OK
;
496 const char *dname
= "compound_interim_dir";
497 struct smb2_notify nt
;
499 struct smb2_request
*req
[2];
501 /* Win7 compound request implementation deviates substantially from the
502 * SMB2 spec as noted in MS-SMB2 <159>, <162>. This, test currently
503 * verifies the Windows behavior, not the general spec behavior. */
504 if (!TARGET_IS_WIN7(tctx
) && !TARGET_IS_W2K8(tctx
)) {
505 torture_skip(tctx
, "Interim test is specific to Windows server "
509 smb2_transport_credits_ask_num(tree
->session
->transport
, 5);
511 smb2_deltree(tree
, dname
);
513 smb2_transport_credits_ask_num(tree
->session
->transport
, 1);
516 cr
.in
.desired_access
= SEC_RIGHTS_FILE_ALL
;
517 cr
.in
.create_options
= NTCREATEX_OPTIONS_DIRECTORY
;
518 cr
.in
.file_attributes
= FILE_ATTRIBUTE_DIRECTORY
;
519 cr
.in
.share_access
= NTCREATEX_SHARE_ACCESS_READ
|
520 NTCREATEX_SHARE_ACCESS_WRITE
|
521 NTCREATEX_SHARE_ACCESS_DELETE
;
522 cr
.in
.create_disposition
= NTCREATEX_DISP_CREATE
;
525 smb2_transport_compound_start(tree
->session
->transport
, 2);
527 req
[0] = smb2_create_send(tree
, &cr
);
529 smb2_transport_compound_set_related(tree
->session
->transport
, true);
531 hd
.data
[0] = UINT64_MAX
;
532 hd
.data
[1] = UINT64_MAX
;
535 nt
.in
.recursive
= true;
536 nt
.in
.buffer_size
= 0x1000;
537 nt
.in
.file
.handle
= hd
;
538 nt
.in
.completion_filter
= FILE_NOTIFY_CHANGE_NAME
;
539 nt
.in
.unknown
= 0x00000000;
541 req
[1] = smb2_notify_send(tree
, &nt
);
543 status
= smb2_create_recv(req
[0], tree
, &cr
);
544 CHECK_STATUS(status
, NT_STATUS_OK
);
547 status
= smb2_notify_recv(req
[1], tree
, &nt
);
548 CHECK_STATUS(status
, NT_STATUS_CANCELLED
);
550 smb2_util_close(tree
, cr
.out
.file
.handle
);
552 smb2_deltree(tree
, dname
);
557 /* Send a compound request where we expect the middle request (Create, Notify,
558 * GetInfo) to go asynchronous. Against Win7 the sync request succeed while
559 * the async fails. All are returned in the same compound response. */
560 static bool test_compound_interim2(struct torture_context
*tctx
,
561 struct smb2_tree
*tree
)
563 struct smb2_handle hd
;
564 struct smb2_create cr
;
565 NTSTATUS status
= NT_STATUS_OK
;
566 const char *dname
= "compound_interim_dir";
567 struct smb2_getinfo gf
;
568 struct smb2_notify nt
;
570 struct smb2_request
*req
[3];
572 /* Win7 compound request implementation deviates substantially from the
573 * SMB2 spec as noted in MS-SMB2 <159>, <162>. This, test currently
574 * verifies the Windows behavior, not the general spec behavior. */
575 if (!TARGET_IS_WIN7(tctx
) && !TARGET_IS_W2K8(tctx
)) {
576 torture_skip(tctx
, "Interim test is specific to Windows server "
580 smb2_transport_credits_ask_num(tree
->session
->transport
, 5);
582 smb2_deltree(tree
, dname
);
584 smb2_transport_credits_ask_num(tree
->session
->transport
, 1);
587 cr
.in
.desired_access
= SEC_RIGHTS_FILE_ALL
;
588 cr
.in
.create_options
= NTCREATEX_OPTIONS_DIRECTORY
;
589 cr
.in
.file_attributes
= FILE_ATTRIBUTE_DIRECTORY
;
590 cr
.in
.share_access
= NTCREATEX_SHARE_ACCESS_READ
|
591 NTCREATEX_SHARE_ACCESS_WRITE
|
592 NTCREATEX_SHARE_ACCESS_DELETE
;
593 cr
.in
.create_disposition
= NTCREATEX_DISP_CREATE
;
596 smb2_transport_compound_start(tree
->session
->transport
, 3);
598 req
[0] = smb2_create_send(tree
, &cr
);
600 smb2_transport_compound_set_related(tree
->session
->transport
, true);
602 hd
.data
[0] = UINT64_MAX
;
603 hd
.data
[1] = UINT64_MAX
;
606 nt
.in
.recursive
= true;
607 nt
.in
.buffer_size
= 0x1000;
608 nt
.in
.file
.handle
= hd
;
609 nt
.in
.completion_filter
= FILE_NOTIFY_CHANGE_NAME
;
610 nt
.in
.unknown
= 0x00000000;
612 req
[1] = smb2_notify_send(tree
, &nt
);
615 gf
.in
.file
.handle
= hd
;
616 gf
.in
.info_type
= SMB2_GETINFO_FILE
;
617 gf
.in
.info_class
= 0x04; /* FILE_BASIC_INFORMATION */
618 gf
.in
.output_buffer_length
= 0x1000;
619 gf
.in
.input_buffer_length
= 0;
621 req
[2] = smb2_getinfo_send(tree
, &gf
);
623 status
= smb2_create_recv(req
[0], tree
, &cr
);
624 CHECK_STATUS(status
, NT_STATUS_OK
);
626 status
= smb2_notify_recv(req
[1], tree
, &nt
);
627 CHECK_STATUS(status
, NT_STATUS_INTERNAL_ERROR
);
629 status
= smb2_getinfo_recv(req
[2], tree
, &gf
);
630 CHECK_STATUS(status
, NT_STATUS_OK
);
632 smb2_util_close(tree
, cr
.out
.file
.handle
);
634 smb2_deltree(tree
, dname
);
639 struct torture_suite
*torture_smb2_compound_init(void)
641 struct torture_suite
*suite
= torture_suite_create(talloc_autofree_context(), "compound");
643 torture_suite_add_1smb2_test(suite
, "related1", test_compound_related1
);
644 torture_suite_add_1smb2_test(suite
, "related2", test_compound_related2
);
645 torture_suite_add_1smb2_test(suite
, "unrelated1", test_compound_unrelated1
);
646 torture_suite_add_1smb2_test(suite
, "invalid1", test_compound_invalid1
);
647 torture_suite_add_1smb2_test(suite
, "invalid2", test_compound_invalid2
);
648 torture_suite_add_1smb2_test(suite
, "invalid3", test_compound_invalid3
);
649 torture_suite_add_1smb2_test(suite
, "interim1", test_compound_interim1
);
650 torture_suite_add_1smb2_test(suite
, "interim2", test_compound_interim2
);
652 suite
->description
= talloc_strdup(suite
, "SMB2-COMPOUND tests");