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 2 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, write to the Free Software
22 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 #include "torture/torture.h"
27 #include "librpc/gen_ndr/ndr_drsuapi_c.h"
28 #include "torture/rpc/rpc.h"
30 #define TEST_MACHINE_NAME "torturetest"
32 BOOL test_DsBind(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
33 struct DsPrivate *priv)
36 struct drsuapi_DsBind r;
39 GUID_from_string(DRSUAPI_DS_BIND_GUID, &priv->bind_guid);
41 r.in.bind_guid = &priv->bind_guid;
42 r.in.bind_info = NULL;
43 r.out.bind_handle = &priv->bind_handle;
45 printf("testing DsBind\n");
47 status = dcerpc_drsuapi_DsBind(p, mem_ctx, &r);
48 if (!NT_STATUS_IS_OK(status)) {
49 const char *errstr = nt_errstr(status);
50 if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
51 errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
53 printf("dcerpc_drsuapi_DsBind failed - %s\n", errstr);
55 } else if (!W_ERROR_IS_OK(r.out.result)) {
56 printf("DsBind failed - %s\n", win_errstr(r.out.result));
63 static BOOL test_DsGetDomainControllerInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
64 struct DsPrivate *priv)
67 struct drsuapi_DsGetDomainControllerInfo r;
77 .name = torture_join_dom_netbios_name(priv->join),
81 .name = torture_join_dom_dns_name(priv->join),
85 .name = "__UNKNOWN_DOMAIN__",
86 .expected = WERR_DS_OBJ_NOT_FOUND
89 .name = "unknown.domain.samba.example.com",
90 .expected = WERR_DS_OBJ_NOT_FOUND
93 int levels[] = {1, 2};
96 for (i=0; i < ARRAY_SIZE(levels); i++) {
97 for (j=0; j < ARRAY_SIZE(names); j++) {
99 r.in.bind_handle = &priv->bind_handle;
102 r.in.req.req1.domain_name = names[j].name;
103 r.in.req.req1.level = level;
105 printf("testing DsGetDomainControllerInfo level %d on domainname '%s'\n",
106 r.in.req.req1.level, r.in.req.req1.domain_name);
108 status = dcerpc_drsuapi_DsGetDomainControllerInfo(p, mem_ctx, &r);
109 if (!NT_STATUS_IS_OK(status)) {
110 const char *errstr = nt_errstr(status);
111 if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
112 errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
114 printf("dcerpc_drsuapi_DsGetDomainControllerInfo level %d\n"
115 " with dns domain failed - %s\n",
116 r.in.req.req1.level, errstr);
118 } else if (!W_ERROR_EQUAL(r.out.result, names[j].expected)) {
119 printf("DsGetDomainControllerInfo level %d\n"
120 " with dns domain failed - %s, expected %s\n",
121 r.in.req.req1.level, win_errstr(r.out.result),
122 win_errstr(names[j].expected));
126 if (!W_ERROR_IS_OK(r.out.result)) {
127 /* If this was an error, we can't read the result structure */
131 if (r.in.req.req1.level != r.out.level_out) {
132 printf("dcerpc_drsuapi_DsGetDomainControllerInfo level in (%d) != out (%d)\n",
133 r.in.req.req1.level, r.out.level_out);
135 /* We can't safely read the result structure */
140 for (k=0; k < r.out.ctr.ctr1.count; k++) {
141 if (strcasecmp_m(r.out.ctr.ctr1.array[k].netbios_name,
142 torture_join_netbios_name(priv->join)) == 0) {
149 for (k=0; k < r.out.ctr.ctr2.count; k++) {
150 if (strcasecmp_m(r.out.ctr.ctr2.array[k].netbios_name,
151 torture_join_netbios_name(priv->join)) == 0) {
153 priv->dcinfo = r.out.ctr.ctr2.array[k];
160 printf("dcerpc_drsuapi_DsGetDomainControllerInfo level %d: Failed to find the domain controller (%s) we just created during the join\n",
162 torture_join_netbios_name(priv->join));
168 if (lp_parm_bool(-1, "torture", "samba4", False)) {
169 printf("skipping DsGetDomainControllerInfo level -1 test against Samba4\n");
173 r.in.bind_handle = &priv->bind_handle;
176 r.in.req.req1.domain_name = "__UNKNOWN_DOMAIN__"; /* This is clearly ignored for this level */
177 r.in.req.req1.level = -1;
179 printf("testing DsGetDomainControllerInfo level %d on domainname '%s'\n",
180 r.in.req.req1.level, r.in.req.req1.domain_name);
182 status = dcerpc_drsuapi_DsGetDomainControllerInfo(p, mem_ctx, &r);
183 if (!NT_STATUS_IS_OK(status)) {
184 const char *errstr = nt_errstr(status);
185 if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
186 errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
188 printf("dcerpc_drsuapi_DsGetDomainControllerInfo level %d\n"
189 " with dns domain failed - %s\n",
190 r.in.req.req1.level, errstr);
192 } else if (!W_ERROR_IS_OK(r.out.result)) {
193 printf("DsGetDomainControllerInfo level %d\n"
194 " with dns domain failed - %s\n",
195 r.in.req.req1.level, win_errstr(r.out.result));
200 const char *dc_account = talloc_asprintf(mem_ctx, "%s\\%s$",
201 torture_join_dom_netbios_name(priv->join),
202 priv->dcinfo.netbios_name);
203 for (k=0; k < r.out.ctr.ctr01.count; k++) {
204 if (strcasecmp_m(r.out.ctr.ctr01.array[k].client_account,
211 printf("dcerpc_drsuapi_DsGetDomainControllerInfo level %d: Failed to find the domain controller (%s) in last logon records\n",
222 static BOOL test_DsWriteAccountSpn(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
223 struct DsPrivate *priv)
226 struct drsuapi_DsWriteAccountSpn r;
227 struct drsuapi_DsNameString names[2];
230 r.in.bind_handle = &priv->bind_handle;
233 printf("testing DsWriteAccountSpn\n");
235 r.in.req.req1.operation = DRSUAPI_DS_SPN_OPERATION_ADD;
236 r.in.req.req1.unknown1 = 0;
237 r.in.req.req1.object_dn = priv->dcinfo.computer_dn;
238 r.in.req.req1.count = 2;
239 r.in.req.req1.spn_names = names;
240 names[0].str = talloc_asprintf(mem_ctx, "smbtortureSPN/%s",priv->dcinfo.netbios_name);
241 names[1].str = talloc_asprintf(mem_ctx, "smbtortureSPN/%s",priv->dcinfo.dns_name);
243 status = dcerpc_drsuapi_DsWriteAccountSpn(p, mem_ctx, &r);
244 if (!NT_STATUS_IS_OK(status)) {
245 const char *errstr = nt_errstr(status);
246 if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
247 errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
249 printf("dcerpc_drsuapi_DsWriteAccountSpn failed - %s\n", errstr);
251 } else if (!W_ERROR_IS_OK(r.out.result)) {
252 printf("DsWriteAccountSpn failed - %s\n", win_errstr(r.out.result));
256 r.in.req.req1.operation = DRSUAPI_DS_SPN_OPERATION_DELETE;
257 r.in.req.req1.unknown1 = 0;
259 status = dcerpc_drsuapi_DsWriteAccountSpn(p, mem_ctx, &r);
260 if (!NT_STATUS_IS_OK(status)) {
261 const char *errstr = nt_errstr(status);
262 if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
263 errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
265 printf("dcerpc_drsuapi_DsWriteAccountSpn failed - %s\n", errstr);
267 } else if (!W_ERROR_IS_OK(r.out.result)) {
268 printf("DsWriteAccountSpn failed - %s\n", win_errstr(r.out.result));
275 static BOOL test_DsReplicaGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
276 struct DsPrivate *priv)
279 struct drsuapi_DsReplicaGetInfo r;
288 DRSUAPI_DS_REPLICA_GET_INFO,
289 DRSUAPI_DS_REPLICA_INFO_NEIGHBORS,
292 DRSUAPI_DS_REPLICA_GET_INFO,
293 DRSUAPI_DS_REPLICA_INFO_CURSORS,
296 DRSUAPI_DS_REPLICA_GET_INFO,
297 DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA,
300 DRSUAPI_DS_REPLICA_GET_INFO,
301 DRSUAPI_DS_REPLICA_INFO_KCC_DSA_CONNECT_FAILURES,
304 DRSUAPI_DS_REPLICA_GET_INFO,
305 DRSUAPI_DS_REPLICA_INFO_KCC_DSA_LINK_FAILURES,
308 DRSUAPI_DS_REPLICA_GET_INFO,
309 DRSUAPI_DS_REPLICA_INFO_PENDING_OPS,
312 DRSUAPI_DS_REPLICA_GET_INFO2,
313 DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA,
316 DRSUAPI_DS_REPLICA_GET_INFO2,
317 DRSUAPI_DS_REPLICA_INFO_CURSORS2,
320 DRSUAPI_DS_REPLICA_GET_INFO2,
321 DRSUAPI_DS_REPLICA_INFO_CURSORS3,
324 DRSUAPI_DS_REPLICA_GET_INFO2,
325 DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2,
328 DRSUAPI_DS_REPLICA_GET_INFO2,
329 DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2,
332 DRSUAPI_DS_REPLICA_GET_INFO2,
333 DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02,
336 DRSUAPI_DS_REPLICA_GET_INFO2,
337 DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04,
340 DRSUAPI_DS_REPLICA_GET_INFO2,
341 DRSUAPI_DS_REPLICA_INFO_CURSORS05,
344 DRSUAPI_DS_REPLICA_GET_INFO2,
345 DRSUAPI_DS_REPLICA_INFO_06,
350 if (lp_parm_bool(-1, "torture", "samba4", False)) {
351 printf("skipping DsReplicaGetInfo test against Samba4\n");
355 r.in.bind_handle = &priv->bind_handle;
357 for (i=0; i < ARRAY_SIZE(array); i++) {
358 const char *object_dn;
360 printf("testing DsReplicaGetInfo level %d infotype %d\n",
361 array[i].level, array[i].infotype);
363 object_dn = (array[i].obj_dn ? array[i].obj_dn : priv->domain_obj_dn);
365 r.in.level = array[i].level;
367 case DRSUAPI_DS_REPLICA_GET_INFO:
368 r.in.req.req1.info_type = array[i].infotype;
369 r.in.req.req1.object_dn = object_dn;
370 ZERO_STRUCT(r.in.req.req1.guid1);
372 case DRSUAPI_DS_REPLICA_GET_INFO2:
373 r.in.req.req2.info_type = array[i].infotype;
374 r.in.req.req2.object_dn = object_dn;
375 ZERO_STRUCT(r.in.req.req1.guid1);
376 r.in.req.req2.unknown1 = 0;
377 r.in.req.req2.string1 = NULL;
378 r.in.req.req2.string2 = NULL;
379 r.in.req.req2.unknown2 = 0;
383 status = dcerpc_drsuapi_DsReplicaGetInfo(p, mem_ctx, &r);
384 if (!NT_STATUS_IS_OK(status)) {
385 const char *errstr = nt_errstr(status);
386 if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
387 errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
389 if (p->last_fault_code != DCERPC_FAULT_INVALID_TAG) {
390 printf("dcerpc_drsuapi_DsReplicaGetInfo failed - %s\n", errstr);
393 printf("DsReplicaGetInfo level %d and/or infotype %d not supported by server\n",
394 array[i].level, array[i].infotype);
396 } else if (!W_ERROR_IS_OK(r.out.result)) {
397 printf("DsReplicaGetInfo failed - %s\n", win_errstr(r.out.result));
405 static BOOL test_DsReplicaSync(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
406 struct DsPrivate *priv)
411 struct drsuapi_DsReplicaSync r;
412 struct drsuapi_DsReplicaObjectIdentifier nc;
413 struct GUID null_guid;
414 struct dom_sid null_sid;
423 if (!lp_parm_bool(-1, "torture", "dangerous", False)) {
424 printf("DsReplicaSync disabled - enable dangerous tests to use\n");
428 if (lp_parm_bool(-1, "torture", "samba4", False)) {
429 printf("skipping DsReplicaSync test against Samba4\n");
433 ZERO_STRUCT(null_guid);
434 ZERO_STRUCT(null_sid);
436 r.in.bind_handle = &priv->bind_handle;
438 for (i=0; i < ARRAY_SIZE(array); i++) {
439 printf("testing DsReplicaSync level %d\n",
442 r.in.level = array[i].level;
447 nc.dn = priv->domain_obj_dn?priv->domain_obj_dn:"";
449 r.in.req.req1.naming_context = &nc;
450 r.in.req.req1.source_dsa_guid = priv->dcinfo.ntds_guid;
451 r.in.req.req1.other_info = NULL;
452 r.in.req.req1.options = 16;
456 status = dcerpc_drsuapi_DsReplicaSync(p, mem_ctx, &r);
457 if (!NT_STATUS_IS_OK(status)) {
458 const char *errstr = nt_errstr(status);
459 if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
460 errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
462 printf("dcerpc_drsuapi_DsReplicaSync failed - %s\n", errstr);
464 } else if (!W_ERROR_IS_OK(r.out.result)) {
465 printf("DsReplicaSync failed - %s\n", win_errstr(r.out.result));
473 static BOOL test_DsReplicaUpdateRefs(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
474 struct DsPrivate *priv)
479 struct drsuapi_DsReplicaUpdateRefs r;
480 struct drsuapi_DsReplicaObjectIdentifier nc;
481 struct GUID null_guid;
482 struct dom_sid null_sid;
491 if (lp_parm_bool(-1, "torture", "samba4", False)) {
492 printf("skipping DsReplicaUpdateRefs test against Samba4\n");
496 ZERO_STRUCT(null_guid);
497 ZERO_STRUCT(null_sid);
499 r.in.bind_handle = &priv->bind_handle;
501 for (i=0; i < ARRAY_SIZE(array); i++) {
502 printf("testing DsReplicaUpdateRefs level %d\n",
505 r.in.level = array[i].level;
510 nc.dn = priv->domain_obj_dn?priv->domain_obj_dn:"";
512 r.in.req.req1.naming_context = &nc;
513 r.in.req.req1.dest_dsa_dns_name = talloc_asprintf(mem_ctx, "__some_dest_dsa_guid_string._msdn.%s",
514 priv->domain_dns_name);
515 r.in.req.req1.dest_dsa_guid = null_guid;
516 r.in.req.req1.options = 0;
520 status = dcerpc_drsuapi_DsReplicaUpdateRefs(p, mem_ctx, &r);
521 if (!NT_STATUS_IS_OK(status)) {
522 const char *errstr = nt_errstr(status);
523 if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
524 errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
526 printf("dcerpc_drsuapi_DsReplicaUpdateRefs failed - %s\n", errstr);
528 } else if (!W_ERROR_IS_OK(r.out.result)) {
529 printf("DsReplicaUpdateRefs failed - %s\n", win_errstr(r.out.result));
537 static BOOL test_DsGetNCChanges(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
538 struct DsPrivate *priv)
543 struct drsuapi_DsGetNCChanges r;
544 struct drsuapi_DsReplicaObjectIdentifier nc;
545 struct GUID null_guid;
546 struct dom_sid null_sid;
558 if (lp_parm_bool(-1, "torture", "samba4", False)) {
559 printf("skipping DsGetNCChanges test against Samba4\n");
563 ZERO_STRUCT(null_guid);
564 ZERO_STRUCT(null_sid);
566 for (i=0; i < ARRAY_SIZE(array); i++) {
567 printf("testing DsGetNCChanges level %d\n",
570 r.in.bind_handle = &priv->bind_handle;
571 r.in.level = &array[i].level;
573 switch (*r.in.level) {
577 nc.dn = priv->domain_obj_dn?priv->domain_obj_dn:"";
579 r.in.req.req5.destination_dsa_guid = GUID_random();
580 r.in.req.req5.source_dsa_invocation_id = null_guid;
581 r.in.req.req5.naming_context = &nc;
582 r.in.req.req5.highwatermark.tmp_highest_usn = 0;
583 r.in.req.req5.highwatermark.reserved_usn = 0;
584 r.in.req.req5.highwatermark.highest_usn = 0;
585 r.in.req.req5.uptodateness_vector = NULL;
586 r.in.req.req5.replica_flags = 0;
587 if (lp_parm_bool(-1, "drsuapi","compression", False)) {
588 r.in.req.req5.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
590 r.in.req.req5.max_object_count = 0;
591 r.in.req.req5.max_ndr_size = 0;
592 r.in.req.req5.unknown4 = 0;
593 r.in.req.req5.h1 = 0;
599 nc.dn = priv->domain_obj_dn?priv->domain_obj_dn:"";
601 r.in.req.req8.destination_dsa_guid = GUID_random();
602 r.in.req.req8.source_dsa_invocation_id = null_guid;
603 r.in.req.req8.naming_context = &nc;
604 r.in.req.req8.highwatermark.tmp_highest_usn = 0;
605 r.in.req.req8.highwatermark.reserved_usn = 0;
606 r.in.req.req8.highwatermark.highest_usn = 0;
607 r.in.req.req8.uptodateness_vector = NULL;
608 r.in.req.req8.replica_flags = 0;
609 if (lp_parm_bool(-1,"drsuapi","compression",False)) {
610 r.in.req.req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
612 if (lp_parm_bool(-1,"drsuapi","neighbour_writeable",True)) {
613 r.in.req.req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE;
615 r.in.req.req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
616 | DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS
617 | DRSUAPI_DS_REPLICA_NEIGHBOUR_RETURN_OBJECT_PARENTS
618 | DRSUAPI_DS_REPLICA_NEIGHBOUR_NEVER_SYNCED
620 r.in.req.req8.max_object_count = 402;
621 r.in.req.req8.max_ndr_size = 402116;
622 r.in.req.req8.unknown4 = 0;
623 r.in.req.req8.h1 = 0;
624 r.in.req.req8.unique_ptr1 = 0;
625 r.in.req.req8.unique_ptr2 = 0;
626 r.in.req.req8.mapping_ctr.num_mappings = 0;
627 r.in.req.req8.mapping_ctr.mappings = NULL;
632 status = dcerpc_drsuapi_DsGetNCChanges(p, mem_ctx, &r);
633 if (!NT_STATUS_IS_OK(status)) {
634 const char *errstr = nt_errstr(status);
635 if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
636 errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
638 printf("dcerpc_drsuapi_DsGetNCChanges failed - %s\n", errstr);
640 } else if (!W_ERROR_IS_OK(r.out.result)) {
641 printf("DsGetNCChanges failed - %s\n", win_errstr(r.out.result));
649 BOOL test_DsUnbind(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
650 struct DsPrivate *priv)
653 struct drsuapi_DsUnbind r;
656 r.in.bind_handle = &priv->bind_handle;
657 r.out.bind_handle = &priv->bind_handle;
659 printf("testing DsUnbind\n");
661 status = dcerpc_drsuapi_DsUnbind(p, mem_ctx, &r);
662 if (!NT_STATUS_IS_OK(status)) {
663 const char *errstr = nt_errstr(status);
664 if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
665 errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
667 printf("dcerpc_drsuapi_DsUnbind failed - %s\n", errstr);
669 } else if (!W_ERROR_IS_OK(r.out.result)) {
670 printf("DsBind failed - %s\n", win_errstr(r.out.result));
677 BOOL torture_rpc_drsuapi(struct torture_context *torture)
680 struct dcerpc_pipe *p;
683 struct DsPrivate priv;
684 struct cli_credentials *machine_credentials;
686 mem_ctx = talloc_init("torture_rpc_drsuapi");
690 priv.join = torture_join_domain(TEST_MACHINE_NAME, ACB_SVRTRUST,
691 &machine_credentials);
693 talloc_free(mem_ctx);
694 printf("Failed to join as BDC\n");
698 status = torture_rpc_connection(mem_ctx,
700 &dcerpc_table_drsuapi);
701 if (!NT_STATUS_IS_OK(status)) {
702 torture_leave_domain(priv.join);
703 talloc_free(mem_ctx);
707 ret &= test_DsBind(p, mem_ctx, &priv);
709 ret &= test_DsGetDomainControllerInfo(p, mem_ctx, &priv);
711 ret &= test_DsCrackNames(p, mem_ctx, &priv);
713 ret &= test_DsWriteAccountSpn(p, mem_ctx, &priv);
715 ret &= test_DsReplicaGetInfo(p, mem_ctx, &priv);
717 ret &= test_DsReplicaSync(p, mem_ctx, &priv);
719 ret &= test_DsReplicaUpdateRefs(p, mem_ctx, &priv);
721 ret &= test_DsGetNCChanges(p, mem_ctx, &priv);
723 ret &= test_DsUnbind(p, mem_ctx, &priv);
725 talloc_free(mem_ctx);
727 torture_leave_domain(priv.join);
733 BOOL torture_rpc_drsuapi_cracknames(struct torture_context *torture)
736 struct dcerpc_pipe *p;
739 struct DsPrivate priv;
740 struct cli_credentials *machine_credentials;
742 mem_ctx = talloc_init("torture_rpc_drsuapi");
744 printf("Connected to DRAUAPI pipe\n");
748 priv.join = torture_join_domain(TEST_MACHINE_NAME, ACB_SVRTRUST,
749 &machine_credentials);
751 talloc_free(mem_ctx);
752 printf("Failed to join as BDC\n");
756 status = torture_rpc_connection(mem_ctx,
758 &dcerpc_table_drsuapi);
759 if (!NT_STATUS_IS_OK(status)) {
760 torture_leave_domain(priv.join);
761 talloc_free(mem_ctx);
765 ret &= test_DsBind(p, mem_ctx, &priv);
768 /* We don't care if this fails, we just need some info from it */
769 test_DsGetDomainControllerInfo(p, mem_ctx, &priv);
771 ret &= test_DsCrackNames(p, mem_ctx, &priv);
773 ret &= test_DsUnbind(p, mem_ctx, &priv);
775 talloc_free(mem_ctx);
777 torture_leave_domain(priv.join);