2 Unix SMB/CIFS implementation.
4 test suite for File Server Remote VSS Protocol operations
6 Copyright (C) David Disseldorp 2012
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 * Windows Server "8" Beta is very picky in how it accepts FSRVP requests, the
24 * client must be a member of the same AD domain, ndr64 and signing must be
25 * negotiated for the DCE/RPC bind. E.g.
27 * smbtorture ncacn_np:LUTZE[/pipe/FssagentRpc,smb2,ndr64,sign] \
28 * -U 'DOM\user%pw' rpc.fsrvp
30 * This test suite requires a snapshotable share named FSHARE (see #def below).
33 #include "librpc/gen_ndr/security.h"
34 #include "lib/param/param.h"
35 #include "libcli/smb2/smb2.h"
36 #include "libcli/smb2/smb2_calls.h"
37 #include "libcli/smb_composite/smb_composite.h"
38 #include "libcli/resolve/resolve.h"
39 #include "torture/torture.h"
40 #include "torture/smb2/proto.h"
41 #include "torture/rpc/torture_rpc.h"
42 #include "librpc/gen_ndr/ndr_fsrvp.h"
43 #include "librpc/gen_ndr/ndr_fsrvp_c.h"
45 #define FSHARE "hyper"
46 #define FNAME "testfss.dat"
47 #define FNAME2 "testfss2.dat"
49 uint8_t fsrvp_magic
[] = {0x8a, 0xe3, 0x13, 0x71, 0x02, 0xf4, 0x36, 0x71,
50 0x02, 0x40, 0x28, 0x00, 0x3c, 0x65, 0xe0, 0xa8,
51 0x44, 0x27, 0x89, 0x43, 0xa6, 0x1d, 0x73, 0x73,
52 0xdf, 0x8b, 0x22, 0x92, 0x01, 0x00, 0x00, 0x00,
53 0x33, 0x05, 0x71, 0x71, 0xba, 0xbe, 0x37, 0x49,
54 0x83, 0x19, 0xb5, 0xdb, 0xef, 0x9c, 0xcc, 0x36,
55 0x01, 0x00, 0x00, 0x00};
57 static bool test_fsrvp_is_path_supported(struct torture_context
*tctx
,
58 struct dcerpc_pipe
*p
)
60 struct fss_IsPathSupported r
;
61 struct dcerpc_binding_handle
*b
= p
->binding_handle
;
65 r
.in
.ShareName
= talloc_asprintf(tctx
,"\\\\%s\\%s",
66 dcerpc_server_name(p
),
68 /* win8 beta sends this */
69 memcpy(r
.in
.magic
, fsrvp_magic
, sizeof(fsrvp_magic
));
70 status
= dcerpc_fss_IsPathSupported_r(b
, tctx
, &r
);
71 torture_assert_ntstatus_ok(tctx
, status
,
72 "IsPathSupported failed");
75 r
.in
.ShareName
= talloc_asprintf(tctx
,"\\\\%s\\%s",
76 dcerpc_server_name(p
),
78 /* also works without magic */
79 status
= dcerpc_fss_IsPathSupported_r(b
, tctx
, &r
);
80 torture_assert_ntstatus_ok(tctx
, status
,
81 "IsPathSupported failed");
83 torture_assert(tctx
, *r
.out
.SupportedByThisProvider
,
84 "path not supported");
86 torture_comment(tctx
, "path %s is supported by fsrvp server %s\n",
87 r
.in
.ShareName
, *r
.out
.OwnerMachineName
);
92 static bool test_fsrvp_get_version(struct torture_context
*tctx
,
93 struct dcerpc_pipe
*p
)
95 struct fss_GetSupportedVersion r
;
96 struct dcerpc_binding_handle
*b
= p
->binding_handle
;
100 /* win8 beta sends this */
101 memcpy(r
.in
.magic
, fsrvp_magic
, sizeof(fsrvp_magic
));
102 status
= dcerpc_fss_GetSupportedVersion_r(b
, tctx
, &r
);
103 torture_assert_ntstatus_ok(tctx
, status
,
104 "GetSupportedVersion failed with magic");
107 /* also works without magic */
108 status
= dcerpc_fss_GetSupportedVersion_r(b
, tctx
, &r
);
109 torture_assert_ntstatus_ok(tctx
, status
,
110 "GetSupportedVersion failed without magic");
112 torture_comment(tctx
, "got MinVersion %u\n", *r
.out
.MinVersion
);
113 torture_comment(tctx
, "got MaxVersion %u\n", *r
.out
.MaxVersion
);
118 static bool test_fsrvp_set_ctx(struct torture_context
*tctx
,
119 struct dcerpc_pipe
*p
)
121 struct fss_SetContext r
;
122 struct dcerpc_binding_handle
*b
= p
->binding_handle
;
126 r
.in
.Context
= FSRVP_CTX_BACKUP
;
127 status
= dcerpc_fss_SetContext_r(b
, tctx
, &r
);
128 torture_assert_ntstatus_ok(tctx
, status
, "SetContext failed");
133 static bool test_fsrvp_sc_create(struct torture_context
*tctx
,
134 struct dcerpc_pipe
*p
,
136 struct fssagent_share_mapping_1
**sc_map
)
138 struct fss_IsPathSupported r_pathsupport_get
;
139 struct fss_GetSupportedVersion r_version_get
;
140 struct fss_SetContext r_context_set
;
141 struct fss_StartShadowCopySet r_scset_start
;
142 struct fss_AddToShadowCopySet r_scset_add
;
143 struct fss_PrepareShadowCopySet r_scset_prep
;
144 struct fss_CommitShadowCopySet r_scset_commit
;
145 struct fss_ExposeShadowCopySet r_scset_expose
;
146 struct fss_GetShareMapping r_sharemap_get
;
147 struct dcerpc_binding_handle
*b
= p
->binding_handle
;
150 TALLOC_CTX
*tmp_ctx
= talloc_new(tctx
);
151 struct fssagent_share_mapping_1
*map
;
154 * PrepareShadowCopySet & CommitShadowCopySet often exceed the default
155 * 60 second dcerpc request timeout against Windows Server "8" Beta.
157 dcerpc_binding_handle_set_timeout(b
, 240);
159 ZERO_STRUCT(r_pathsupport_get
); /* sending with zeroed magic */
160 r_pathsupport_get
.in
.ShareName
= share
;
161 status
= dcerpc_fss_IsPathSupported_r(b
, tmp_ctx
, &r_pathsupport_get
);
162 torture_assert_ntstatus_ok(tctx
, status
,
163 "IsPathSupported failed");
164 torture_assert_int_equal(tctx
, r_pathsupport_get
.out
.result
, 0,
165 "failed IsPathSupported response");
166 torture_assert(tctx
, r_pathsupport_get
.out
.SupportedByThisProvider
,
167 "path not supported");
169 ZERO_STRUCT(r_version_get
); /* sending with zeroed magic */
170 status
= dcerpc_fss_GetSupportedVersion_r(b
, tmp_ctx
, &r_version_get
);
171 torture_assert_ntstatus_ok(tctx
, status
,
172 "GetSupportedVersion failed without magic");
173 torture_assert_int_equal(tctx
, r_version_get
.out
.result
, 0,
174 "failed GetSupportedVersion response");
176 ZERO_STRUCT(r_context_set
);
177 r_context_set
.in
.Context
= FSRVP_CTX_BACKUP
;
178 status
= dcerpc_fss_SetContext_r(b
, tmp_ctx
, &r_context_set
);
179 torture_assert_ntstatus_ok(tctx
, status
, "SetContext failed");
180 torture_assert_int_equal(tctx
, r_context_set
.out
.result
, 0,
181 "failed SetContext response");
183 ZERO_STRUCT(r_scset_start
);
184 r_scset_start
.in
.ClientShadowCopySetId
= GUID_random();
185 status
= dcerpc_fss_StartShadowCopySet_r(b
, tmp_ctx
, &r_scset_start
);
186 torture_assert_ntstatus_ok(tctx
, status
,
187 "StartShadowCopySet failed");
188 torture_assert_int_equal(tctx
, r_scset_start
.out
.result
, 0,
189 "failed StartShadowCopySet response");
190 torture_comment(tctx
, "%s: shadow-copy set created\n",
191 GUID_string(tmp_ctx
, r_scset_start
.out
.pShadowCopySetId
));
193 ZERO_STRUCT(r_scset_add
);
194 r_scset_add
.in
.ClientShadowCopyId
= GUID_random();
195 r_scset_add
.in
.ShadowCopySetId
= *r_scset_start
.out
.pShadowCopySetId
;
196 r_scset_add
.in
.ShareName
= share
;
197 status
= dcerpc_fss_AddToShadowCopySet_r(b
, tmp_ctx
, &r_scset_add
);
198 torture_assert_ntstatus_ok(tctx
, status
,
199 "AddToShadowCopySet failed");
200 torture_assert_int_equal(tctx
, r_scset_add
.out
.result
, 0,
201 "failed AddToShadowCopySet response");
202 torture_comment(tctx
, "%s(%s): %s added to shadow-copy set\n",
203 GUID_string(tmp_ctx
, r_scset_start
.out
.pShadowCopySetId
),
204 GUID_string(tmp_ctx
, r_scset_add
.out
.pShadowCopyId
),
205 r_scset_add
.in
.ShareName
);
207 start_time
= time_mono(NULL
);
208 ZERO_STRUCT(r_scset_prep
);
209 r_scset_prep
.in
.ShadowCopySetId
= *r_scset_start
.out
.pShadowCopySetId
;
210 // r_scset_prep.in.TimeOutInMilliseconds = (1800 * 1000); /* win8 */
211 r_scset_prep
.in
.TimeOutInMilliseconds
= (240 * 1000);
212 status
= dcerpc_fss_PrepareShadowCopySet_r(b
, tmp_ctx
, &r_scset_prep
);
213 torture_assert_ntstatus_ok(tctx
, status
,
214 "PrepareShadowCopySet failed");
215 torture_assert_int_equal(tctx
, r_scset_prep
.out
.result
, 0,
216 "failed PrepareShadowCopySet response");
217 torture_comment(tctx
, "%s: prepare completed in %llu secs\n",
218 GUID_string(tmp_ctx
, r_scset_start
.out
.pShadowCopySetId
),
219 (unsigned long long)(time_mono(NULL
) - start_time
));
221 start_time
= time_mono(NULL
);
222 ZERO_STRUCT(r_scset_commit
);
223 r_scset_commit
.in
.ShadowCopySetId
= *r_scset_start
.out
.pShadowCopySetId
;
224 r_scset_commit
.in
.TimeOutInMilliseconds
= (180 * 1000); /* win8 */
225 status
= dcerpc_fss_CommitShadowCopySet_r(b
, tmp_ctx
, &r_scset_commit
);
226 torture_assert_ntstatus_ok(tctx
, status
,
227 "CommitShadowCopySet failed");
228 torture_assert_int_equal(tctx
, r_scset_commit
.out
.result
, 0,
229 "failed CommitShadowCopySet response");
230 torture_comment(tctx
, "%s: commit completed in %llu secs\n",
231 GUID_string(tmp_ctx
, r_scset_start
.out
.pShadowCopySetId
),
232 (unsigned long long)(time_mono(NULL
) - start_time
));
234 start_time
= time_mono(NULL
);
235 ZERO_STRUCT(r_scset_expose
);
236 r_scset_expose
.in
.ShadowCopySetId
= *r_scset_start
.out
.pShadowCopySetId
;
237 r_scset_expose
.in
.TimeOutInMilliseconds
= (120 * 1000); /* win8 */
238 status
= dcerpc_fss_ExposeShadowCopySet_r(b
, tmp_ctx
, &r_scset_expose
);
239 torture_assert_ntstatus_ok(tctx
, status
,
240 "ExposeShadowCopySet failed");
241 torture_assert_int_equal(tctx
, r_scset_expose
.out
.result
, 0,
242 "failed ExposeShadowCopySet response");
243 torture_comment(tctx
, "%s: expose completed in %llu secs\n",
244 GUID_string(tmp_ctx
, r_scset_start
.out
.pShadowCopySetId
),
245 (unsigned long long)(time_mono(NULL
) - start_time
));
247 ZERO_STRUCT(r_sharemap_get
);
248 r_sharemap_get
.in
.ShadowCopyId
= *r_scset_add
.out
.pShadowCopyId
;
249 r_sharemap_get
.in
.ShadowCopySetId
= *r_scset_start
.out
.pShadowCopySetId
;
250 r_sharemap_get
.in
.ShareName
= r_scset_add
.in
.ShareName
;
251 r_sharemap_get
.in
.Level
= 1;
252 status
= dcerpc_fss_GetShareMapping_r(b
, tmp_ctx
, &r_sharemap_get
);
253 torture_assert_ntstatus_ok(tctx
, status
, "GetShareMapping failed");
254 torture_assert_int_equal(tctx
, r_sharemap_get
.out
.result
, 0,
255 "failed GetShareMapping response");
256 torture_comment(tctx
, "%s(%s): %s is a snapshot of %s at %s\n",
257 GUID_string(tmp_ctx
, &r_sharemap_get
.out
.ShareMapping
->ShareMapping1
->ShadowCopySetId
),
258 GUID_string(tmp_ctx
, &r_sharemap_get
.out
.ShareMapping
->ShareMapping1
->ShadowCopyId
),
259 r_sharemap_get
.out
.ShareMapping
->ShareMapping1
->ShadowCopyShareName
,
260 r_sharemap_get
.out
.ShareMapping
->ShareMapping1
->ShareNameUNC
,
261 nt_time_string(tmp_ctx
, r_sharemap_get
.out
.ShareMapping
->ShareMapping1
->tstamp
));
263 map
= talloc_zero(tctx
, struct fssagent_share_mapping_1
);
264 map
->ShadowCopySetId
= r_sharemap_get
.out
.ShareMapping
->ShareMapping1
->ShadowCopySetId
;
265 map
->ShadowCopyId
= r_sharemap_get
.out
.ShareMapping
->ShareMapping1
->ShadowCopyId
;
266 map
->ShadowCopyShareName
267 = talloc_strdup(tctx
, r_sharemap_get
.out
.ShareMapping
->ShareMapping1
->ShadowCopyShareName
);
269 = talloc_strdup(tctx
, r_sharemap_get
.out
.ShareMapping
->ShareMapping1
->ShareNameUNC
);
270 map
->tstamp
= r_sharemap_get
.out
.ShareMapping
->ShareMapping1
->tstamp
;
272 torture_assert(tctx
, !GUID_compare(&r_sharemap_get
.in
.ShadowCopySetId
,
273 &map
->ShadowCopySetId
),
274 "sc_set GUID missmatch in GetShareMapping");
275 torture_assert(tctx
, !GUID_compare(&r_sharemap_get
.in
.ShadowCopyId
,
277 "sc GUID missmatch in GetShareMapping");
279 talloc_free(tmp_ctx
);
285 static bool test_fsrvp_sc_delete(struct torture_context
*tctx
,
286 struct dcerpc_pipe
*p
,
287 struct fssagent_share_mapping_1
*sc_map
)
289 struct dcerpc_binding_handle
*b
= p
->binding_handle
;
290 struct fss_DeleteShareMapping r_sharemap_del
;
293 ZERO_STRUCT(r_sharemap_del
);
294 r_sharemap_del
.in
.ShadowCopySetId
= sc_map
->ShadowCopySetId
;
295 r_sharemap_del
.in
.ShadowCopyId
= sc_map
->ShadowCopyId
;
296 r_sharemap_del
.in
.ShareName
= sc_map
->ShareNameUNC
;
297 status
= dcerpc_fss_DeleteShareMapping_r(b
, tctx
, &r_sharemap_del
);
298 torture_assert_ntstatus_ok(tctx
, status
, "DeleteShareMapping failed");
299 torture_assert_int_equal(tctx
, r_sharemap_del
.out
.result
, 0,
300 "failed DeleteShareMapping response");
305 static bool test_fsrvp_sc_create_simple(struct torture_context
*tctx
,
306 struct dcerpc_pipe
*p
)
308 struct fssagent_share_mapping_1
*sc_map
;
309 char *share_unc
= talloc_asprintf(tctx
, "\\\\%s\\%s",
310 dcerpc_server_name(p
), FSHARE
);
312 torture_assert(tctx
, test_fsrvp_sc_create(tctx
, p
, share_unc
, &sc_map
),
315 torture_assert(tctx
, test_fsrvp_sc_delete(tctx
, p
, sc_map
), "sc del");
320 static bool test_fsrvp_sc_set_abort(struct torture_context
*tctx
,
321 struct dcerpc_pipe
*p
)
323 char *share_unc
= talloc_asprintf(tctx
, "\\\\%s\\%s",
324 dcerpc_server_name(p
), FSHARE
);
325 struct dcerpc_binding_handle
*b
= p
->binding_handle
;
326 struct fss_IsPathSupported r_pathsupport_get
;
327 struct fss_GetSupportedVersion r_version_get
;
328 struct fss_SetContext r_context_set
;
329 struct fss_StartShadowCopySet r_scset_start
;
330 struct fss_AbortShadowCopySet r_scset_abort
;
331 struct fss_AddToShadowCopySet r_scset_add
;
333 TALLOC_CTX
*tmp_ctx
= talloc_new(tctx
);
335 ZERO_STRUCT(r_pathsupport_get
); /* sending with zeroed magic */
336 r_pathsupport_get
.in
.ShareName
= share_unc
;
337 status
= dcerpc_fss_IsPathSupported_r(b
, tmp_ctx
, &r_pathsupport_get
);
338 torture_assert_ntstatus_ok(tctx
, status
,
339 "IsPathSupported failed");
340 torture_assert(tctx
, r_pathsupport_get
.out
.SupportedByThisProvider
,
341 "path not supported");
343 ZERO_STRUCT(r_version_get
); /* sending with zeroed magic */
344 status
= dcerpc_fss_GetSupportedVersion_r(b
, tmp_ctx
, &r_version_get
);
345 torture_assert_ntstatus_ok(tctx
, status
,
346 "GetSupportedVersion failed without magic");
348 ZERO_STRUCT(r_context_set
);
349 r_context_set
.in
.Context
= FSRVP_CTX_BACKUP
;
350 status
= dcerpc_fss_SetContext_r(b
, tmp_ctx
, &r_context_set
);
351 torture_assert_ntstatus_ok(tctx
, status
, "SetContext failed");
353 ZERO_STRUCT(r_scset_start
);
354 r_scset_start
.in
.ClientShadowCopySetId
= GUID_random();
355 status
= dcerpc_fss_StartShadowCopySet_r(b
, tmp_ctx
, &r_scset_start
);
356 torture_assert_ntstatus_ok(tctx
, status
,
357 "StartShadowCopySet failed");
359 ZERO_STRUCT(r_scset_abort
);
360 r_scset_abort
.in
.ShadowCopySetId
= *r_scset_start
.out
.pShadowCopySetId
;
361 status
= dcerpc_fss_AbortShadowCopySet_r(b
, tmp_ctx
, &r_scset_abort
);
362 torture_assert_ntstatus_ok(tctx
, status
,
363 "AbortShadowCopySet failed");
365 ZERO_STRUCT(r_scset_add
);
366 r_scset_add
.in
.ClientShadowCopyId
= GUID_random();
367 r_scset_add
.in
.ShadowCopySetId
= *r_scset_start
.out
.pShadowCopySetId
;
368 r_scset_add
.in
.ShareName
= share_unc
;
369 status
= dcerpc_fss_AddToShadowCopySet_r(b
, tmp_ctx
, &r_scset_add
);
370 torture_assert_ntstatus_ok(tctx
, status
, "AddToShadowCopySet failed "
373 * XXX Windows 8 server beta returns FSRVP_E_BAD_STATE here rather than
374 * FSRVP_E_BAD_ID / E_INVALIDARG.
376 torture_assert(tctx
, (r_scset_add
.out
.result
!= 0),
377 "incorrect AddToShadowCopySet response following abort");
379 talloc_free(tmp_ctx
);
383 static bool test_fsrvp_bad_id(struct torture_context
*tctx
,
384 struct dcerpc_pipe
*p
)
386 struct fssagent_share_mapping_1
*sc_map
;
387 struct dcerpc_binding_handle
*b
= p
->binding_handle
;
388 struct fss_DeleteShareMapping r_sharemap_del
;
390 TALLOC_CTX
*tmp_ctx
= talloc_new(tctx
);
391 char *share_unc
= talloc_asprintf(tmp_ctx
, "\\\\%s\\%s",
392 dcerpc_server_name(p
), FSHARE
);
394 torture_assert(tctx
, test_fsrvp_sc_create(tctx
, p
, share_unc
, &sc_map
),
397 ZERO_STRUCT(r_sharemap_del
);
398 r_sharemap_del
.in
.ShadowCopySetId
= sc_map
->ShadowCopySetId
;
399 r_sharemap_del
.in
.ShadowCopySetId
.time_low
++; /* bogus */
400 r_sharemap_del
.in
.ShadowCopyId
= sc_map
->ShadowCopyId
;
401 r_sharemap_del
.in
.ShareName
= sc_map
->ShareNameUNC
;
402 status
= dcerpc_fss_DeleteShareMapping_r(b
, tmp_ctx
, &r_sharemap_del
);
403 torture_assert_ntstatus_ok(tctx
, status
,
404 "DeleteShareMapping failed");
405 torture_assert_int_equal(tctx
, r_sharemap_del
.out
.result
,
407 "incorrect DeleteShareMapping response");
409 r_sharemap_del
.in
.ShadowCopySetId
= sc_map
->ShadowCopySetId
;
410 r_sharemap_del
.in
.ShadowCopyId
.time_mid
++; /* bogus */
411 status
= dcerpc_fss_DeleteShareMapping_r(b
, tmp_ctx
, &r_sharemap_del
);
412 torture_assert_ntstatus_ok(tctx
, status
,
413 "DeleteShareMapping failed");
414 torture_assert_int_equal(tctx
, r_sharemap_del
.out
.result
,
416 "incorrect DeleteShareMapping response");
418 torture_assert(tctx
, test_fsrvp_sc_delete(tctx
, p
, sc_map
), "sc del");
421 talloc_free(tmp_ctx
);
426 static bool test_fsrvp_sc_share_io(struct torture_context
*tctx
,
427 struct dcerpc_pipe
*p
)
429 struct fssagent_share_mapping_1
*sc_map
;
431 TALLOC_CTX
*tmp_ctx
= talloc_new(tctx
);
432 char *share_unc
= talloc_asprintf(tmp_ctx
, "\\\\%s\\%s",
433 dcerpc_server_name(p
), FSHARE
);
434 extern struct cli_credentials
*cmdline_credentials
;
435 struct smb2_tree
*tree_base
;
436 struct smb2_tree
*tree_snap
;
437 struct smbcli_options options
;
438 struct smb2_handle base_fh
;
440 struct smb2_create io
;
441 lpcfg_smbcli_options(tctx
->lp_ctx
, &options
);
443 status
= smb2_connect(tmp_ctx
,
444 dcerpc_server_name(p
),
445 lpcfg_smb_ports(tctx
->lp_ctx
),
447 lpcfg_resolve_context(tctx
->lp_ctx
),
452 lpcfg_socket_options(tctx
->lp_ctx
),
453 lpcfg_gensec_settings(tctx
, tctx
->lp_ctx
));
454 torture_assert_ntstatus_ok(tctx
, status
,
455 "Failed to connect to SMB2 share");
457 smb2_util_unlink(tree_base
, FNAME
);
458 status
= torture_smb2_testfile(tree_base
, FNAME
, &base_fh
);
459 torture_assert_ntstatus_ok(tctx
, status
, "base write open");
461 status
= smb2_util_write(tree_base
, base_fh
, "pre-snap", 0,
463 torture_assert_ntstatus_ok(tctx
, status
, "src write");
466 torture_assert(tctx
, test_fsrvp_sc_create(tctx
, p
, share_unc
, &sc_map
),
469 status
= smb2_util_write(tree_base
, base_fh
, "post-snap", 0,
470 sizeof("post-snap"));
471 torture_assert_ntstatus_ok(tctx
, status
, "base write");
473 /* connect to snapshot share and verify pre-snapshot data */
474 status
= smb2_connect(tmp_ctx
,
475 dcerpc_server_name(p
),
476 lpcfg_smb_ports(tctx
->lp_ctx
),
477 sc_map
->ShadowCopyShareName
,
478 lpcfg_resolve_context(tctx
->lp_ctx
),
483 lpcfg_socket_options(tctx
->lp_ctx
),
484 lpcfg_gensec_settings(tctx
, tctx
->lp_ctx
));
485 torture_assert_ntstatus_ok(tctx
, status
,
486 "Failed to connect to SMB2 shadow-copy share");
487 /* Windows server 8 allows RW open to succeed here for a ro snapshot */
489 io
.in
.desired_access
= SEC_RIGHTS_FILE_READ
;
490 io
.in
.file_attributes
= FILE_ATTRIBUTE_NORMAL
;
491 io
.in
.create_disposition
= NTCREATEX_DISP_OPEN_IF
;
493 NTCREATEX_SHARE_ACCESS_DELETE
|
494 NTCREATEX_SHARE_ACCESS_READ
|
495 NTCREATEX_SHARE_ACCESS_WRITE
;
496 io
.in
.create_options
= 0;
498 status
= smb2_create(tree_snap
, tmp_ctx
, &io
);
499 torture_assert_ntstatus_ok(tctx
, status
, "snap read open");
502 r
.in
.file
.handle
= io
.out
.file
.handle
;
503 r
.in
.length
= sizeof("pre-snap");
504 status
= smb2_read(tree_snap
, tmp_ctx
, &r
);
505 torture_assert_ntstatus_ok(tctx
, status
, "read");
506 torture_assert_u64_equal(tctx
, r
.out
.data
.length
, r
.in
.length
,
507 "read data len mismatch");
508 torture_assert_str_equal(tctx
, (char *)r
.out
.data
.data
, "pre-snap",
509 "bad snapshot data");
511 torture_assert(tctx
, test_fsrvp_sc_delete(tctx
, p
, sc_map
), "sc del");
514 talloc_free(tmp_ctx
);
519 static bool fsrvp_rpc_setup (struct torture_context
*tctx
, void **data
)
522 struct torture_rpc_tcase
*tcase
= talloc_get_type(
523 tctx
->active_tcase
, struct torture_rpc_tcase
);
524 struct torture_rpc_tcase_data
*tcase_data
;
525 extern struct cli_credentials
*cmdline_credentials
;
527 *data
= tcase_data
= talloc_zero(tctx
, struct torture_rpc_tcase_data
);
528 tcase_data
->credentials
= cmdline_credentials
;
530 status
= torture_rpc_connection(tctx
,
534 torture_assert_ntstatus_ok(tctx
, status
, "Error connecting to server");
536 /* XXX required, otherwise ndr out ptrs are not allocated */
537 tcase_data
->pipe
->conn
->flags
|= DCERPC_NDR_REF_ALLOC
;
543 testing of FSRVP (FSS agent)
545 struct torture_suite
*torture_rpc_fsrvp(TALLOC_CTX
*mem_ctx
)
547 struct torture_suite
*suite
= torture_suite_create(mem_ctx
, "fsrvp");
549 struct torture_rpc_tcase
*tcase
550 = torture_suite_add_rpc_iface_tcase(suite
, "fsrvp",
551 &ndr_table_FileServerVssAgent
);
552 /* override torture_rpc_setup() to set DCERPC_NDR_REF_ALLOC */
553 tcase
->tcase
.setup
= fsrvp_rpc_setup
;
555 torture_rpc_tcase_add_test(tcase
, "sc_share_io",
556 test_fsrvp_sc_share_io
);
557 torture_rpc_tcase_add_test(tcase
, "bad_id",
559 torture_rpc_tcase_add_test(tcase
, "sc_set_abort",
560 test_fsrvp_sc_set_abort
);
561 torture_rpc_tcase_add_test(tcase
, "create_simple",
562 test_fsrvp_sc_create_simple
);
563 torture_rpc_tcase_add_test(tcase
, "set_ctx",
565 torture_rpc_tcase_add_test(tcase
, "get_version",
566 test_fsrvp_get_version
);
567 torture_rpc_tcase_add_test(tcase
, "is_path_supported",
568 test_fsrvp_is_path_supported
);