2 Unix SMB/CIFS implementation.
4 msDS-IntId attribute replication test.
6 Copyright (C) Kamen Mazdrashki <kamenim@samba.org> 2010
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 #include "lib/cmdline/popt_common.h"
24 #include "librpc/gen_ndr/ndr_drsuapi_c.h"
25 #include "librpc/gen_ndr/ndr_drsblobs.h"
26 #include "libcli/cldap/cldap.h"
27 #include "torture/torture.h"
28 #include "../libcli/drsuapi/drsuapi.h"
29 #include "auth/gensec/gensec.h"
30 #include "param/param.h"
31 #include "dsdb/samdb/samdb.h"
32 #include "torture/rpc/torture_rpc.h"
33 #include "torture/drs/proto.h"
34 #include "lib/tsocket/tsocket.h"
35 #include "libcli/resolve/resolve.h"
37 struct DsSyncBindInfo {
38 struct dcerpc_pipe *drs_pipe;
39 struct dcerpc_binding_handle *drs_handle;
40 struct drsuapi_DsBind req;
41 struct GUID bind_guid;
42 struct drsuapi_DsBindInfoCtr our_bind_info_ctr;
43 struct drsuapi_DsBindInfo28 our_bind_info28;
44 struct drsuapi_DsBindInfo28 peer_bind_info28;
45 struct policy_handle bind_handle;
49 struct dcerpc_binding *server_binding;
51 struct dcerpc_pipe *drs_pipe;
52 struct dcerpc_binding_handle *drs_handle;
54 DATA_BLOB gensec_skey;
55 struct drsuapi_DsBindInfo48 srv_info48;
56 struct policy_handle rpc_handle;
59 struct DsIntIdTestCtx {
61 const char *domain_dn;
62 const char *config_dn;
63 const char *schema_dn;
65 /* what we need to do as 'Administrator' */
66 struct cli_credentials *creds;
67 struct DsaBindInfo dsa_bind;
68 struct ldb_context *ldb;
72 /* Format string to create provision LDIF with */
73 #define PROVISION_LDIF_FMT \
74 "###########################################################\n" \
75 "# Format string with positional params:\n" \
76 "# 1 - (int) Unique ID between 1 and 2^16\n" \
77 "# 2 - (string) Domain DN\n" \
78 "###########################################################\n" \
80 "###########################################################\n" \
82 "###########################################################\n" \
83 "dn: CN=msds-intid-%1$d,CN=Schema,CN=Configuration,%2$s\n" \
85 "objectClass: top\n" \
86 "objectClass: attributeSchema\n" \
87 "cn: msds-intid-%1$d\n" \
88 "attributeID: 1.2.840.%1$d.1.5.9940\n" \
89 "attributeSyntax: 2.5.5.10\n" \
92 "isSingleValued: TRUE\n" \
93 "systemOnly: FALSE\n" \
95 "# schemaUpdateNow\n" \
97 "changeType: modify\n" \
98 "add: schemaUpdateNow\n" \
99 "schemaUpdateNow: 1\n" \
102 "###########################################################\n" \
103 "# Update User class\n" \
104 "###########################################################\n" \
105 "dn: CN=User,CN=Schema,CN=Configuration,%2$s\n" \
106 "changetype: modify\n" \
107 "add: mayContain\n" \
108 "mayContain: msdsIntid%1$d\n" \
111 "# schemaUpdateNow\n" \
113 "changeType: modify\n" \
114 "add: schemaUpdateNow\n" \
115 "schemaUpdateNow: 1\n" \
118 "###########################################################\n" \
119 "# create user to test with\n" \
120 "###########################################################\n" \
121 "dn: CN=dsIntId_usr_%1$d,CN=Users,%2$s\n" \
122 "changetype: add\n" \
123 "objectClass: user\n" \
124 "cn: dsIntId_usr_%1$d\n" \
125 "name: dsIntId_usr_%1$d\n" \
126 "displayName: dsIntId_usr_%1$d\n" \
127 "sAMAccountName: dsIntId_usr_%1$d\n" \
128 "msdsIntid%1$d: msDS-IntId-%1$d attribute value\n" \
132 static struct DsIntIdTestCtx *_dsintid_create_context(struct torture_context *tctx)
135 struct DsIntIdTestCtx *ctx;
136 struct dcerpc_binding *server_binding;
137 const char *binding = torture_setting_string(tctx, "binding", NULL);
139 /* Create test suite context */
140 ctx = talloc_zero(tctx, struct DsIntIdTestCtx);
142 torture_result(tctx, TORTURE_FAIL, "Not enough memory!");
146 /* parse binding object */
147 status = dcerpc_parse_binding(ctx, binding, &server_binding);
148 if (!NT_STATUS_IS_OK(status)) {
149 torture_result(tctx, TORTURE_FAIL,
150 "Bad binding string '%s': %s", binding, nt_errstr(status));
154 server_binding->flags |= DCERPC_SIGN | DCERPC_SEAL;
156 /* populate test suite context */
157 ctx->creds = cmdline_credentials;
158 ctx->dsa_bind.server_binding = server_binding;
160 ctx->ldap_url = talloc_asprintf(ctx, "ldap://%s", server_binding->host);
165 static bool _test_DsaBind(struct torture_context *tctx,
167 struct cli_credentials *credentials,
168 uint32_t req_extensions,
169 struct DsaBindInfo *bi)
172 struct GUID bind_guid;
173 struct drsuapi_DsBind r;
174 struct drsuapi_DsBindInfoCtr bind_info_ctr;
175 uint32_t supported_extensions;
177 /* make DCE RPC connection */
178 status = dcerpc_pipe_connect_b(mem_ctx,
182 credentials, tctx->ev, tctx->lp_ctx);
183 torture_assert_ntstatus_ok(tctx, status, "Failed to connect to server");
185 bi->drs_handle = bi->drs_pipe->binding_handle;
187 status = gensec_session_key(bi->drs_pipe->conn->security_state.generic_state,
188 mem_ctx, &bi->gensec_skey);
189 torture_assert_ntstatus_ok(tctx, status, "failed to get gensec session key");
191 /* Bind to DRSUAPI interface */
192 GUID_from_string(DRSUAPI_DS_BIND_GUID_W2K3, &bind_guid);
195 * Add flags that should be 1, according to MS docs.
196 * It turns out DRSUAPI_SUPPORTED_EXTENSION_POST_BETA3
197 * is actually required in order for GetNCChanges() to
198 * return schemaInfo entry in the prefixMap returned.
199 * Use DRSUAPI_SUPPORTED_EXTENSION_STRONG_ENCRYPTION so
200 * we are able to fetch sensitive data.
202 supported_extensions = req_extensions
203 | DRSUAPI_SUPPORTED_EXTENSION_BASE
204 | DRSUAPI_SUPPORTED_EXTENSION_RESTORE_USN_OPTIMIZATION
205 | DRSUAPI_SUPPORTED_EXTENSION_INSTANCE_TYPE_NOT_REQ_ON_MOD
206 | DRSUAPI_SUPPORTED_EXTENSION_POST_BETA3
207 | DRSUAPI_SUPPORTED_EXTENSION_STRONG_ENCRYPTION;
209 ZERO_STRUCT(bind_info_ctr);
210 bind_info_ctr.length = 28;
211 bind_info_ctr.info.info28.supported_extensions = supported_extensions;
213 r.in.bind_guid = &bind_guid;
214 r.in.bind_info = &bind_info_ctr;
215 r.out.bind_handle = &bi->rpc_handle;
217 status = dcerpc_drsuapi_DsBind_r(bi->drs_handle, mem_ctx, &r);
218 torture_drsuapi_assert_call(tctx, bi->drs_pipe, status,
219 &r, "dcerpc_drsuapi_DsBind_r");
222 switch (r.out.bind_info->length) {
224 struct drsuapi_DsBindInfo24 *info24;
225 info24 = &r.out.bind_info->info.info24;
226 bi->srv_info48.supported_extensions = info24->supported_extensions;
227 bi->srv_info48.site_guid = info24->site_guid;
228 bi->srv_info48.pid = info24->pid;
232 struct drsuapi_DsBindInfo28 *info28;
233 info28 = &r.out.bind_info->info.info28;
234 bi->srv_info48.supported_extensions = info28->supported_extensions;
235 bi->srv_info48.site_guid = info28->site_guid;
236 bi->srv_info48.pid = info28->pid;
237 bi->srv_info48.repl_epoch = info28->repl_epoch;
241 bi->srv_info48 = r.out.bind_info->info.info48;
245 struct drsuapi_DsBindInfo32 *info32;
246 info32 = &r.out.bind_info->info.info32;
247 bi->srv_info48.supported_extensions = info32->supported_extensions;
248 bi->srv_info48.site_guid = info32->site_guid;
249 bi->srv_info48.pid = info32->pid;
250 bi->srv_info48.repl_epoch = info32->repl_epoch;
254 struct drsuapi_DsBindInfo52 *info52;
255 info52 = &r.out.bind_info->info.info52;
256 bi->srv_info48.supported_extensions = info52->supported_extensions;
257 bi->srv_info48.site_guid = info52->site_guid;
258 bi->srv_info48.pid = info52->pid;
259 bi->srv_info48.repl_epoch = info52->repl_epoch;
263 torture_result(tctx, TORTURE_FAIL,
264 "DsBind: unknown BindInfo length: %u",
265 r.out.bind_info->length);
269 /* check if server supports extensions we've requested */
270 if ((bi->srv_info48.supported_extensions & req_extensions) != req_extensions) {
271 torture_result(tctx, TORTURE_FAIL,
272 "Server does not support requested extensions. "
273 "Requested: 0x%08X, Supported: 0x%08X",
274 req_extensions, bi->srv_info48.supported_extensions);
281 static bool _test_LDAPBind(struct torture_context *tctx,
283 struct cli_credentials *credentials,
284 const char *ldap_url,
285 struct ldb_context **_ldb)
289 struct ldb_context *ldb;
291 const char *modules_option[] = { "modules:paged_searches", NULL };
292 ldb = ldb_init(mem_ctx, tctx->ev);
297 /* Despite us loading the schema from the AD server, we need
298 * the samba handlers to get the extended DN syntax stuff */
299 ret = ldb_register_samba_handlers(ldb);
300 if (ret != LDB_SUCCESS) {
305 ldb_set_modules_dir(ldb, modules_path(ldb, "ldb"));
307 if (ldb_set_opaque(ldb, "credentials", credentials) != LDB_SUCCESS) {
312 if (ldb_set_opaque(ldb, "loadparm", tctx->lp_ctx) != LDB_SUCCESS) {
317 ret = ldb_connect(ldb, ldap_url, 0, modules_option);
318 if (ret != LDB_SUCCESS) {
320 torture_assert_int_equal(tctx, ret, LDB_SUCCESS, "Failed to make LDB connection to target");
328 static bool _test_provision(struct torture_context *tctx, struct DsIntIdTestCtx *ctx)
333 struct ldb_ldif *ldif;
335 struct ldb_context *ldb = ctx->ldb;
337 /* We must have LDB connection ready by this time */
338 SMB_ASSERT(ldb != NULL);
340 ctx->domain_dn = ldb_dn_get_linearized(ldb_get_default_basedn(ldb));
341 torture_assert(tctx, ctx->domain_dn != NULL, "Failed to get Domain DN");
343 ctx->config_dn = ldb_dn_get_linearized(ldb_get_config_basedn(ldb));
344 torture_assert(tctx, ctx->config_dn != NULL, "Failed to get Domain DN");
346 ctx->schema_dn = ldb_dn_get_linearized(ldb_get_schema_basedn(ldb));
347 torture_assert(tctx, ctx->schema_dn != NULL, "Failed to get Domain DN");
349 /* prepare LDIF to provision with */
350 attr_id = generate_random() % 0xFFFF;
351 pstr = ldif_str = talloc_asprintf(ctx, PROVISION_LDIF_FMT,
352 attr_id, ctx->domain_dn);
354 /* Provision test data */
355 while ((ldif = ldb_ldif_read_string(ldb, &pstr)) != NULL) {
356 switch (ldif->changetype) {
357 case LDB_CHANGETYPE_DELETE:
358 ret = ldb_delete(ldb, ldif->msg->dn);
360 case LDB_CHANGETYPE_MODIFY:
361 ret = ldb_modify(ldb, ldif->msg);
363 case LDB_CHANGETYPE_ADD:
365 ret = ldb_add(ldb, ldif->msg);
368 if (ret != LDB_SUCCESS) {
369 char *msg = talloc_asprintf(ctx,
370 "Failed to apply ldif - %s (%s): \n%s",
373 ldb_ldif_write_string(ldb, ctx, ldif));
374 torture_fail(tctx, msg);
377 ldb_ldif_read_free(ldb, ldif);
384 static bool _test_GetNCChanges(struct torture_context *tctx,
385 struct DsaBindInfo *bi,
386 const char *nc_dn_str,
388 struct drsuapi_DsGetNCChangesCtr6 **_ctr6)
391 struct drsuapi_DsGetNCChanges r;
392 union drsuapi_DsGetNCChangesRequest req;
393 struct drsuapi_DsReplicaObjectIdentifier nc;
394 struct drsuapi_DsGetNCChangesCtr6 *ctr6_chunk = NULL;
395 struct drsuapi_DsGetNCChangesCtr6 ctr6;
397 union drsuapi_DsGetNCChangesCtr ctr;
399 struct dom_sid null_sid;
401 ZERO_STRUCT(null_sid);
403 /* fill-in Naming Context */
404 nc.guid = GUID_zero();
408 /* fill-in request fields */
409 req.req8.destination_dsa_guid = GUID_random();
410 req.req8.source_dsa_invocation_id = GUID_zero();
411 req.req8.naming_context = &nc;
412 req.req8.highwatermark.tmp_highest_usn = 0;
413 req.req8.highwatermark.reserved_usn = 0;
414 req.req8.highwatermark.highest_usn = 0;
415 req.req8.uptodateness_vector = NULL;
416 req.req8.replica_flags = DRSUAPI_DRS_WRIT_REP
417 | DRSUAPI_DRS_INIT_SYNC
418 | DRSUAPI_DRS_PER_SYNC
419 | DRSUAPI_DRS_GET_ANC
420 | DRSUAPI_DRS_NEVER_SYNCED
422 req.req8.max_object_count = 402;
423 req.req8.max_ndr_size = 402116;
425 req.req8.extended_op = DRSUAPI_EXOP_NONE;
426 req.req8.fsmo_info = 0;
427 req.req8.partial_attribute_set = NULL;
428 req.req8.partial_attribute_set_ex = NULL;
429 req.req8.mapping_ctr.num_mappings = 0;
430 req.req8.mapping_ctr.mappings = NULL;
432 r.in.bind_handle = &bi->rpc_handle;
437 r.out.level_out = &_level;
444 status = dcerpc_drsuapi_DsGetNCChanges_r(bi->drs_handle, mem_ctx, &r);
445 torture_drsuapi_assert_call(tctx, bi->drs_pipe, status,
446 &r, "dcerpc_drsuapi_DsGetNCChanges_r");
448 /* we expect to get level 6 reply */
449 torture_assert_int_equal(tctx, _level, 6, "Expected level 6 reply");
451 /* store this chunk for later use */
452 ctr6_chunk = &r.out.ctr->ctr6;
454 if (!ctr6.first_object) {
457 struct drsuapi_DsReplicaObjectListItemEx *cur;
459 ctr6.object_count += ctr6_chunk->object_count;
460 for (cur = ctr6.first_object; cur->next_object; cur = cur->next_object) {}
461 cur->next_object = ctr6_chunk->first_object;
463 /* TODO: store the chunk of linked_attributes if needed */
466 /* prepare for next request */
467 r.in.req->req8.highwatermark = ctr6_chunk->new_highwatermark;
469 } while (ctr6_chunk->more_data);
471 *_ctr6 = talloc(mem_ctx, struct drsuapi_DsGetNCChangesCtr6);
472 torture_assert(mem_ctx, *_ctr6, "Not enough memory");
478 static char * _make_error_message(TALLOC_CTX *mem_ctx,
479 enum drsuapi_DsAttributeId drs_attid,
480 const struct dsdb_attribute *dsdb_attr,
481 const struct drsuapi_DsReplicaObjectIdentifier *identifier)
483 return talloc_asprintf(mem_ctx, "\nInvalid ATTID for %1$s (%2$s)\n"
484 " drs_attid: %3$11d (0x%3$08X)\n"
485 " msDS_IntId: %4$11d (0x%4$08X)\n"
486 " attributeId_id: %5$11d (0x%5$08X)",
487 dsdb_attr->lDAPDisplayName,
490 dsdb_attr->msDS_IntId,
491 dsdb_attr->attributeID_id);
495 * Fetch Schema NC and check ATTID values returned.
496 * When Schema partition is replicated, ATTID
497 * should always be made using prefixMap
499 static bool test_dsintid_schema(struct torture_context *tctx, struct DsIntIdTestCtx *ctx)
502 const struct dsdb_schema *ldap_schema;
503 struct drsuapi_DsGetNCChangesCtr6 *ctr6 = NULL;
504 const struct dsdb_attribute *dsdb_attr;
505 const struct drsuapi_DsReplicaAttribute *drs_attr;
506 const struct drsuapi_DsReplicaAttributeCtr *attr_ctr;
507 const struct drsuapi_DsReplicaObjectListItemEx *cur;
508 const struct drsuapi_DsReplicaLinkedAttribute *la;
511 mem_ctx = talloc_new(ctx);
512 torture_assert(tctx, mem_ctx, "Not enough memory");
514 /* fetch whole Schema partition */
515 torture_comment(tctx, "Fetch partition: %s\n", ctx->schema_dn);
516 if (!_test_GetNCChanges(tctx, &ctx->dsa_bind, ctx->schema_dn, mem_ctx, &ctr6)) {
517 torture_fail(tctx, "_test_GetNCChanges() failed");
520 /* load schema if not loaded yet */
521 torture_comment(tctx, "Loading schema...\n");
522 if (!drs_util_dsdb_schema_load_ldb(tctx, ctx->ldb, &ctr6->mapping_ctr, false)) {
523 torture_fail(tctx, "drs_util_dsdb_schema_load_ldb() failed");
525 ldap_schema = dsdb_get_schema(ctx->ldb, NULL);
527 /* verify ATTIDs fetched */
528 torture_comment(tctx, "Verify ATTIDs fetched\n");
529 for (cur = ctr6->first_object; cur; cur = cur->next_object) {
530 attr_ctr = &cur->object.attribute_ctr;
531 for (i = 0; i < attr_ctr->num_attributes; i++) {
532 drs_attr = &attr_ctr->attributes[i];
533 dsdb_attr = dsdb_attribute_by_attributeID_id(ldap_schema,
537 drs_attr->attid == dsdb_attr->attributeID_id,
538 _make_error_message(ctx, drs_attr->attid,
540 cur->object.identifier));
541 if (dsdb_attr->msDS_IntId) {
543 drs_attr->attid != dsdb_attr->msDS_IntId,
544 _make_error_message(ctx, drs_attr->attid,
546 cur->object.identifier));
551 /* verify ATTIDs for Linked Attributes */
552 torture_comment(tctx, "Verify ATTIDs for Linked Attributes (%u)\n",
553 ctr6->linked_attributes_count);
554 for (i = 0; i < ctr6->linked_attributes_count; i++) {
555 la = &ctr6->linked_attributes[i];
556 dsdb_attr = dsdb_attribute_by_attributeID_id(ldap_schema, la->attid);
559 la->attid == dsdb_attr->attributeID_id,
560 _make_error_message(ctx, la->attid,
563 if (dsdb_attr->msDS_IntId) {
565 la->attid != dsdb_attr->msDS_IntId,
566 _make_error_message(ctx, la->attid,
572 talloc_free(mem_ctx);
578 * Fetch non-Schema NC and check ATTID values returned.
579 * When non-Schema partition is replicated, ATTID
580 * should be msDS-IntId value for the attribute
581 * if this value exists
583 static bool _test_dsintid(struct torture_context *tctx,
584 struct DsIntIdTestCtx *ctx,
585 const char *nc_dn_str)
588 const struct dsdb_schema *ldap_schema;
589 struct drsuapi_DsGetNCChangesCtr6 *ctr6 = NULL;
590 const struct dsdb_attribute *dsdb_attr;
591 const struct drsuapi_DsReplicaAttribute *drs_attr;
592 const struct drsuapi_DsReplicaAttributeCtr *attr_ctr;
593 const struct drsuapi_DsReplicaObjectListItemEx *cur;
594 const struct drsuapi_DsReplicaLinkedAttribute *la;
597 mem_ctx = talloc_new(ctx);
598 torture_assert(tctx, mem_ctx, "Not enough memory");
600 /* fetch whole Schema partition */
601 torture_comment(tctx, "Fetch partition: %s\n", nc_dn_str);
602 if (!_test_GetNCChanges(tctx, &ctx->dsa_bind, nc_dn_str, mem_ctx, &ctr6)) {
603 torture_fail(tctx, "_test_GetNCChanges() failed");
606 /* load schema if not loaded yet */
607 torture_comment(tctx, "Loading schema...\n");
608 if (!drs_util_dsdb_schema_load_ldb(tctx, ctx->ldb, &ctr6->mapping_ctr, false)) {
609 torture_fail(tctx, "drs_util_dsdb_schema_load_ldb() failed");
611 ldap_schema = dsdb_get_schema(ctx->ldb, NULL);
613 /* verify ATTIDs fetched */
614 torture_comment(tctx, "Verify ATTIDs fetched\n");
615 for (cur = ctr6->first_object; cur; cur = cur->next_object) {
616 attr_ctr = &cur->object.attribute_ctr;
617 for (i = 0; i < attr_ctr->num_attributes; i++) {
618 drs_attr = &attr_ctr->attributes[i];
619 dsdb_attr = dsdb_attribute_by_attributeID_id(ldap_schema,
621 if (dsdb_attr->msDS_IntId) {
623 drs_attr->attid == dsdb_attr->msDS_IntId,
624 _make_error_message(ctx, drs_attr->attid,
626 cur->object.identifier));
629 drs_attr->attid == dsdb_attr->attributeID_id,
630 _make_error_message(ctx, drs_attr->attid,
632 cur->object.identifier));
637 /* verify ATTIDs for Linked Attributes */
638 torture_comment(tctx, "Verify ATTIDs for Linked Attributes (%u)\n",
639 ctr6->linked_attributes_count);
640 for (i = 0; i < ctr6->linked_attributes_count; i++) {
641 la = &ctr6->linked_attributes[i];
642 dsdb_attr = dsdb_attribute_by_attributeID_id(ldap_schema, la->attid);
644 if (dsdb_attr->msDS_IntId) {
646 la->attid == dsdb_attr->msDS_IntId,
647 _make_error_message(ctx, la->attid,
652 la->attid == dsdb_attr->attributeID_id,
653 _make_error_message(ctx, la->attid,
659 talloc_free(mem_ctx);
665 * Fetch Domain NC and check ATTID values returned.
666 * When Domain partition is replicated, ATTID
667 * should be msDS-IntId value for the attribute
668 * if this value exists
670 static bool test_dsintid_configuration(struct torture_context *tctx, struct DsIntIdTestCtx *ctx)
672 return _test_dsintid(tctx, ctx, ctx->config_dn);
676 * Fetch Configuration NC and check ATTID values returned.
677 * When Configuration partition is replicated, ATTID
678 * should be msDS-IntId value for the attribute
679 * if this value exists
681 static bool test_dsintid_domain(struct torture_context *tctx, struct DsIntIdTestCtx *ctx)
683 return _test_dsintid(tctx, ctx, ctx->domain_dn);
688 * DSSYNC test case setup
690 static bool torture_dsintid_tcase_setup(struct torture_context *tctx, void **data)
693 struct DsIntIdTestCtx *ctx;
695 *data = ctx = _dsintid_create_context(tctx);
696 torture_assert(tctx, ctx, "test_create_context() failed");
698 bret = _test_DsaBind(tctx, ctx, ctx->creds,
699 DRSUAPI_SUPPORTED_EXTENSION_GETCHGREQ_V8 |
700 DRSUAPI_SUPPORTED_EXTENSION_GETCHGREPLY_V6,
702 torture_assert(tctx, bret, "_test_DsaBind() failed");
704 bret = _test_LDAPBind(tctx, ctx, ctx->creds, ctx->ldap_url, &ctx->ldb);
705 torture_assert(tctx, bret, "_test_LDAPBind() failed");
707 bret = _test_provision(tctx, ctx);
708 torture_assert(tctx, bret, "_test_provision() failed");
714 * DSSYNC test case cleanup
716 static bool torture_dsintid_tcase_teardown(struct torture_context *tctx, void *data)
718 struct DsIntIdTestCtx *ctx;
719 struct drsuapi_DsUnbind r;
720 struct policy_handle bind_handle;
722 ctx = talloc_get_type(data, struct DsIntIdTestCtx);
725 r.out.bind_handle = &bind_handle;
727 /* Release DRSUAPI handle */
728 r.in.bind_handle = &ctx->dsa_bind.rpc_handle;
729 dcerpc_drsuapi_DsUnbind_r(ctx->dsa_bind.drs_handle, ctx, &r);
737 * DSSYNC test case implementation
739 void torture_drs_rpc_dsintid_tcase(struct torture_suite *suite)
741 typedef bool (*run_func) (struct torture_context *test, void *tcase_data);
743 struct torture_test *test;
744 struct torture_tcase *tcase = torture_suite_add_tcase(suite, "msDSIntId");
746 torture_tcase_set_fixture(tcase,
747 torture_dsintid_tcase_setup,
748 torture_dsintid_tcase_teardown);
750 test = torture_tcase_add_simple_test(tcase, "Schema", (run_func)test_dsintid_schema);
751 test = torture_tcase_add_simple_test(tcase, "Configuration", (run_func)test_dsintid_configuration);
752 test = torture_tcase_add_simple_test(tcase, "Domain", (run_func)test_dsintid_domain);