s3-selftest: Remove some unnecessary comma
[Samba/gebeck_regimport.git] / source4 / torture / smb2 / compound.c
blobcb5b744c5dff64c2dcb45ded13ba04715ce4384f
1 /*
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/>.
22 #include "includes.h"
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)); \
33 ret = false; \
34 goto done; \
35 }} while (0)
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;
45 NTSTATUS status;
46 const char *fname = "compound_related1.dat";
47 struct smb2_close cl;
48 bool ret = true;
49 struct smb2_request *req[2];
50 uint32_t saved_tid = tree->tid;
51 uint64_t saved_uid = smb2cli_session_current_id(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);
59 ZERO_STRUCT(cr);
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 |
74 0x00200000;
75 cr.in.fname = fname;
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;
86 ZERO_STRUCT(cl);
87 cl.in.file.handle = hd;
89 tree->tid = 0xFFFFFFFF;
90 smb2cli_session_set_id_and_flags(tree->session->smbXcli, UINT64_MAX, 0);
92 req[1] = smb2_close_send(tree, &cl);
94 status = smb2_create_recv(req[0], tree, &cr);
95 CHECK_STATUS(status, NT_STATUS_OK);
96 status = smb2_close_recv(req[1], &cl);
97 CHECK_STATUS(status, NT_STATUS_OK);
99 tree->tid = saved_tid;
100 smb2cli_session_set_id_and_flags(tree->session->smbXcli, saved_uid, 0);
102 smb2_util_unlink(tree, fname);
103 done:
104 return ret;
107 static bool test_compound_related2(struct torture_context *tctx,
108 struct smb2_tree *tree)
110 struct smb2_handle hd;
111 struct smb2_create cr;
112 NTSTATUS status;
113 const char *fname = "compound_related2.dat";
114 struct smb2_close cl;
115 bool ret = true;
116 struct smb2_request *req[5];
117 uint32_t saved_tid = tree->tid;
118 uint64_t saved_uid = smb2cli_session_current_id(tree->session->smbXcli);
120 smb2_transport_credits_ask_num(tree->session->transport, 5);
122 smb2_util_unlink(tree, fname);
124 smb2_transport_credits_ask_num(tree->session->transport, 1);
126 ZERO_STRUCT(cr);
127 cr.in.security_flags = 0x00;
128 cr.in.oplock_level = 0;
129 cr.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
130 cr.in.create_flags = 0x00000000;
131 cr.in.reserved = 0x00000000;
132 cr.in.desired_access = SEC_RIGHTS_FILE_ALL;
133 cr.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
134 cr.in.share_access = NTCREATEX_SHARE_ACCESS_READ |
135 NTCREATEX_SHARE_ACCESS_WRITE |
136 NTCREATEX_SHARE_ACCESS_DELETE;
137 cr.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
138 cr.in.create_options = NTCREATEX_OPTIONS_SEQUENTIAL_ONLY |
139 NTCREATEX_OPTIONS_ASYNC_ALERT |
140 NTCREATEX_OPTIONS_NON_DIRECTORY_FILE |
141 0x00200000;
142 cr.in.fname = fname;
144 smb2_transport_compound_start(tree->session->transport, 5);
146 req[0] = smb2_create_send(tree, &cr);
148 hd.data[0] = UINT64_MAX;
149 hd.data[1] = UINT64_MAX;
151 smb2_transport_compound_set_related(tree->session->transport, true);
153 ZERO_STRUCT(cl);
154 cl.in.file.handle = hd;
155 tree->tid = 0xFFFFFFFF;
156 smb2cli_session_set_id_and_flags(tree->session->smbXcli, UINT64_MAX, 0);
158 req[1] = smb2_close_send(tree, &cl);
159 req[2] = smb2_close_send(tree, &cl);
160 req[3] = smb2_close_send(tree, &cl);
161 req[4] = smb2_close_send(tree, &cl);
163 status = smb2_create_recv(req[0], tree, &cr);
164 CHECK_STATUS(status, NT_STATUS_OK);
165 status = smb2_close_recv(req[1], &cl);
166 CHECK_STATUS(status, NT_STATUS_OK);
167 status = smb2_close_recv(req[2], &cl);
168 CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
169 status = smb2_close_recv(req[3], &cl);
170 CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
171 status = smb2_close_recv(req[4], &cl);
172 CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
174 tree->tid = saved_tid;
175 smb2cli_session_set_id_and_flags(tree->session->smbXcli, saved_uid, 0);
177 smb2_util_unlink(tree, fname);
178 done:
179 return ret;
182 static bool test_compound_unrelated1(struct torture_context *tctx,
183 struct smb2_tree *tree)
185 struct smb2_handle hd;
186 struct smb2_create cr;
187 NTSTATUS status;
188 const char *fname = "compound_unrelated1.dat";
189 struct smb2_close cl;
190 bool ret = true;
191 struct smb2_request *req[5];
193 smb2_transport_credits_ask_num(tree->session->transport, 5);
195 smb2_util_unlink(tree, fname);
197 smb2_transport_credits_ask_num(tree->session->transport, 1);
199 ZERO_STRUCT(cr);
200 cr.in.security_flags = 0x00;
201 cr.in.oplock_level = 0;
202 cr.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
203 cr.in.create_flags = 0x00000000;
204 cr.in.reserved = 0x00000000;
205 cr.in.desired_access = SEC_RIGHTS_FILE_ALL;
206 cr.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
207 cr.in.share_access = NTCREATEX_SHARE_ACCESS_READ |
208 NTCREATEX_SHARE_ACCESS_WRITE |
209 NTCREATEX_SHARE_ACCESS_DELETE;
210 cr.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
211 cr.in.create_options = NTCREATEX_OPTIONS_SEQUENTIAL_ONLY |
212 NTCREATEX_OPTIONS_ASYNC_ALERT |
213 NTCREATEX_OPTIONS_NON_DIRECTORY_FILE |
214 0x00200000;
215 cr.in.fname = fname;
217 smb2_transport_compound_start(tree->session->transport, 5);
219 req[0] = smb2_create_send(tree, &cr);
221 hd.data[0] = UINT64_MAX;
222 hd.data[1] = UINT64_MAX;
224 ZERO_STRUCT(cl);
225 cl.in.file.handle = hd;
226 req[1] = smb2_close_send(tree, &cl);
227 req[2] = smb2_close_send(tree, &cl);
228 req[3] = smb2_close_send(tree, &cl);
229 req[4] = smb2_close_send(tree, &cl);
231 status = smb2_create_recv(req[0], tree, &cr);
232 CHECK_STATUS(status, NT_STATUS_OK);
233 status = smb2_close_recv(req[1], &cl);
234 CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
235 status = smb2_close_recv(req[2], &cl);
236 CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
237 status = smb2_close_recv(req[3], &cl);
238 CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
239 status = smb2_close_recv(req[4], &cl);
240 CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
242 smb2_util_unlink(tree, fname);
243 done:
244 return ret;
247 static bool test_compound_invalid1(struct torture_context *tctx,
248 struct smb2_tree *tree)
250 struct smb2_handle hd;
251 struct smb2_create cr;
252 NTSTATUS status;
253 const char *fname = "compound_invalid1.dat";
254 struct smb2_close cl;
255 bool ret = true;
256 struct smb2_request *req[2];
258 smb2_transport_credits_ask_num(tree->session->transport, 2);
260 smb2_util_unlink(tree, fname);
262 smb2_transport_credits_ask_num(tree->session->transport, 1);
264 ZERO_STRUCT(cr);
265 cr.in.security_flags = 0x00;
266 cr.in.oplock_level = 0;
267 cr.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
268 cr.in.create_flags = 0x00000000;
269 cr.in.reserved = 0x00000000;
270 cr.in.desired_access = SEC_RIGHTS_FILE_ALL;
271 cr.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
272 cr.in.share_access = NTCREATEX_SHARE_ACCESS_READ |
273 NTCREATEX_SHARE_ACCESS_WRITE |
274 NTCREATEX_SHARE_ACCESS_DELETE;
275 cr.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
276 cr.in.create_options = NTCREATEX_OPTIONS_SEQUENTIAL_ONLY |
277 NTCREATEX_OPTIONS_ASYNC_ALERT |
278 NTCREATEX_OPTIONS_NON_DIRECTORY_FILE |
279 0x00200000;
280 cr.in.fname = fname;
282 smb2_transport_compound_start(tree->session->transport, 2);
284 /* passing the first request with the related flag is invalid */
285 smb2_transport_compound_set_related(tree->session->transport, true);
287 req[0] = smb2_create_send(tree, &cr);
289 hd.data[0] = UINT64_MAX;
290 hd.data[1] = UINT64_MAX;
292 ZERO_STRUCT(cl);
293 cl.in.file.handle = hd;
294 req[1] = smb2_close_send(tree, &cl);
296 status = smb2_create_recv(req[0], tree, &cr);
297 /* TODO: check why this fails with --signing=required */
298 CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
299 status = smb2_close_recv(req[1], &cl);
300 CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
302 smb2_util_unlink(tree, fname);
303 done:
304 return ret;
307 static bool test_compound_invalid2(struct torture_context *tctx,
308 struct smb2_tree *tree)
310 struct smb2_handle hd;
311 struct smb2_create cr;
312 NTSTATUS status;
313 const char *fname = "compound_invalid2.dat";
314 struct smb2_close cl;
315 bool ret = true;
316 struct smb2_request *req[5];
317 uint32_t saved_tid = tree->tid;
318 uint64_t saved_uid = smb2cli_session_current_id(tree->session->smbXcli);
320 smb2_transport_credits_ask_num(tree->session->transport, 5);
322 smb2_util_unlink(tree, fname);
324 smb2_transport_credits_ask_num(tree->session->transport, 1);
326 ZERO_STRUCT(cr);
327 cr.in.security_flags = 0x00;
328 cr.in.oplock_level = 0;
329 cr.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
330 cr.in.create_flags = 0x00000000;
331 cr.in.reserved = 0x00000000;
332 cr.in.desired_access = SEC_RIGHTS_FILE_ALL;
333 cr.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
334 cr.in.share_access = NTCREATEX_SHARE_ACCESS_READ |
335 NTCREATEX_SHARE_ACCESS_WRITE |
336 NTCREATEX_SHARE_ACCESS_DELETE;
337 cr.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
338 cr.in.create_options = NTCREATEX_OPTIONS_SEQUENTIAL_ONLY |
339 NTCREATEX_OPTIONS_ASYNC_ALERT |
340 NTCREATEX_OPTIONS_NON_DIRECTORY_FILE |
341 0x00200000;
342 cr.in.fname = fname;
344 smb2_transport_compound_start(tree->session->transport, 5);
346 req[0] = smb2_create_send(tree, &cr);
348 hd.data[0] = UINT64_MAX;
349 hd.data[1] = UINT64_MAX;
351 smb2_transport_compound_set_related(tree->session->transport, true);
353 ZERO_STRUCT(cl);
354 cl.in.file.handle = hd;
355 tree->tid = 0xFFFFFFFF;
356 smb2cli_session_set_id_and_flags(tree->session->smbXcli, UINT64_MAX, 0);
358 req[1] = smb2_close_send(tree, &cl);
359 /* strange that this is not generating invalid parameter */
360 smb2_transport_compound_set_related(tree->session->transport, false);
361 req[2] = smb2_close_send(tree, &cl);
362 req[3] = smb2_close_send(tree, &cl);
363 smb2_transport_compound_set_related(tree->session->transport, true);
364 req[4] = smb2_close_send(tree, &cl);
366 status = smb2_create_recv(req[0], tree, &cr);
367 CHECK_STATUS(status, NT_STATUS_OK);
368 status = smb2_close_recv(req[1], &cl);
369 CHECK_STATUS(status, NT_STATUS_OK);
370 status = smb2_close_recv(req[2], &cl);
371 CHECK_STATUS(status, NT_STATUS_USER_SESSION_DELETED);
372 status = smb2_close_recv(req[3], &cl);
373 CHECK_STATUS(status, NT_STATUS_USER_SESSION_DELETED);
374 status = smb2_close_recv(req[4], &cl);
375 CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
377 tree->tid = saved_tid;
378 smb2cli_session_set_id_and_flags(tree->session->smbXcli, saved_uid, 0);
380 smb2_util_unlink(tree, fname);
381 done:
382 return ret;
385 static bool test_compound_invalid3(struct torture_context *tctx,
386 struct smb2_tree *tree)
388 struct smb2_handle hd;
389 struct smb2_create cr;
390 NTSTATUS status;
391 const char *fname = "compound_invalid3.dat";
392 struct smb2_close cl;
393 bool ret = true;
394 struct smb2_request *req[5];
396 smb2_transport_credits_ask_num(tree->session->transport, 5);
398 smb2_util_unlink(tree, fname);
400 smb2_transport_credits_ask_num(tree->session->transport, 1);
402 ZERO_STRUCT(cr);
403 cr.in.security_flags = 0x00;
404 cr.in.oplock_level = 0;
405 cr.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
406 cr.in.create_flags = 0x00000000;
407 cr.in.reserved = 0x00000000;
408 cr.in.desired_access = SEC_RIGHTS_FILE_ALL;
409 cr.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
410 cr.in.share_access = NTCREATEX_SHARE_ACCESS_READ |
411 NTCREATEX_SHARE_ACCESS_WRITE |
412 NTCREATEX_SHARE_ACCESS_DELETE;
413 cr.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
414 cr.in.create_options = NTCREATEX_OPTIONS_SEQUENTIAL_ONLY |
415 NTCREATEX_OPTIONS_ASYNC_ALERT |
416 NTCREATEX_OPTIONS_NON_DIRECTORY_FILE |
417 0x00200000;
418 cr.in.fname = fname;
420 smb2_transport_compound_start(tree->session->transport, 5);
422 req[0] = smb2_create_send(tree, &cr);
424 hd.data[0] = UINT64_MAX;
425 hd.data[1] = UINT64_MAX;
427 ZERO_STRUCT(cl);
428 cl.in.file.handle = hd;
429 req[1] = smb2_close_send(tree, &cl);
430 req[2] = smb2_close_send(tree, &cl);
431 /* flipping the related flag is invalid */
432 smb2_transport_compound_set_related(tree->session->transport, true);
433 req[3] = smb2_close_send(tree, &cl);
434 req[4] = smb2_close_send(tree, &cl);
436 status = smb2_create_recv(req[0], tree, &cr);
437 CHECK_STATUS(status, NT_STATUS_OK);
438 status = smb2_close_recv(req[1], &cl);
439 CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
440 status = smb2_close_recv(req[2], &cl);
441 CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
442 status = smb2_close_recv(req[3], &cl);
443 CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
444 status = smb2_close_recv(req[4], &cl);
445 CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
447 smb2_util_unlink(tree, fname);
448 done:
449 return ret;
452 /* Send a compound request where we expect the last request (Create, Notify)
453 * to go asynchronous. This works against a Win7 server and the reply is
454 * sent in two different packets. */
455 static bool test_compound_interim1(struct torture_context *tctx,
456 struct smb2_tree *tree)
458 struct smb2_handle hd;
459 struct smb2_create cr;
460 NTSTATUS status = NT_STATUS_OK;
461 const char *dname = "compound_interim_dir";
462 struct smb2_notify nt;
463 bool ret = true;
464 struct smb2_request *req[2];
466 /* Win7 compound request implementation deviates substantially from the
467 * SMB2 spec as noted in MS-SMB2 <159>, <162>. This, test currently
468 * verifies the Windows behavior, not the general spec behavior. */
469 if (!TARGET_IS_WIN7(tctx) && !TARGET_IS_W2K8(tctx)) {
470 torture_skip(tctx, "Interim test is specific to Windows server "
471 "behavior.\n");
474 smb2_transport_credits_ask_num(tree->session->transport, 5);
476 smb2_deltree(tree, dname);
478 smb2_transport_credits_ask_num(tree->session->transport, 1);
480 ZERO_STRUCT(cr);
481 cr.in.desired_access = SEC_RIGHTS_FILE_ALL;
482 cr.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
483 cr.in.file_attributes = FILE_ATTRIBUTE_DIRECTORY;
484 cr.in.share_access = NTCREATEX_SHARE_ACCESS_READ |
485 NTCREATEX_SHARE_ACCESS_WRITE |
486 NTCREATEX_SHARE_ACCESS_DELETE;
487 cr.in.create_disposition = NTCREATEX_DISP_CREATE;
488 cr.in.fname = dname;
490 smb2_transport_compound_start(tree->session->transport, 2);
492 req[0] = smb2_create_send(tree, &cr);
494 smb2_transport_compound_set_related(tree->session->transport, true);
496 hd.data[0] = UINT64_MAX;
497 hd.data[1] = UINT64_MAX;
499 ZERO_STRUCT(nt);
500 nt.in.recursive = true;
501 nt.in.buffer_size = 0x1000;
502 nt.in.file.handle = hd;
503 nt.in.completion_filter = FILE_NOTIFY_CHANGE_NAME;
504 nt.in.unknown = 0x00000000;
506 req[1] = smb2_notify_send(tree, &nt);
508 status = smb2_create_recv(req[0], tree, &cr);
509 CHECK_STATUS(status, NT_STATUS_OK);
511 smb2_cancel(req[1]);
512 status = smb2_notify_recv(req[1], tree, &nt);
513 CHECK_STATUS(status, NT_STATUS_CANCELLED);
515 smb2_util_close(tree, cr.out.file.handle);
517 smb2_deltree(tree, dname);
518 done:
519 return ret;
522 /* Send a compound request where we expect the middle request (Create, Notify,
523 * GetInfo) to go asynchronous. Against Win7 the sync request succeed while
524 * the async fails. All are returned in the same compound response. */
525 static bool test_compound_interim2(struct torture_context *tctx,
526 struct smb2_tree *tree)
528 struct smb2_handle hd;
529 struct smb2_create cr;
530 NTSTATUS status = NT_STATUS_OK;
531 const char *dname = "compound_interim_dir";
532 struct smb2_getinfo gf;
533 struct smb2_notify nt;
534 bool ret = true;
535 struct smb2_request *req[3];
537 /* Win7 compound request implementation deviates substantially from the
538 * SMB2 spec as noted in MS-SMB2 <159>, <162>. This, test currently
539 * verifies the Windows behavior, not the general spec behavior. */
540 if (!TARGET_IS_WIN7(tctx) && !TARGET_IS_W2K8(tctx)) {
541 torture_skip(tctx, "Interim test is specific to Windows server "
542 "behavior.\n");
545 smb2_transport_credits_ask_num(tree->session->transport, 5);
547 smb2_deltree(tree, dname);
549 smb2_transport_credits_ask_num(tree->session->transport, 1);
551 ZERO_STRUCT(cr);
552 cr.in.desired_access = SEC_RIGHTS_FILE_ALL;
553 cr.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
554 cr.in.file_attributes = FILE_ATTRIBUTE_DIRECTORY;
555 cr.in.share_access = NTCREATEX_SHARE_ACCESS_READ |
556 NTCREATEX_SHARE_ACCESS_WRITE |
557 NTCREATEX_SHARE_ACCESS_DELETE;
558 cr.in.create_disposition = NTCREATEX_DISP_CREATE;
559 cr.in.fname = dname;
561 smb2_transport_compound_start(tree->session->transport, 3);
563 req[0] = smb2_create_send(tree, &cr);
565 smb2_transport_compound_set_related(tree->session->transport, true);
567 hd.data[0] = UINT64_MAX;
568 hd.data[1] = UINT64_MAX;
570 ZERO_STRUCT(nt);
571 nt.in.recursive = true;
572 nt.in.buffer_size = 0x1000;
573 nt.in.file.handle = hd;
574 nt.in.completion_filter = FILE_NOTIFY_CHANGE_NAME;
575 nt.in.unknown = 0x00000000;
577 req[1] = smb2_notify_send(tree, &nt);
579 ZERO_STRUCT(gf);
580 gf.in.file.handle = hd;
581 gf.in.info_type = SMB2_GETINFO_FILE;
582 gf.in.info_class = 0x04; /* FILE_BASIC_INFORMATION */
583 gf.in.output_buffer_length = 0x1000;
584 gf.in.input_buffer_length = 0;
586 req[2] = smb2_getinfo_send(tree, &gf);
588 status = smb2_create_recv(req[0], tree, &cr);
589 CHECK_STATUS(status, NT_STATUS_OK);
591 status = smb2_notify_recv(req[1], tree, &nt);
592 CHECK_STATUS(status, NT_STATUS_INTERNAL_ERROR);
594 status = smb2_getinfo_recv(req[2], tree, &gf);
595 CHECK_STATUS(status, NT_STATUS_OK);
597 smb2_util_close(tree, cr.out.file.handle);
599 smb2_deltree(tree, dname);
600 done:
601 return ret;
604 struct torture_suite *torture_smb2_compound_init(void)
606 struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "compound");
608 torture_suite_add_1smb2_test(suite, "related1", test_compound_related1);
609 torture_suite_add_1smb2_test(suite, "related2", test_compound_related2);
610 torture_suite_add_1smb2_test(suite, "unrelated1", test_compound_unrelated1);
611 torture_suite_add_1smb2_test(suite, "invalid1", test_compound_invalid1);
612 torture_suite_add_1smb2_test(suite, "invalid2", test_compound_invalid2);
613 torture_suite_add_1smb2_test(suite, "invalid3", test_compound_invalid3);
614 torture_suite_add_1smb2_test(suite, "interim1", test_compound_interim1);
615 torture_suite_add_1smb2_test(suite, "interim2", test_compound_interim2);
617 suite->description = talloc_strdup(suite, "SMB2-COMPOUND tests");
619 return suite;