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))) {
148 if (r.out.ctr.ctr2.count > 0) {
149 priv->dcinfo = r.out.ctr.ctr2.array[0];
151 for (k=0; k < r.out.ctr.ctr2.count; k++) {
152 if (strcasecmp_m(r.out.ctr.ctr2.array[k].netbios_name,
153 torture_join_netbios_name(priv->join))) {
161 printf("dcerpc_drsuapi_DsGetDomainControllerInfo level %d: Failed to find the domain controller (%s) we just created during the join\n",
163 torture_join_netbios_name(priv->join));
169 if (lp_parm_bool(-1, "torture", "samba4", False)) {
170 printf("skipping DsGetDomainControllerInfo level -1 test against Samba4\n");
174 r.in.bind_handle = &priv->bind_handle;
177 r.in.req.req1.domain_name = "__UNKNOWN_DOMAIN__"; /* This is clearly ignored for this level */
178 r.in.req.req1.level = -1;
180 printf("testing DsGetDomainControllerInfo level %d on domainname '%s'\n",
181 r.in.req.req1.level, r.in.req.req1.domain_name);
183 status = dcerpc_drsuapi_DsGetDomainControllerInfo(p, mem_ctx, &r);
184 if (!NT_STATUS_IS_OK(status)) {
185 const char *errstr = nt_errstr(status);
186 if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
187 errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
189 printf("dcerpc_drsuapi_DsGetDomainControllerInfo level %d\n"
190 " with dns domain failed - %s\n",
191 r.in.req.req1.level, errstr);
193 } else if (!W_ERROR_IS_OK(r.out.result)) {
194 printf("DsGetDomainControllerInfo level %d\n"
195 " with dns domain failed - %s\n",
196 r.in.req.req1.level, win_errstr(r.out.result));
201 const char *dc_account = talloc_asprintf(mem_ctx, "%s\\%s$",
202 torture_join_dom_netbios_name(priv->join),
203 priv->dcinfo.netbios_name);
204 for (k=0; k < r.out.ctr.ctr01.count; k++) {
205 if (strcasecmp_m(r.out.ctr.ctr01.array[k].client_account,
212 printf("dcerpc_drsuapi_DsGetDomainControllerInfo level %d: Failed to find the domain controller (%s) in last logon records\n",
223 static BOOL test_DsWriteAccountSpn(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
224 struct DsPrivate *priv)
227 struct drsuapi_DsWriteAccountSpn r;
228 struct drsuapi_DsNameString names[2];
231 r.in.bind_handle = &priv->bind_handle;
234 printf("testing DsWriteAccountSpn\n");
236 r.in.req.req1.operation = DRSUAPI_DS_SPN_OPERATION_ADD;
237 r.in.req.req1.unknown1 = 0;
238 r.in.req.req1.object_dn = priv->dcinfo.computer_dn;
239 r.in.req.req1.count = 2;
240 r.in.req.req1.spn_names = names;
241 names[0].str = talloc_asprintf(mem_ctx, "smbtortureSPN/%s",priv->dcinfo.netbios_name);
242 names[1].str = talloc_asprintf(mem_ctx, "smbtortureSPN/%s",priv->dcinfo.dns_name);
244 status = dcerpc_drsuapi_DsWriteAccountSpn(p, mem_ctx, &r);
245 if (!NT_STATUS_IS_OK(status)) {
246 const char *errstr = nt_errstr(status);
247 if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
248 errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
250 printf("dcerpc_drsuapi_DsWriteAccountSpn failed - %s\n", errstr);
252 } else if (!W_ERROR_IS_OK(r.out.result)) {
253 printf("DsWriteAccountSpn failed - %s\n", win_errstr(r.out.result));
257 r.in.req.req1.operation = DRSUAPI_DS_SPN_OPERATION_DELETE;
258 r.in.req.req1.unknown1 = 0;
260 status = dcerpc_drsuapi_DsWriteAccountSpn(p, mem_ctx, &r);
261 if (!NT_STATUS_IS_OK(status)) {
262 const char *errstr = nt_errstr(status);
263 if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
264 errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
266 printf("dcerpc_drsuapi_DsWriteAccountSpn failed - %s\n", errstr);
268 } else if (!W_ERROR_IS_OK(r.out.result)) {
269 printf("DsWriteAccountSpn failed - %s\n", win_errstr(r.out.result));
276 static BOOL test_DsReplicaGetInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
277 struct DsPrivate *priv)
280 struct drsuapi_DsReplicaGetInfo r;
289 DRSUAPI_DS_REPLICA_GET_INFO,
290 DRSUAPI_DS_REPLICA_INFO_NEIGHBORS,
293 DRSUAPI_DS_REPLICA_GET_INFO,
294 DRSUAPI_DS_REPLICA_INFO_CURSORS,
297 DRSUAPI_DS_REPLICA_GET_INFO,
298 DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA,
301 DRSUAPI_DS_REPLICA_GET_INFO,
302 DRSUAPI_DS_REPLICA_INFO_KCC_DSA_CONNECT_FAILURES,
305 DRSUAPI_DS_REPLICA_GET_INFO,
306 DRSUAPI_DS_REPLICA_INFO_KCC_DSA_LINK_FAILURES,
309 DRSUAPI_DS_REPLICA_GET_INFO,
310 DRSUAPI_DS_REPLICA_INFO_PENDING_OPS,
313 DRSUAPI_DS_REPLICA_GET_INFO2,
314 DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA,
317 DRSUAPI_DS_REPLICA_GET_INFO2,
318 DRSUAPI_DS_REPLICA_INFO_CURSORS2,
321 DRSUAPI_DS_REPLICA_GET_INFO2,
322 DRSUAPI_DS_REPLICA_INFO_CURSORS3,
325 DRSUAPI_DS_REPLICA_GET_INFO2,
326 DRSUAPI_DS_REPLICA_INFO_OBJ_METADATA2,
329 DRSUAPI_DS_REPLICA_GET_INFO2,
330 DRSUAPI_DS_REPLICA_INFO_ATTRIBUTE_VALUE_METADATA2,
333 DRSUAPI_DS_REPLICA_GET_INFO2,
334 DRSUAPI_DS_REPLICA_INFO_NEIGHBORS02,
337 DRSUAPI_DS_REPLICA_GET_INFO2,
338 DRSUAPI_DS_REPLICA_INFO_CONNECTIONS04,
341 DRSUAPI_DS_REPLICA_GET_INFO2,
342 DRSUAPI_DS_REPLICA_INFO_CURSORS05,
345 DRSUAPI_DS_REPLICA_GET_INFO2,
346 DRSUAPI_DS_REPLICA_INFO_06,
351 if (lp_parm_bool(-1, "torture", "samba4", False)) {
352 printf("skipping DsReplicaGetInfo test against Samba4\n");
356 r.in.bind_handle = &priv->bind_handle;
358 for (i=0; i < ARRAY_SIZE(array); i++) {
359 const char *object_dn;
361 printf("testing DsReplicaGetInfo level %d infotype %d\n",
362 array[i].level, array[i].infotype);
364 object_dn = (array[i].obj_dn ? array[i].obj_dn : priv->domain_obj_dn);
366 r.in.level = array[i].level;
368 case DRSUAPI_DS_REPLICA_GET_INFO:
369 r.in.req.req1.info_type = array[i].infotype;
370 r.in.req.req1.object_dn = object_dn;
371 ZERO_STRUCT(r.in.req.req1.guid1);
373 case DRSUAPI_DS_REPLICA_GET_INFO2:
374 r.in.req.req2.info_type = array[i].infotype;
375 r.in.req.req2.object_dn = object_dn;
376 ZERO_STRUCT(r.in.req.req1.guid1);
377 r.in.req.req2.unknown1 = 0;
378 r.in.req.req2.string1 = NULL;
379 r.in.req.req2.string2 = NULL;
380 r.in.req.req2.unknown2 = 0;
384 status = dcerpc_drsuapi_DsReplicaGetInfo(p, mem_ctx, &r);
385 if (!NT_STATUS_IS_OK(status)) {
386 const char *errstr = nt_errstr(status);
387 if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
388 errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
390 if (p->last_fault_code != DCERPC_FAULT_INVALID_TAG) {
391 printf("dcerpc_drsuapi_DsReplicaGetInfo failed - %s\n", errstr);
394 printf("DsReplicaGetInfo level %d and/or infotype %d not supported by server\n",
395 array[i].level, array[i].infotype);
397 } else if (!W_ERROR_IS_OK(r.out.result)) {
398 printf("DsReplicaGetInfo failed - %s\n", win_errstr(r.out.result));
406 static BOOL test_DsReplicaSync(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
407 struct DsPrivate *priv)
412 struct drsuapi_DsReplicaSync r;
413 struct drsuapi_DsReplicaObjectIdentifier nc;
414 struct GUID null_guid;
415 struct dom_sid null_sid;
424 if (!lp_parm_bool(-1, "torture", "dangerous", False)) {
425 printf("DsReplicaSync disabled - enable dangerous tests to use\n");
429 if (lp_parm_bool(-1, "torture", "samba4", False)) {
430 printf("skipping DsReplicaSync test against Samba4\n");
434 ZERO_STRUCT(null_guid);
435 ZERO_STRUCT(null_sid);
437 r.in.bind_handle = &priv->bind_handle;
439 for (i=0; i < ARRAY_SIZE(array); i++) {
440 printf("testing DsReplicaSync level %d\n",
443 r.in.level = array[i].level;
448 nc.dn = priv->domain_obj_dn?priv->domain_obj_dn:"";
450 r.in.req.req1.naming_context = &nc;
451 r.in.req.req1.source_dsa_guid = priv->dcinfo.ntds_guid;
452 r.in.req.req1.other_info = NULL;
453 r.in.req.req1.options = 16;
457 status = dcerpc_drsuapi_DsReplicaSync(p, mem_ctx, &r);
458 if (!NT_STATUS_IS_OK(status)) {
459 const char *errstr = nt_errstr(status);
460 if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
461 errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
463 printf("dcerpc_drsuapi_DsReplicaSync failed - %s\n", errstr);
465 } else if (!W_ERROR_IS_OK(r.out.result)) {
466 printf("DsReplicaSync failed - %s\n", win_errstr(r.out.result));
474 static BOOL test_DsReplicaUpdateRefs(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
475 struct DsPrivate *priv)
480 struct drsuapi_DsReplicaUpdateRefs r;
481 struct drsuapi_DsReplicaObjectIdentifier nc;
482 struct GUID null_guid;
483 struct dom_sid null_sid;
492 if (lp_parm_bool(-1, "torture", "samba4", False)) {
493 printf("skipping DsReplicaUpdateRefs test against Samba4\n");
497 ZERO_STRUCT(null_guid);
498 ZERO_STRUCT(null_sid);
500 r.in.bind_handle = &priv->bind_handle;
502 for (i=0; i < ARRAY_SIZE(array); i++) {
503 printf("testing DsReplicaUpdateRefs level %d\n",
506 r.in.level = array[i].level;
511 nc.dn = priv->domain_obj_dn?priv->domain_obj_dn:"";
513 r.in.req.req1.naming_context = &nc;
514 r.in.req.req1.dest_dsa_dns_name = talloc_asprintf(mem_ctx, "__some_dest_dsa_guid_string._msdn.%s",
515 priv->domain_dns_name);
516 r.in.req.req1.dest_dsa_guid = null_guid;
517 r.in.req.req1.options = 0;
521 status = dcerpc_drsuapi_DsReplicaUpdateRefs(p, mem_ctx, &r);
522 if (!NT_STATUS_IS_OK(status)) {
523 const char *errstr = nt_errstr(status);
524 if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
525 errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
527 printf("dcerpc_drsuapi_DsReplicaUpdateRefs failed - %s\n", errstr);
529 } else if (!W_ERROR_IS_OK(r.out.result)) {
530 printf("DsReplicaUpdateRefs failed - %s\n", win_errstr(r.out.result));
538 static BOOL test_DsGetNCChanges(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
539 struct DsPrivate *priv)
544 struct drsuapi_DsGetNCChanges r;
545 struct drsuapi_DsReplicaObjectIdentifier nc;
546 struct GUID null_guid;
547 struct dom_sid null_sid;
559 if (lp_parm_bool(-1, "torture", "samba4", False)) {
560 printf("skipping DsGetNCChanges test against Samba4\n");
564 ZERO_STRUCT(null_guid);
565 ZERO_STRUCT(null_sid);
567 for (i=0; i < ARRAY_SIZE(array); i++) {
568 printf("testing DsGetNCChanges level %d\n",
571 r.in.bind_handle = &priv->bind_handle;
572 r.in.level = &array[i].level;
574 switch (*r.in.level) {
578 nc.dn = priv->domain_obj_dn?priv->domain_obj_dn:"";
580 r.in.req.req5.destination_dsa_guid = GUID_random();
581 r.in.req.req5.source_dsa_invocation_id = null_guid;
582 r.in.req.req5.naming_context = &nc;
583 r.in.req.req5.highwatermark.tmp_highest_usn = 0;
584 r.in.req.req5.highwatermark.reserved_usn = 0;
585 r.in.req.req5.highwatermark.highest_usn = 0;
586 r.in.req.req5.uptodateness_vector = NULL;
587 r.in.req.req5.replica_flags = 0;
588 if (lp_parm_bool(-1, "drsuapi","compression", False)) {
589 r.in.req.req5.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
591 r.in.req.req5.max_object_count = 0;
592 r.in.req.req5.max_ndr_size = 0;
593 r.in.req.req5.unknown4 = 0;
594 r.in.req.req5.h1 = 0;
600 nc.dn = priv->domain_obj_dn?priv->domain_obj_dn:"";
602 r.in.req.req8.destination_dsa_guid = GUID_random();
603 r.in.req.req8.source_dsa_invocation_id = null_guid;
604 r.in.req.req8.naming_context = &nc;
605 r.in.req.req8.highwatermark.tmp_highest_usn = 0;
606 r.in.req.req8.highwatermark.reserved_usn = 0;
607 r.in.req.req8.highwatermark.highest_usn = 0;
608 r.in.req.req8.uptodateness_vector = NULL;
609 r.in.req.req8.replica_flags = 0;
610 if (lp_parm_bool(-1,"drsuapi","compression",False)) {
611 r.in.req.req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
613 if (lp_parm_bool(-1,"drsuapi","neighbour_writeable",True)) {
614 r.in.req.req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE;
616 r.in.req.req8.replica_flags |= DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
617 | DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS
618 | DRSUAPI_DS_REPLICA_NEIGHBOUR_RETURN_OBJECT_PARENTS
619 | DRSUAPI_DS_REPLICA_NEIGHBOUR_NEVER_SYNCED
621 r.in.req.req8.max_object_count = 402;
622 r.in.req.req8.max_ndr_size = 402116;
623 r.in.req.req8.unknown4 = 0;
624 r.in.req.req8.h1 = 0;
625 r.in.req.req8.unique_ptr1 = 0;
626 r.in.req.req8.unique_ptr2 = 0;
627 r.in.req.req8.mapping_ctr.num_mappings = 0;
628 r.in.req.req8.mapping_ctr.mappings = NULL;
633 status = dcerpc_drsuapi_DsGetNCChanges(p, mem_ctx, &r);
634 if (!NT_STATUS_IS_OK(status)) {
635 const char *errstr = nt_errstr(status);
636 if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
637 errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
639 printf("dcerpc_drsuapi_DsGetNCChanges failed - %s\n", errstr);
641 } else if (!W_ERROR_IS_OK(r.out.result)) {
642 printf("DsGetNCChanges failed - %s\n", win_errstr(r.out.result));
650 BOOL test_DsUnbind(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
651 struct DsPrivate *priv)
654 struct drsuapi_DsUnbind r;
657 r.in.bind_handle = &priv->bind_handle;
658 r.out.bind_handle = &priv->bind_handle;
660 printf("testing DsUnbind\n");
662 status = dcerpc_drsuapi_DsUnbind(p, mem_ctx, &r);
663 if (!NT_STATUS_IS_OK(status)) {
664 const char *errstr = nt_errstr(status);
665 if (NT_STATUS_EQUAL(status, NT_STATUS_NET_WRITE_FAULT)) {
666 errstr = dcerpc_errstr(mem_ctx, p->last_fault_code);
668 printf("dcerpc_drsuapi_DsUnbind failed - %s\n", errstr);
670 } else if (!W_ERROR_IS_OK(r.out.result)) {
671 printf("DsBind failed - %s\n", win_errstr(r.out.result));
678 BOOL torture_rpc_drsuapi(struct torture_context *torture)
681 struct dcerpc_pipe *p;
684 struct DsPrivate priv;
685 struct cli_credentials *machine_credentials;
687 mem_ctx = talloc_init("torture_rpc_drsuapi");
689 printf("Connected to DRAUAPI pipe\n");
693 priv.join = torture_join_domain(TEST_MACHINE_NAME, ACB_SVRTRUST,
694 &machine_credentials);
696 talloc_free(mem_ctx);
697 printf("Failed to join as BDC\n");
701 status = torture_rpc_connection(mem_ctx,
703 &dcerpc_table_drsuapi);
704 if (!NT_STATUS_IS_OK(status)) {
705 torture_leave_domain(priv.join);
706 talloc_free(mem_ctx);
710 ret &= test_DsBind(p, mem_ctx, &priv);
712 ret &= test_DsGetDomainControllerInfo(p, mem_ctx, &priv);
714 ret &= test_DsCrackNames(p, mem_ctx, &priv);
716 ret &= test_DsWriteAccountSpn(p, mem_ctx, &priv);
718 ret &= test_DsReplicaGetInfo(p, mem_ctx, &priv);
720 ret &= test_DsReplicaSync(p, mem_ctx, &priv);
722 ret &= test_DsReplicaUpdateRefs(p, mem_ctx, &priv);
724 ret &= test_DsGetNCChanges(p, mem_ctx, &priv);
726 ret &= test_DsUnbind(p, mem_ctx, &priv);
728 talloc_free(mem_ctx);
730 torture_leave_domain(priv.join);
736 BOOL torture_rpc_drsuapi_cracknames(struct torture_context *torture)
739 struct dcerpc_pipe *p;
742 struct DsPrivate priv;
743 struct cli_credentials *machine_credentials;
745 mem_ctx = talloc_init("torture_rpc_drsuapi");
747 printf("Connected to DRAUAPI pipe\n");
751 priv.join = torture_join_domain(TEST_MACHINE_NAME, ACB_SVRTRUST,
752 &machine_credentials);
754 talloc_free(mem_ctx);
755 printf("Failed to join as BDC\n");
759 status = torture_rpc_connection(mem_ctx,
761 &dcerpc_table_drsuapi);
762 if (!NT_STATUS_IS_OK(status)) {
763 torture_leave_domain(priv.join);
764 talloc_free(mem_ctx);
768 ret &= test_DsBind(p, mem_ctx, &priv);
771 ret &= test_DsGetDomainControllerInfo(p, mem_ctx, &priv);
773 ret &= test_DsCrackNames(p, mem_ctx, &priv);
775 ret &= test_DsUnbind(p, mem_ctx, &priv);
777 talloc_free(mem_ctx);
779 torture_leave_domain(priv.join);