2 Unix SMB/CIFS implementation.
4 libnet_BecomeDC() tests
6 Copyright (C) Stefan Metzmacher <metze@samba.org> 2006
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 "torture/torture.h"
25 #include "torture/rpc/rpc.h"
26 #include "libnet/libnet.h"
27 #include "lib/events/events.h"
28 #include "dsdb/samdb/samdb.h"
29 #include "lib/util/dlinklist.h"
30 #include "lib/ldb/include/ldb.h"
31 #include "lib/ldb/include/ldb_errors.h"
32 #include "librpc/ndr/libndr.h"
33 #include "librpc/gen_ndr/ndr_drsuapi.h"
34 #include "librpc/gen_ndr/ndr_drsblobs.h"
35 #include "librpc/gen_ndr/ndr_misc.h"
36 #include "system/time.h"
37 #include "lib/ldb_wrap.h"
38 #include "auth/auth.h"
39 #include "param/param.h"
40 #include "torture/util.h"
41 #include "param/provision.h"
43 struct test_become_dc_state {
44 struct libnet_context *ctx;
45 struct torture_context *tctx;
46 const char *netbios_name;
48 struct cli_credentials *machine_account;
49 struct dsdb_schema *self_made_schema;
50 const struct dsdb_schema *schema;
52 struct ldb_context *ldb;
55 uint32_t object_count;
56 struct drsuapi_DsReplicaObjectListItemEx *first_object;
57 struct drsuapi_DsReplicaObjectListItemEx *last_object;
60 const char *targetdir;
62 struct loadparm_context *lp_ctx;
65 static NTSTATUS test_become_dc_prepare_db(void *private_data,
66 const struct libnet_BecomeDC_PrepareDB *p)
68 struct test_become_dc_state *s = talloc_get_type(private_data, struct test_become_dc_state);
69 struct provision_settings settings;
70 struct provision_result result;
73 settings.site_name = p->dest_dsa->site_name;
74 settings.root_dn_str = p->forest->root_dn_str;
75 settings.domain_dn_str = p->domain->dn_str;
76 settings.config_dn_str = p->forest->config_dn_str;
77 settings.schema_dn_str = p->forest->schema_dn_str;
78 settings.netbios_name = p->dest_dsa->netbios_name;
79 settings.realm = torture_join_dom_dns_name(s->tj);
80 settings.domain = torture_join_dom_netbios_name(s->tj);
81 settings.server_dn_str = torture_join_server_dn_str(s->tj);
82 settings.machine_password = cli_credentials_get_password(s->machine_account);
83 settings.targetdir = s->targetdir;
85 status = provision_bare(s, s->lp_ctx, &settings, &result);
87 s->ldb = result.samdb;
88 s->lp_ctx = result.lp_ctx;
94 static NTSTATUS test_become_dc_check_options(void *private_data,
95 const struct libnet_BecomeDC_CheckOptions *o)
97 struct test_become_dc_state *s = talloc_get_type(private_data, struct test_become_dc_state);
99 DEBUG(0,("Become DC [%s] of Domain[%s]/[%s]\n",
101 o->domain->netbios_name, o->domain->dns_name));
103 DEBUG(0,("Promotion Partner is Server[%s] from Site[%s]\n",
104 o->source_dsa->dns_name, o->source_dsa->site_name));
106 DEBUG(0,("Options:crossRef behavior_version[%u]\n"
107 "\tschema object_version[%u]\n"
108 "\tdomain behavior_version[%u]\n"
109 "\tdomain w2k3_update_revision[%u]\n",
110 o->forest->crossref_behavior_version,
111 o->forest->schema_object_version,
112 o->domain->behavior_version,
113 o->domain->w2k3_update_revision));
118 static NTSTATUS test_apply_schema(struct test_become_dc_state *s,
119 const struct libnet_BecomeDC_StoreChunk *c)
122 const struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr;
123 uint32_t total_object_count;
124 uint32_t object_count;
125 struct drsuapi_DsReplicaObjectListItemEx *first_object;
126 struct drsuapi_DsReplicaObjectListItemEx *cur;
127 uint32_t linked_attributes_count;
128 struct drsuapi_DsReplicaLinkedAttribute *linked_attributes;
129 const struct drsuapi_DsReplicaCursor2CtrEx *uptodateness_vector;
130 struct dsdb_extended_replicated_objects *objs;
131 struct repsFromTo1 *s_dsa;
133 struct ldb_message *msg;
134 struct ldb_val prefixMap_val;
135 struct ldb_message_element *prefixMap_el;
136 struct ldb_val schemaInfo_val;
142 DEBUG(0,("Analyze and apply schema objects\n"));
144 s_dsa = talloc_zero(s, struct repsFromTo1);
145 NT_STATUS_HAVE_NO_MEMORY(s_dsa);
146 s_dsa->other_info = talloc(s_dsa, struct repsFromTo1OtherInfo);
147 NT_STATUS_HAVE_NO_MEMORY(s_dsa->other_info);
149 switch (c->ctr_level) {
151 mapping_ctr = &c->ctr1->mapping_ctr;
152 total_object_count = c->ctr1->total_object_count;
153 object_count = s->schema_part.object_count;
154 first_object = s->schema_part.first_object;
155 linked_attributes_count = 0;
156 linked_attributes = NULL;
157 s_dsa->highwatermark = c->ctr1->new_highwatermark;
158 s_dsa->source_dsa_obj_guid = c->ctr1->source_dsa_guid;
159 s_dsa->source_dsa_invocation_id = c->ctr1->source_dsa_invocation_id;
160 uptodateness_vector = NULL; /* TODO: map it */
163 mapping_ctr = &c->ctr6->mapping_ctr;
164 total_object_count = c->ctr6->total_object_count;
165 object_count = s->schema_part.object_count;
166 first_object = s->schema_part.first_object;
167 linked_attributes_count = 0; /* TODO: ! */
168 linked_attributes = NULL; /* TODO: ! */;
169 s_dsa->highwatermark = c->ctr6->new_highwatermark;
170 s_dsa->source_dsa_obj_guid = c->ctr6->source_dsa_guid;
171 s_dsa->source_dsa_invocation_id = c->ctr6->source_dsa_invocation_id;
172 uptodateness_vector = c->ctr6->uptodateness_vector;
175 return NT_STATUS_INVALID_PARAMETER;
178 s_dsa->replica_flags = DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE
179 | DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
180 | DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS;
181 memset(s_dsa->schedule, 0x11, sizeof(s_dsa->schedule));
183 tmp_dns_name = GUID_string(s_dsa->other_info, &s_dsa->source_dsa_obj_guid);
184 NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name);
185 tmp_dns_name = talloc_asprintf_append_buffer(tmp_dns_name, "._msdcs.%s", c->forest->dns_name);
186 NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name);
187 s_dsa->other_info->dns_name = tmp_dns_name;
189 for (cur = first_object; cur; cur = cur->next_object) {
190 bool is_attr = false;
191 bool is_class = false;
193 for (i=0; i < cur->object.attribute_ctr.num_attributes; i++) {
194 struct drsuapi_DsReplicaAttribute *a;
196 const char *oid = NULL;
198 a = &cur->object.attribute_ctr.attributes[i];
199 status = dsdb_map_int2oid(s->self_made_schema, a->attid, s, &oid);
200 if (!W_ERROR_IS_OK(status)) {
201 return werror_to_ntstatus(status);
205 case DRSUAPI_ATTRIBUTE_objectClass:
206 for (j=0; j < a->value_ctr.num_values; j++) {
207 uint32_t val = 0xFFFFFFFF;
209 if (a->value_ctr.values[i].blob
210 && a->value_ctr.values[i].blob->length == 4) {
211 val = IVAL(a->value_ctr.values[i].blob->data,0);
214 if (val == DRSUAPI_OBJECTCLASS_attributeSchema) {
217 if (val == DRSUAPI_OBJECTCLASS_classSchema) {
229 struct dsdb_attribute *sa;
231 sa = talloc_zero(s->self_made_schema, struct dsdb_attribute);
232 NT_STATUS_HAVE_NO_MEMORY(sa);
234 status = dsdb_attribute_from_drsuapi(s->self_made_schema, &cur->object, s, sa);
235 if (!W_ERROR_IS_OK(status)) {
236 return werror_to_ntstatus(status);
239 DLIST_ADD_END(s->self_made_schema->attributes, sa, struct dsdb_attribute *);
243 struct dsdb_class *sc;
245 sc = talloc_zero(s->self_made_schema, struct dsdb_class);
246 NT_STATUS_HAVE_NO_MEMORY(sc);
248 status = dsdb_class_from_drsuapi(s->self_made_schema, &cur->object, s, sc);
249 if (!W_ERROR_IS_OK(status)) {
250 return werror_to_ntstatus(status);
253 DLIST_ADD_END(s->self_made_schema->classes, sc, struct dsdb_class *);
257 /* attach the schema to the ldb */
258 ret = dsdb_set_schema(s->ldb, s->self_made_schema);
259 if (ret != LDB_SUCCESS) {
260 return NT_STATUS_FOOBAR;
262 /* we don't want to access the self made schema anymore */
263 s->self_made_schema = NULL;
264 s->schema = dsdb_get_schema(s->ldb);
266 status = dsdb_extended_replicated_objects_commit(s->ldb,
271 linked_attributes_count,
277 if (!W_ERROR_IS_OK(status)) {
278 DEBUG(0,("Failed to commit objects: %s\n", win_errstr(status)));
279 return werror_to_ntstatus(status);
282 if (lp_parm_bool(s->tctx->lp_ctx, NULL, "become dc", "dump objects", false)) {
283 for (i=0; i < objs->num_objects; i++) {
284 struct ldb_ldif ldif;
285 fprintf(stdout, "#\n");
286 ldif.changetype = LDB_CHANGETYPE_NONE;
287 ldif.msg = objs->objects[i].msg;
288 ldb_ldif_write_file(s->ldb, stdout, &ldif);
289 NDR_PRINT_DEBUG(replPropertyMetaDataBlob, objs->objects[i].meta_data);
293 msg = ldb_msg_new(objs);
294 NT_STATUS_HAVE_NO_MEMORY(msg);
295 msg->dn = objs->partition_dn;
297 status = dsdb_get_oid_mappings_ldb(s->schema, msg, &prefixMap_val, &schemaInfo_val);
298 if (!W_ERROR_IS_OK(status)) {
299 DEBUG(0,("Failed dsdb_get_oid_mappings_ldb(%s)\n", win_errstr(status)));
300 return werror_to_ntstatus(status);
303 /* we only add prefixMap here, because schemaInfo is a replicated attribute and already applied */
304 ret = ldb_msg_add_value(msg, "prefixMap", &prefixMap_val, &prefixMap_el);
305 if (ret != LDB_SUCCESS) {
306 return NT_STATUS_FOOBAR;
308 prefixMap_el->flags = LDB_FLAG_MOD_REPLACE;
310 ret = ldb_modify(s->ldb, msg);
311 if (ret != LDB_SUCCESS) {
312 DEBUG(0,("Failed to add prefixMap and schemaInfo %s\n", ldb_strerror(ret)));
313 return NT_STATUS_FOOBAR;
320 talloc_free(s->ldb); /* this also free's the s->schema, because dsdb_set_schema() steals it */
323 sam_ldb_path = talloc_asprintf(s, "%s/%s", s->targetdir, "private/sam.ldb");
324 DEBUG(0,("Reopen the SAM LDB with system credentials and a already stored schema: %s\n", sam_ldb_path));
325 s->ldb = ldb_wrap_connect(s, s->tctx->ev, s->tctx->lp_ctx, sam_ldb_path,
326 system_session(s, s->tctx->lp_ctx),
329 DEBUG(0,("Failed to open '%s'\n",
331 return NT_STATUS_INTERNAL_DB_ERROR;
334 ok = samdb_set_ntds_invocation_id(s->ldb, &c->dest_dsa->invocation_id);
336 DEBUG(0,("Failed to set cached ntds invocationId\n"));
337 return NT_STATUS_FOOBAR;
339 ok = samdb_set_ntds_objectGUID(s->ldb, &c->dest_dsa->ntds_guid);
341 DEBUG(0,("Failed to set cached ntds objectGUID\n"));
342 return NT_STATUS_FOOBAR;
345 s->schema = dsdb_get_schema(s->ldb);
347 DEBUG(0,("Failed to get loaded dsdb_schema\n"));
348 return NT_STATUS_FOOBAR;
354 static NTSTATUS test_become_dc_schema_chunk(void *private_data,
355 const struct libnet_BecomeDC_StoreChunk *c)
357 struct test_become_dc_state *s = talloc_get_type(private_data, struct test_become_dc_state);
359 const struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr;
360 uint32_t total_object_count;
361 uint32_t object_count;
362 struct drsuapi_DsReplicaObjectListItemEx *first_object;
363 struct drsuapi_DsReplicaObjectListItemEx *cur;
365 switch (c->ctr_level) {
367 mapping_ctr = &c->ctr1->mapping_ctr;
368 total_object_count = c->ctr1->total_object_count;
369 object_count = c->ctr1->object_count;
370 first_object = c->ctr1->first_object;
373 mapping_ctr = &c->ctr6->mapping_ctr;
374 total_object_count = c->ctr6->total_object_count;
375 object_count = c->ctr6->object_count;
376 first_object = c->ctr6->first_object;
379 return NT_STATUS_INVALID_PARAMETER;
382 if (total_object_count) {
383 DEBUG(0,("Schema-DN[%s] objects[%u/%u]\n",
384 c->partition->nc.dn, object_count, total_object_count));
386 DEBUG(0,("Schema-DN[%s] objects[%u]\n",
387 c->partition->nc.dn, object_count));
391 s->self_made_schema = dsdb_new_schema(s, lp_iconv_convenience(s->lp_ctx));
393 NT_STATUS_HAVE_NO_MEMORY(s->self_made_schema);
395 status = dsdb_load_oid_mappings_drsuapi(s->self_made_schema, mapping_ctr);
396 if (!W_ERROR_IS_OK(status)) {
397 return werror_to_ntstatus(status);
400 s->schema = s->self_made_schema;
402 status = dsdb_verify_oid_mappings_drsuapi(s->schema, mapping_ctr);
403 if (!W_ERROR_IS_OK(status)) {
404 return werror_to_ntstatus(status);
408 if (!s->schema_part.first_object) {
409 s->schema_part.object_count = object_count;
410 s->schema_part.first_object = talloc_steal(s, first_object);
412 s->schema_part.object_count += object_count;
413 s->schema_part.last_object->next_object = talloc_steal(s->schema_part.last_object,
416 for (cur = first_object; cur->next_object; cur = cur->next_object) {}
417 s->schema_part.last_object = cur;
419 if (c->partition->highwatermark.tmp_highest_usn == c->partition->highwatermark.highest_usn) {
420 return test_apply_schema(s, c);
426 static NTSTATUS test_become_dc_store_chunk(void *private_data,
427 const struct libnet_BecomeDC_StoreChunk *c)
429 struct test_become_dc_state *s = talloc_get_type(private_data, struct test_become_dc_state);
431 const struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr;
432 uint32_t total_object_count;
433 uint32_t object_count;
434 struct drsuapi_DsReplicaObjectListItemEx *first_object;
435 uint32_t linked_attributes_count;
436 struct drsuapi_DsReplicaLinkedAttribute *linked_attributes;
437 const struct drsuapi_DsReplicaCursor2CtrEx *uptodateness_vector;
438 struct dsdb_extended_replicated_objects *objs;
439 struct repsFromTo1 *s_dsa;
443 s_dsa = talloc_zero(s, struct repsFromTo1);
444 NT_STATUS_HAVE_NO_MEMORY(s_dsa);
445 s_dsa->other_info = talloc(s_dsa, struct repsFromTo1OtherInfo);
446 NT_STATUS_HAVE_NO_MEMORY(s_dsa->other_info);
448 switch (c->ctr_level) {
450 mapping_ctr = &c->ctr1->mapping_ctr;
451 total_object_count = c->ctr1->total_object_count;
452 object_count = c->ctr1->object_count;
453 first_object = c->ctr1->first_object;
454 linked_attributes_count = 0;
455 linked_attributes = NULL;
456 s_dsa->highwatermark = c->ctr1->new_highwatermark;
457 s_dsa->source_dsa_obj_guid = c->ctr1->source_dsa_guid;
458 s_dsa->source_dsa_invocation_id = c->ctr1->source_dsa_invocation_id;
459 uptodateness_vector = NULL; /* TODO: map it */
462 mapping_ctr = &c->ctr6->mapping_ctr;
463 total_object_count = c->ctr6->total_object_count;
464 object_count = c->ctr6->object_count;
465 first_object = c->ctr6->first_object;
466 linked_attributes_count = c->ctr6->linked_attributes_count;
467 linked_attributes = c->ctr6->linked_attributes;
468 s_dsa->highwatermark = c->ctr6->new_highwatermark;
469 s_dsa->source_dsa_obj_guid = c->ctr6->source_dsa_guid;
470 s_dsa->source_dsa_invocation_id = c->ctr6->source_dsa_invocation_id;
471 uptodateness_vector = c->ctr6->uptodateness_vector;
474 return NT_STATUS_INVALID_PARAMETER;
477 s_dsa->replica_flags = DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE
478 | DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
479 | DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS;
480 memset(s_dsa->schedule, 0x11, sizeof(s_dsa->schedule));
482 tmp_dns_name = GUID_string(s_dsa->other_info, &s_dsa->source_dsa_obj_guid);
483 NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name);
484 tmp_dns_name = talloc_asprintf_append_buffer(tmp_dns_name, "._msdcs.%s", c->forest->dns_name);
485 NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name);
486 s_dsa->other_info->dns_name = tmp_dns_name;
488 if (total_object_count) {
489 DEBUG(0,("Partition[%s] objects[%u/%u]\n",
490 c->partition->nc.dn, object_count, total_object_count));
492 DEBUG(0,("Partition[%s] objects[%u]\n",
493 c->partition->nc.dn, object_count));
496 status = dsdb_extended_replicated_objects_commit(s->ldb,
501 linked_attributes_count,
507 if (!W_ERROR_IS_OK(status)) {
508 DEBUG(0,("Failed to commit objects: %s\n", win_errstr(status)));
509 return werror_to_ntstatus(status);
512 if (lp_parm_bool(s->tctx->lp_ctx, NULL, "become dc", "dump objects", false)) {
513 for (i=0; i < objs->num_objects; i++) {
514 struct ldb_ldif ldif;
515 fprintf(stdout, "#\n");
516 ldif.changetype = LDB_CHANGETYPE_NONE;
517 ldif.msg = objs->objects[i].msg;
518 ldb_ldif_write_file(s->ldb, stdout, &ldif);
519 NDR_PRINT_DEBUG(replPropertyMetaDataBlob, objs->objects[i].meta_data);
525 for (i=0; i < linked_attributes_count; i++) {
526 const struct dsdb_attribute *sa;
528 if (!linked_attributes[i].identifier) {
529 return NT_STATUS_FOOBAR;
532 if (!linked_attributes[i].value.blob) {
533 return NT_STATUS_FOOBAR;
536 sa = dsdb_attribute_by_attributeID_id(s->schema,
537 linked_attributes[i].attid);
539 return NT_STATUS_FOOBAR;
542 if (lp_parm_bool(s->tctx->lp_ctx, NULL, "become dc", "dump objects", false)) {
543 DEBUG(0,("# %s\n", sa->lDAPDisplayName));
544 NDR_PRINT_DEBUG(drsuapi_DsReplicaLinkedAttribute, &linked_attributes[i]);
546 linked_attributes[i].value.blob->data,
547 linked_attributes[i].value.blob->length);
554 bool torture_net_become_dc(struct torture_context *torture)
558 struct libnet_BecomeDC b;
559 struct libnet_UnbecomeDC u;
560 struct test_become_dc_state *s;
561 struct ldb_message *msg;
566 char *location = NULL;
567 torture_assert_ntstatus_ok(torture, torture_temp_dir(torture, "libnet_BecomeDC", &location),
568 "torture_temp_dir should return NT_STATUS_OK" );
570 s = talloc_zero(torture, struct test_become_dc_state);
571 if (!s) return false;
574 s->lp_ctx = torture->lp_ctx;
576 s->netbios_name = lp_parm_string(torture->lp_ctx, NULL, "become dc", "smbtorture dc");
577 if (!s->netbios_name || !s->netbios_name[0]) {
578 s->netbios_name = "smbtorturedc";
581 s->targetdir = location;
583 /* Join domain as a member server. */
584 s->tj = torture_join_domain(torture, s->netbios_name,
586 &s->machine_account);
588 DEBUG(0, ("%s failed to join domain as workstation\n",
593 s->ctx = libnet_context_init(torture->ev, torture->lp_ctx);
594 s->ctx->cred = cmdline_credentials;
596 s->ldb = ldb_init(s);
599 b.in.domain_dns_name = torture_join_dom_dns_name(s->tj);
600 b.in.domain_netbios_name = torture_join_dom_netbios_name(s->tj);
601 b.in.domain_sid = torture_join_sid(s->tj);
602 b.in.source_dsa_address = torture_setting_string(torture, "host", NULL);
603 b.in.dest_dsa_netbios_name = s->netbios_name;
605 b.in.callbacks.private_data = s;
606 b.in.callbacks.check_options = test_become_dc_check_options;
607 b.in.callbacks.prepare_db = test_become_dc_prepare_db;
608 b.in.callbacks.schema_chunk = test_become_dc_schema_chunk;
609 b.in.callbacks.config_chunk = test_become_dc_store_chunk;
610 b.in.callbacks.domain_chunk = test_become_dc_store_chunk;
612 status = libnet_BecomeDC(s->ctx, s, &b);
613 if (!NT_STATUS_IS_OK(status)) {
614 printf("libnet_BecomeDC() failed - %s\n", nt_errstr(status));
619 msg = ldb_msg_new(s);
621 printf("ldb_msg_new() failed\n");
625 msg->dn = ldb_dn_new(msg, s->ldb, "@ROOTDSE");
627 printf("ldb_msg_new(@ROOTDSE) failed\n");
632 ldb_ret = ldb_msg_add_string(msg, "isSynchronized", "TRUE");
633 if (ldb_ret != LDB_SUCCESS) {
634 printf("ldb_msg_add_string(msg, isSynchronized, TRUE) failed: %d\n", ldb_ret);
639 for (i=0; i < msg->num_elements; i++) {
640 msg->elements[i].flags = LDB_FLAG_MOD_REPLACE;
643 printf("mark ROOTDSE with isSynchronized=TRUE\n");
644 ldb_ret = ldb_modify(s->ldb, msg);
645 if (ldb_ret != LDB_SUCCESS) {
646 printf("ldb_modify() failed: %d\n", ldb_ret);
652 talloc_free(s->ldb); /* this also free's the s->schema, because dsdb_set_schema() steals it */
655 sam_ldb_path = talloc_asprintf(s, "%s/%s", s->targetdir, "private/sam.ldb");
656 DEBUG(0,("Reopen the SAM LDB with system credentials and all replicated data: %s\n", sam_ldb_path));
657 s->ldb = ldb_wrap_connect(s, s->tctx->ev, s->lp_ctx, sam_ldb_path,
658 system_session(s, s->lp_ctx),
661 DEBUG(0,("Failed to open '%s'\n",
667 s->schema = dsdb_get_schema(s->ldb);
669 DEBUG(0,("Failed to get loaded dsdb_schema\n"));
674 /* Make sure we get this from the command line */
675 if (lp_parm_bool(torture->lp_ctx, NULL, "become dc", "do not unjoin", false)) {
682 u.in.domain_dns_name = torture_join_dom_dns_name(s->tj);
683 u.in.domain_netbios_name = torture_join_dom_netbios_name(s->tj);
684 u.in.source_dsa_address = torture_setting_string(torture, "host", NULL);
685 u.in.dest_dsa_netbios_name = s->netbios_name;
687 status = libnet_UnbecomeDC(s->ctx, s, &u);
688 if (!NT_STATUS_IS_OK(status)) {
689 printf("libnet_UnbecomeDC() failed - %s\n", nt_errstr(status));
694 torture_leave_domain(s->tj);