2 Unix SMB/CIFS implementation.
6 Copyright (C) Andrew Tridgell 2003
7 Copyright (C) Stefan (metze) Metzmacher 2004
8 Copyright (C) Andrew Bartlett <abartlet@samba.org> 2005-2006
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 3 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
25 #include "torture/torture.h"
26 #include "librpc/gen_ndr/ndr_drsuapi_c.h"
27 #include "torture/rpc/rpc.h"
28 #include "param/param.h"
30 #define TEST_MACHINE_NAME "torturetest"
32 bool test_DsBind(struct dcerpc_pipe *p, struct torture_context *tctx,
33 struct DsPrivate *priv)
36 struct drsuapi_DsBind r;
38 GUID_from_string(DRSUAPI_DS_BIND_GUID, &priv->bind_guid);
40 r.in.bind_guid = &priv->bind_guid;
41 r.in.bind_info = NULL;
42 r.out.bind_handle = &priv->bind_handle;
44 torture_comment(tctx, "testing DsBind\n");
46 status = dcerpc_drsuapi_DsBind(p, tctx, &r);
47 if (!NT_STATUS_IS_OK(status)) {
48 const char *errstr = nt_errstr(status);
49 if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
50 errstr = dcerpc_errstr(tctx, p->last_fault_code);
52 torture_fail(tctx, "dcerpc_drsuapi_DsBind failed");
53 } else if (!W_ERROR_IS_OK(r.out.result)) {
54 torture_fail(tctx, "DsBind failed");
60 static bool test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, struct torture_context *torture,
61 struct DsPrivate *priv)
64 struct drsuapi_DsGetDomainControllerInfo r;
73 .name = torture_join_dom_netbios_name(priv->join),
77 .name = torture_join_dom_dns_name(priv->join),
81 .name = "__UNKNOWN_DOMAIN__",
82 .expected = WERR_DS_OBJ_NOT_FOUND
85 .name = "unknown.domain.samba.example.com",
86 .expected = WERR_DS_OBJ_NOT_FOUND
89 int levels[] = {1, 2};
92 for (i=0; i < ARRAY_SIZE(levels); i++) {
93 for (j=0; j < ARRAY_SIZE(names); j++) {
95 r.in.bind_handle = &priv->bind_handle;
98 r.in.req.req1.domain_name = names[j].name;
99 r.in.req.req1.level = level;
101 torture_comment(torture,
102 "testing DsGetDomainControllerInfo level %d on domainname '%s'\n",
103 r.in.req.req1.level, r.in.req.req1.domain_name);
105 status = dcerpc_drsuapi_DsGetDomainControllerInfo(p, torture, &r);
106 torture_assert_ntstatus_ok(torture, status,
107 "dcerpc_drsuapi_DsGetDomainControllerInfo with dns domain failed");
108 torture_assert_werr_equal(torture,
109 r.out.result, names[j].expected,
110 "DsGetDomainControllerInfo level with dns domain failed");
112 if (!W_ERROR_IS_OK(r.out.result)) {
113 /* If this was an error, we can't read the result structure */
117 torture_assert_int_equal(torture,
118 r.in.req.req1.level, r.out.level_out,
119 "dcerpc_drsuapi_DsGetDomainControllerInfo level");
123 for (k=0; k < r.out.ctr.ctr1.count; k++) {
124 if (strcasecmp_m(r.out.ctr.ctr1.array[k].netbios_name,
125 torture_join_netbios_name(priv->join)) == 0) {
132 for (k=0; k < r.out.ctr.ctr2.count; k++) {
133 if (strcasecmp_m(r.out.ctr.ctr2.array[k].netbios_name,
134 torture_join_netbios_name(priv->join)) == 0) {
136 priv->dcinfo = r.out.ctr.ctr2.array[k];
142 torture_assert(torture, found,
143 "dcerpc_drsuapi_DsGetDomainControllerInfo: Failed to find the domain controller we just created during the join");
147 r.in.bind_handle = &priv->bind_handle;
150 r.in.req.req1.domain_name = "__UNKNOWN_DOMAIN__"; /* This is clearly ignored for this level */
151 r.in.req.req1.level = -1;
153 printf("testing DsGetDomainControllerInfo level %d on domainname '%s'\n",
154 r.in.req.req1.level, r.in.req.req1.domain_name);
156 status = dcerpc_drsuapi_DsGetDomainControllerInfo(p, torture, &r);
158 torture_assert_ntstatus_ok(torture, status,
159 "dcerpc_drsuapi_DsGetDomainControllerInfo with dns domain failed");
160 torture_assert_werr_ok(torture, r.out.result,
161 "DsGetDomainControllerInfo with dns domain failed");
164 const char *dc_account = talloc_asprintf(torture, "%s\\%s$",
165 torture_join_dom_netbios_name(priv->join),
166 priv->dcinfo.netbios_name);
167 for (k=0; k < r.out.ctr.ctr01.count; k++) {
168 if (strcasecmp_m(r.out.ctr.ctr01.array[k].client_account,
174 torture_assert(torture, found,
175 "dcerpc_drsuapi_DsGetDomainControllerInfo level: Failed to find the domain controller in last logon records");
182 static bool test_DsWriteAccountSpn(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
183 struct DsPrivate *priv)
186 struct drsuapi_DsWriteAccountSpn r;
187 struct drsuapi_DsNameString names[2];
190 r.in.bind_handle = &priv->bind_handle;
193 printf("testing DsWriteAccountSpn\n");
195 r.in.req.req1.operation = DRSUAPI_DS_SPN_OPERATION_ADD;
196 r.in.req.req1.unknown1 = 0;
197 r.in.req.req1.object_dn = priv->dcinfo.computer_dn;
198 r.in.req.req1.count = 2;
199 r.in.req.req1.spn_names = names;
200 names[0].str = talloc_asprintf(mem_ctx, "smbtortureSPN/%s",priv->dcinfo.netbios_name);
201 names[1].str = talloc_asprintf(mem_ctx, "smbtortureSPN/%s",priv->dcinfo.dns_name);
203 status = dcerpc_drsuapi_DsWriteAccountSpn(p, mem_ctx, &r);
204 if (!NT_STATUS_IS_OK(status)) {
205 const char *errstr = nt_errstr(status);
206 if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
207 errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
209 printf("dcerpc_drsuapi_DsWriteAccountSpn failed - %s\n", errstr);
211 } else if (!W_ERROR_IS_OK(r.out.result)) {
212 printf("DsWriteAccountSpn failed - %s\n", win_errstr(r.out.result));
216 r.in.req.req1.operation = DRSUAPI_DS_SPN_OPERATION_DELETE;
217 r.in.req.req1.unknown1 = 0;
219 status = dcerpc_drsuapi_DsWriteAccountSpn(p, mem_ctx, &r);
220 if (!NT_STATUS_IS_OK(status)) {
221 const char *errstr = nt_errstr(status);
222 if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
223 errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
225 printf("dcerpc_drsuapi_DsWriteAccountSpn failed - %s\n", errstr);
227 } else if (!W_ERROR_IS_OK(r.out.result)) {
228 printf("DsWriteAccountSpn failed - %s\n", win_errstr(r.out.result));
235 static bool test_DsReplicaGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
236 struct DsPrivate *priv)
239 struct drsuapi_DsReplicaGetInfo r;
248 DRSUAPI_DS_REPLICA_GET_INFO,
249 DRSUAPI_DS_REPLICA_INFO_NEIGHBORS,
252 DRSUAPI_DS_REPLICA_GET_INFO,
253 DRSUAPI_DS_REPLICA_INFO_CURSORS,
256 DRSUAPI_DS_REPLICA_GET_INFO,
257 DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA,
260 DRSUAPI_DS_REPLICA_GET_INFO,
261 DRSUAPI_DS_REPLICA_INFO_KCC_DSA_CONNECT_FAILURES,
264 DRSUAPI_DS_REPLICA_GET_INFO,
265 DRSUAPI_DS_REPLICA_INFO_KCC_DSA_LINK_FAILURES,
268 DRSUAPI_DS_REPLICA_GET_INFO,
269 DRSUAPI_DS_REPLICA_INFO_PENDING_OPS,
272 DRSUAPI_DS_REPLICA_GET_INFO2,
273 DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA,
276 DRSUAPI_DS_REPLICA_GET_INFO2,
277 DRSUAPI_DS_REPLICA_INFO_CURSORS2,
280 DRSUAPI_DS_REPLICA_GET_INFO2,
281 DRSUAPI_DS_REPLICA_INFO_CURSORS3,
284 DRSUAPI_DS_REPLICA_GET_INFO2,
285 DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2,
288 DRSUAPI_DS_REPLICA_GET_INFO2,
289 DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2,
292 DRSUAPI_DS_REPLICA_GET_INFO2,
293 DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02,
296 DRSUAPI_DS_REPLICA_GET_INFO2,
297 DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04,
300 DRSUAPI_DS_REPLICA_GET_INFO2,
301 DRSUAPI_DS_REPLICA_INFO_CURSORS05,
304 DRSUAPI_DS_REPLICA_GET_INFO2,
305 DRSUAPI_DS_REPLICA_INFO_06,
310 if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
311 printf("skipping DsReplicaGetInfo test against Samba4\n");
315 r.in.bind_handle = &priv->bind_handle;
317 for (i=0; i < ARRAY_SIZE(array); i++) {
318 const char *object_dn;
320 printf("testing DsReplicaGetInfo level %d infotype %d\n",
321 array[i].level, array[i].infotype);
323 object_dn = (array[i].obj_dn ? array[i].obj_dn : priv->domain_obj_dn);
325 r.in.level = array[i].level;
327 case DRSUAPI_DS_REPLICA_GET_INFO:
328 r.in.req.req1.info_type = array[i].infotype;
329 r.in.req.req1.object_dn = object_dn;
330 ZERO_STRUCT(r.in.req.req1.guid1);
332 case DRSUAPI_DS_REPLICA_GET_INFO2:
333 r.in.req.req2.info_type = array[i].infotype;
334 r.in.req.req2.object_dn = object_dn;
335 ZERO_STRUCT(r.in.req.req1.guid1);
336 r.in.req.req2.unknown1 = 0;
337 r.in.req.req2.string1 = NULL;
338 r.in.req.req2.string2 = NULL;
339 r.in.req.req2.unknown2 = 0;
343 status = dcerpc_drsuapi_DsReplicaGetInfo(p, mem_ctx, &r);
344 if (!NT_STATUS_IS_OK(status)) {
345 const char *errstr = nt_errstr(status);
346 if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
347 errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
349 if (p->last_fault_code != DCERPC_FAULT_INVALID_TAG) {
350 printf("dcerpc_drsuapi_DsReplicaGetInfo failed - %s\n", errstr);
353 printf("DsReplicaGetInfo level %d and/or infotype %d not supported by server\n",
354 array[i].level, array[i].infotype);
356 } else if (!W_ERROR_IS_OK(r.out.result)) {
357 printf("DsReplicaGetInfo failed - %s\n", win_errstr(r.out.result));
365 static bool test_DsReplicaSync(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
366 struct DsPrivate *priv)
371 struct drsuapi_DsReplicaSync r;
372 struct drsuapi_DsReplicaObjectIdentifier nc;
373 struct GUID null_guid;
374 struct dom_sid null_sid;
383 if (!lp_parm_bool(global_loadparm, NULL, "torture", "dangerous", false)) {
384 printf("DsReplicaSync disabled - enable dangerous tests to use\n");
388 if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
389 printf("skipping DsReplicaSync test against Samba4\n");
393 ZERO_STRUCT(null_guid);
394 ZERO_STRUCT(null_sid);
396 r.in.bind_handle = &priv->bind_handle;
398 for (i=0; i < ARRAY_SIZE(array); i++) {
399 printf("testing DsReplicaSync level %d\n",
402 r.in.level = array[i].level;
407 nc.dn = priv->domain_obj_dn?priv->domain_obj_dn:"";
409 r.in.req.req1.naming_context = &nc;
410 r.in.req.req1.source_dsa_guid = priv->dcinfo.ntds_guid;
411 r.in.req.req1.other_info = NULL;
412 r.in.req.req1.options = 16;
416 status = dcerpc_drsuapi_DsReplicaSync(p, mem_ctx, &r);
417 if (!NT_STATUS_IS_OK(status)) {
418 const char *errstr = nt_errstr(status);
419 if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
420 errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
422 printf("dcerpc_drsuapi_DsReplicaSync failed - %s\n", errstr);
424 } else if (!W_ERROR_IS_OK(r.out.result)) {
425 printf("DsReplicaSync failed - %s\n", win_errstr(r.out.result));
433 static bool test_DsReplicaUpdateRefs(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
434 struct DsPrivate *priv)
439 struct drsuapi_DsReplicaUpdateRefs r;
440 struct drsuapi_DsReplicaObjectIdentifier nc;
441 struct GUID null_guid;
442 struct dom_sid null_sid;
451 if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
452 printf("skipping DsReplicaUpdateRefs test against Samba4\n");
456 ZERO_STRUCT(null_guid);
457 ZERO_STRUCT(null_sid);
459 r.in.bind_handle = &priv->bind_handle;
461 for (i=0; i < ARRAY_SIZE(array); i++) {
462 printf("testing DsReplicaUpdateRefs level %d\n",
465 r.in.level = array[i].level;
470 nc.dn = priv->domain_obj_dn?priv->domain_obj_dn:"";
472 r.in.req.req1.naming_context = &nc;
473 r.in.req.req1.dest_dsa_dns_name = talloc_asprintf(mem_ctx, "__some_dest_dsa_guid_string._msdn.%s",
474 priv->domain_dns_name);
475 r.in.req.req1.dest_dsa_guid = null_guid;
476 r.in.req.req1.options = 0;
480 status = dcerpc_drsuapi_DsReplicaUpdateRefs(p, mem_ctx, &r);
481 if (!NT_STATUS_IS_OK(status)) {
482 const char *errstr = nt_errstr(status);
483 if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
484 errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
486 printf("dcerpc_drsuapi_DsReplicaUpdateRefs failed - %s\n", errstr);
488 } else if (!W_ERROR_IS_OK(r.out.result)) {
489 printf("DsReplicaUpdateRefs failed - %s\n", win_errstr(r.out.result));
497 static bool test_DsGetNCChanges(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
498 struct DsPrivate *priv)
503 struct drsuapi_DsGetNCChanges r;
504 struct drsuapi_DsReplicaObjectIdentifier nc;
505 struct GUID null_guid;
506 struct dom_sid null_sid;
518 if (lp_parm_bool(global_loadparm, NULL, "torture", "samba4", false)) {
519 printf("skipping DsGetNCChanges test against Samba4\n");
523 ZERO_STRUCT(null_guid);
524 ZERO_STRUCT(null_sid);
526 for (i=0; i < ARRAY_SIZE(array); i++) {
527 printf("testing DsGetNCChanges level %d\n",
530 r.in.bind_handle = &priv->bind_handle;
531 r.in.level = &array[i].level;
533 switch (*r.in.level) {
537 nc.dn = priv->domain_obj_dn?priv->domain_obj_dn:"";
539 r.in.req.req5.destination_dsa_guid = GUID_random();
540 r.in.req.req5.source_dsa_invocation_id = null_guid;
541 r.in.req.req5.naming_context = &nc;
542 r.in.req.req5.highwatermark.tmp_highest_usn = 0;
543 r.in.req.req5.highwatermark.reserved_usn = 0;
544 r.in.req.req5.highwatermark.highest_usn = 0;
545 r.in.req.req5.uptodateness_vector = NULL;
546 r.in.req.req5.replica_flags = 0;
547 if (lp_parm_bool(global_loadparm, NULL, "drsuapi","compression", false)) {
548 r.in.req.req5.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
550 r.in.req.req5.max_object_count = 0;
551 r.in.req.req5.max_ndr_size = 0;
552 r.in.req.req5.unknown4 = 0;
553 r.in.req.req5.h1 = 0;
559 nc.dn = priv->domain_obj_dn?priv->domain_obj_dn:"";
561 r.in.req.req8.destination_dsa_guid = GUID_random();
562 r.in.req.req8.source_dsa_invocation_id = null_guid;
563 r.in.req.req8.naming_context = &nc;
564 r.in.req.req8.highwatermark.tmp_highest_usn = 0;
565 r.in.req.req8.highwatermark.reserved_usn = 0;
566 r.in.req.req8.highwatermark.highest_usn = 0;
567 r.in.req.req8.uptodateness_vector = NULL;
568 r.in.req.req8.replica_flags = 0;
569 if (lp_parm_bool(global_loadparm, NULL, "drsuapi", "compression", false)) {
570 r.in.req.req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
572 if (lp_parm_bool(global_loadparm, NULL, "drsuapi", "neighbour_writeable", true)) {
573 r.in.req.req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE;
575 r.in.req.req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
576 | DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS
577 | DRSUAPI_DS_REPLICA_NEIGHBOUR_RETURN_OBJECT_PARENTS
578 | DRSUAPI_DS_REPLICA_NEIGHBOUR_NEVER_SYNCED
580 r.in.req.req8.max_object_count = 402;
581 r.in.req.req8.max_ndr_size = 402116;
582 r.in.req.req8.unknown4 = 0;
583 r.in.req.req8.h1 = 0;
584 r.in.req.req8.unique_ptr1 = 0;
585 r.in.req.req8.unique_ptr2 = 0;
586 r.in.req.req8.mapping_ctr.num_mappings = 0;
587 r.in.req.req8.mapping_ctr.mappings = NULL;
592 status = dcerpc_drsuapi_DsGetNCChanges(p, mem_ctx, &r);
593 if (!NT_STATUS_IS_OK(status)) {
594 const char *errstr = nt_errstr(status);
595 if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
596 errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
598 printf("dcerpc_drsuapi_DsGetNCChanges failed - %s\n", errstr);
600 } else if (!W_ERROR_IS_OK(r.out.result)) {
601 printf("DsGetNCChanges failed - %s\n", win_errstr(r.out.result));
609 bool test_QuerySitesByCost(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
610 struct DsPrivate *priv)
613 struct drsuapi_QuerySitesByCost r;
616 const char *my_site = "Default-First-Site-Name";
617 const char *remote_site1 = "smbtorture-nonexisting-site1";
618 const char *remote_site2 = "smbtorture-nonexisting-site2";
620 r.in.bind_handle = &priv->bind_handle;
622 r.in.req.req1.site_from = talloc_strdup(mem_ctx, my_site);
623 r.in.req.req1.num_req = 2;
624 r.in.req.req1.site_to = talloc_zero_array(mem_ctx, const char *, r.in.req.req1.num_req);
625 r.in.req.req1.site_to[0] = talloc_strdup(mem_ctx, remote_site1);
626 r.in.req.req1.site_to[1] = talloc_strdup(mem_ctx, remote_site2);
627 r.in.req.req1.flags = 0;
629 status = dcerpc_drsuapi_QuerySitesByCost(p, mem_ctx, &r);
630 if (!NT_STATUS_IS_OK(status)) {
631 const char *errstr = nt_errstr(status);
632 if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
633 errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
635 printf("drsuapi_QuerySitesByCost - %s\n", errstr);
637 } else if (!W_ERROR_IS_OK(r.out.result)) {
638 printf("QuerySitesByCost failed - %s\n", win_errstr(r.out.result));
642 if (W_ERROR_IS_OK(r.out.result)) {
644 if (!W_ERROR_EQUAL(r.out.ctr.ctr1.info[0].error_code, WERR_DS_OBJ_NOT_FOUND) ||
645 !W_ERROR_EQUAL(r.out.ctr.ctr1.info[1].error_code, WERR_DS_OBJ_NOT_FOUND)) {
646 printf("expected error_code WERR_DS_OBJ_NOT_FOUND, got %s\n",
647 win_errstr(r.out.ctr.ctr1.info[0].error_code));
651 if ((r.out.ctr.ctr1.info[0].site_cost != (uint32_t) -1) ||
652 (r.out.ctr.ctr1.info[1].site_cost != (uint32_t) -1)) {
653 printf("expected site_cost %d, got %d\n",
654 (uint32_t) -1, r.out.ctr.ctr1.info[0].site_cost);
664 bool test_DsUnbind(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
665 struct DsPrivate *priv)
668 struct drsuapi_DsUnbind r;
671 r.in.bind_handle = &priv->bind_handle;
672 r.out.bind_handle = &priv->bind_handle;
674 printf("testing DsUnbind\n");
676 status = dcerpc_drsuapi_DsUnbind(p, mem_ctx, &r);
677 if (!NT_STATUS_IS_OK(status)) {
678 const char *errstr = nt_errstr(status);
679 if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
680 errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
682 printf("dcerpc_drsuapi_DsUnbind failed - %s\n", errstr);
684 } else if (!W_ERROR_IS_OK(r.out.result)) {
685 printf("DsBind failed - %s\n", win_errstr(r.out.result));
692 bool torture_rpc_drsuapi(struct torture_context *torture)
695 struct dcerpc_pipe *p;
697 struct DsPrivate priv;
698 struct cli_credentials *machine_credentials;
702 priv.join = torture_join_domain(TEST_MACHINE_NAME, ACB_SVRTRUST,
703 &machine_credentials);
705 torture_fail(torture, "Failed to join as BDC");
708 status = torture_rpc_connection(torture,
711 if (!NT_STATUS_IS_OK(status)) {
712 torture_leave_domain(priv.join);
713 torture_fail(torture, "Unable to connect to DRSUAPI pipe");
716 ret &= test_DsBind(p, torture, &priv);
718 ret &= test_QuerySitesByCost(p, torture, &priv);
720 ret &= test_DsGetDomainControllerInfo(p, torture, &priv);
722 ret &= test_DsCrackNames(p, torture, &priv);
724 ret &= test_DsWriteAccountSpn(p, torture, &priv);
726 ret &= test_DsReplicaGetInfo(p, torture, &priv);
728 ret &= test_DsReplicaSync(p, torture, &priv);
730 ret &= test_DsReplicaUpdateRefs(p, torture, &priv);
732 ret &= test_DsGetNCChanges(p, torture, &priv);
734 ret &= test_DsUnbind(p, torture, &priv);
736 torture_leave_domain(priv.join);
742 bool torture_rpc_drsuapi_cracknames(struct torture_context *torture)
745 struct dcerpc_pipe *p;
747 struct DsPrivate priv;
748 struct cli_credentials *machine_credentials;
750 torture_comment(torture, "Connected to DRSUAPI pipe\n");
754 priv.join = torture_join_domain(TEST_MACHINE_NAME, ACB_SVRTRUST,
755 &machine_credentials);
757 torture_fail(torture, "Failed to join as BDC\n");
760 status = torture_rpc_connection(torture,
763 if (!NT_STATUS_IS_OK(status)) {
764 torture_leave_domain(priv.join);
765 torture_fail(torture, "Unable to connect to DRSUAPI pipe");
768 ret &= test_DsBind(p, torture, &priv);
771 /* We don't care if this fails, we just need some info from it */
772 test_DsGetDomainControllerInfo(p, torture, &priv);
774 ret &= test_DsCrackNames(p, torture, &priv);
776 ret &= test_DsUnbind(p, torture, &priv);
779 torture_leave_domain(priv.join);