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 "auth/auth.h"
38 #include "lib/ldb_wrap.h"
39 #include "param/param.h"
40 #include "torture/util.h"
42 struct test_become_dc_state {
43 struct libnet_context *ctx;
44 struct torture_context *tctx;
45 const char *netbios_name;
47 struct cli_credentials *machine_account;
48 struct dsdb_schema *self_made_schema;
49 const struct dsdb_schema *schema;
51 struct ldb_context *ldb;
54 uint32_t object_count;
55 struct drsuapi_DsReplicaObjectListItemEx *first_object;
56 struct drsuapi_DsReplicaObjectListItemEx *last_object;
60 const char *samdb_ldb;
61 const char *domaindn_ldb;
62 const char *configdn_ldb;
63 const char *schemadn_ldb;
64 const char *secrets_ldb;
65 const char *templates_ldb;
66 const char *secrets_keytab;
67 const char *dns_keytab;
71 static NTSTATUS test_become_dc_check_options(void *private_data,
72 const struct libnet_BecomeDC_CheckOptions *o)
74 struct test_become_dc_state *s = talloc_get_type(private_data, struct test_become_dc_state);
76 DEBUG(0,("Become DC [%s] of Domain[%s]/[%s]\n",
78 o->domain->netbios_name, o->domain->dns_name));
80 DEBUG(0,("Promotion Partner is Server[%s] from Site[%s]\n",
81 o->source_dsa->dns_name, o->source_dsa->site_name));
83 DEBUG(0,("Options:crossRef behavior_version[%u]\n"
84 "\tschema object_version[%u]\n"
85 "\tdomain behavior_version[%u]\n"
86 "\tdomain w2k3_update_revision[%u]\n",
87 o->forest->crossref_behavior_version,
88 o->forest->schema_object_version,
89 o->domain->behavior_version,
90 o->domain->w2k3_update_revision));
95 static NTSTATUS test_apply_schema(struct test_become_dc_state *s,
96 const struct libnet_BecomeDC_StoreChunk *c)
99 const struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr;
100 uint32_t total_object_count;
101 uint32_t object_count;
102 struct drsuapi_DsReplicaObjectListItemEx *first_object;
103 struct drsuapi_DsReplicaObjectListItemEx *cur;
104 uint32_t linked_attributes_count;
105 struct drsuapi_DsReplicaLinkedAttribute *linked_attributes;
106 const struct drsuapi_DsReplicaCursor2CtrEx *uptodateness_vector;
107 struct dsdb_extended_replicated_objects *objs;
108 struct repsFromTo1 *s_dsa;
110 struct ldb_message *msg;
111 struct ldb_val prefixMap_val;
112 struct ldb_message_element *prefixMap_el;
113 struct ldb_val schemaInfo_val;
118 DEBUG(0,("Analyze and apply schema objects\n"));
120 s_dsa = talloc_zero(s, struct repsFromTo1);
121 NT_STATUS_HAVE_NO_MEMORY(s_dsa);
122 s_dsa->other_info = talloc(s_dsa, struct repsFromTo1OtherInfo);
123 NT_STATUS_HAVE_NO_MEMORY(s_dsa->other_info);
125 switch (c->ctr_level) {
127 mapping_ctr = &c->ctr1->mapping_ctr;
128 total_object_count = c->ctr1->total_object_count;
129 object_count = s->schema_part.object_count;
130 first_object = s->schema_part.first_object;
131 linked_attributes_count = 0;
132 linked_attributes = NULL;
133 s_dsa->highwatermark = c->ctr1->new_highwatermark;
134 s_dsa->source_dsa_obj_guid = c->ctr1->source_dsa_guid;
135 s_dsa->source_dsa_invocation_id = c->ctr1->source_dsa_invocation_id;
136 uptodateness_vector = NULL; /* TODO: map it */
139 mapping_ctr = &c->ctr6->mapping_ctr;
140 total_object_count = c->ctr6->total_object_count;
141 object_count = s->schema_part.object_count;
142 first_object = s->schema_part.first_object;
143 linked_attributes_count = 0; /* TODO: ! */
144 linked_attributes = NULL; /* TODO: ! */;
145 s_dsa->highwatermark = c->ctr6->new_highwatermark;
146 s_dsa->source_dsa_obj_guid = c->ctr6->source_dsa_guid;
147 s_dsa->source_dsa_invocation_id = c->ctr6->source_dsa_invocation_id;
148 uptodateness_vector = c->ctr6->uptodateness_vector;
151 return NT_STATUS_INVALID_PARAMETER;
154 s_dsa->replica_flags = DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE
155 | DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
156 | DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS;
157 memset(s_dsa->schedule, 0x11, sizeof(s_dsa->schedule));
159 tmp_dns_name = GUID_string(s_dsa->other_info, &s_dsa->source_dsa_obj_guid);
160 NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name);
161 tmp_dns_name = talloc_asprintf_append_buffer(tmp_dns_name, "._msdcs.%s", c->forest->dns_name);
162 NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name);
163 s_dsa->other_info->dns_name = tmp_dns_name;
165 for (cur = first_object; cur; cur = cur->next_object) {
166 bool is_attr = false;
167 bool is_class = false;
169 for (i=0; i < cur->object.attribute_ctr.num_attributes; i++) {
170 struct drsuapi_DsReplicaAttribute *a;
172 const char *oid = NULL;
174 a = &cur->object.attribute_ctr.attributes[i];
175 status = dsdb_map_int2oid(s->self_made_schema, a->attid, s, &oid);
176 if (!W_ERROR_IS_OK(status)) {
177 return werror_to_ntstatus(status);
181 case DRSUAPI_ATTRIBUTE_objectClass:
182 for (j=0; j < a->value_ctr.num_values; j++) {
183 uint32_t val = 0xFFFFFFFF;
185 if (a->value_ctr.values[i].blob
186 && a->value_ctr.values[i].blob->length == 4) {
187 val = IVAL(a->value_ctr.values[i].blob->data,0);
190 if (val == DRSUAPI_OBJECTCLASS_attributeSchema) {
193 if (val == DRSUAPI_OBJECTCLASS_classSchema) {
205 struct dsdb_attribute *sa;
207 sa = talloc_zero(s->self_made_schema, struct dsdb_attribute);
208 NT_STATUS_HAVE_NO_MEMORY(sa);
210 status = dsdb_attribute_from_drsuapi(s->self_made_schema, &cur->object, s, sa);
211 if (!W_ERROR_IS_OK(status)) {
212 return werror_to_ntstatus(status);
215 DLIST_ADD_END(s->self_made_schema->attributes, sa, struct dsdb_attribute *);
219 struct dsdb_class *sc;
221 sc = talloc_zero(s->self_made_schema, struct dsdb_class);
222 NT_STATUS_HAVE_NO_MEMORY(sc);
224 status = dsdb_class_from_drsuapi(s->self_made_schema, &cur->object, s, sc);
225 if (!W_ERROR_IS_OK(status)) {
226 return werror_to_ntstatus(status);
229 DLIST_ADD_END(s->self_made_schema->classes, sc, struct dsdb_class *);
233 /* attach the schema to the ldb */
234 ret = dsdb_set_schema(s->ldb, s->self_made_schema);
235 if (ret != LDB_SUCCESS) {
236 return NT_STATUS_FOOBAR;
238 /* we don't want to access the self made schema anymore */
239 s->self_made_schema = NULL;
240 s->schema = dsdb_get_schema(s->ldb);
242 status = dsdb_extended_replicated_objects_commit(s->ldb,
247 linked_attributes_count,
253 if (!W_ERROR_IS_OK(status)) {
254 DEBUG(0,("Failed to commit objects: %s\n", win_errstr(status)));
255 return werror_to_ntstatus(status);
258 if (lp_parm_bool(s->tctx->lp_ctx, NULL, "become dc", "dump objects", false)) {
259 for (i=0; i < objs->num_objects; i++) {
260 struct ldb_ldif ldif;
261 fprintf(stdout, "#\n");
262 ldif.changetype = LDB_CHANGETYPE_NONE;
263 ldif.msg = objs->objects[i].msg;
264 ldb_ldif_write_file(s->ldb, stdout, &ldif);
265 NDR_PRINT_DEBUG(replPropertyMetaDataBlob, objs->objects[i].meta_data);
269 msg = ldb_msg_new(objs);
270 NT_STATUS_HAVE_NO_MEMORY(msg);
271 msg->dn = objs->partition_dn;
273 status = dsdb_get_oid_mappings_ldb(s->schema, msg, &prefixMap_val, &schemaInfo_val);
274 if (!W_ERROR_IS_OK(status)) {
275 DEBUG(0,("Failed dsdb_get_oid_mappings_ldb(%s)\n", win_errstr(status)));
276 return werror_to_ntstatus(status);
279 /* we only add prefixMap here, because schemaInfo is a replicated attribute and already applied */
280 ret = ldb_msg_add_value(msg, "prefixMap", &prefixMap_val, &prefixMap_el);
281 if (ret != LDB_SUCCESS) {
282 return NT_STATUS_FOOBAR;
284 prefixMap_el->flags = LDB_FLAG_MOD_REPLACE;
286 ret = ldb_modify(s->ldb, msg);
287 if (ret != LDB_SUCCESS) {
288 DEBUG(0,("Failed to add prefixMap and schemaInfo %s\n", ldb_strerror(ret)));
289 return NT_STATUS_FOOBAR;
296 talloc_free(s->ldb); /* this also free's the s->schema, because dsdb_set_schema() steals it */
299 DEBUG(0,("Reopen the SAM LDB with system credentials and a already stored schema: %s\n", s->path.samdb_ldb));
300 s->ldb = ldb_wrap_connect(s, s->tctx->lp_ctx, s->path.samdb_ldb,
301 system_session(s, s->tctx->lp_ctx),
304 DEBUG(0,("Failed to open '%s'\n",
306 return NT_STATUS_INTERNAL_DB_ERROR;
309 ok = samdb_set_ntds_invocation_id(s->ldb, &c->dest_dsa->invocation_id);
311 DEBUG(0,("Failed to set cached ntds invocationId\n"));
312 return NT_STATUS_FOOBAR;
314 ok = samdb_set_ntds_objectGUID(s->ldb, &c->dest_dsa->ntds_guid);
316 DEBUG(0,("Failed to set cached ntds objectGUID\n"));
317 return NT_STATUS_FOOBAR;
320 s->schema = dsdb_get_schema(s->ldb);
322 DEBUG(0,("Failed to get loaded dsdb_schema\n"));
323 return NT_STATUS_FOOBAR;
329 static NTSTATUS test_become_dc_schema_chunk(void *private_data,
330 const struct libnet_BecomeDC_StoreChunk *c)
332 struct test_become_dc_state *s = talloc_get_type(private_data, struct test_become_dc_state);
334 const struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr;
335 uint32_t total_object_count;
336 uint32_t object_count;
337 struct drsuapi_DsReplicaObjectListItemEx *first_object;
338 struct drsuapi_DsReplicaObjectListItemEx *cur;
340 switch (c->ctr_level) {
342 mapping_ctr = &c->ctr1->mapping_ctr;
343 total_object_count = c->ctr1->total_object_count;
344 object_count = c->ctr1->object_count;
345 first_object = c->ctr1->first_object;
348 mapping_ctr = &c->ctr6->mapping_ctr;
349 total_object_count = c->ctr6->total_object_count;
350 object_count = c->ctr6->object_count;
351 first_object = c->ctr6->first_object;
354 return NT_STATUS_INVALID_PARAMETER;
357 if (total_object_count) {
358 DEBUG(0,("Schema-DN[%s] objects[%u/%u]\n",
359 c->partition->nc.dn, object_count, total_object_count));
361 DEBUG(0,("Schema-DN[%s] objects[%u]\n",
362 c->partition->nc.dn, object_count));
366 s->self_made_schema = talloc_zero(s, struct dsdb_schema);
367 NT_STATUS_HAVE_NO_MEMORY(s->self_made_schema);
369 status = dsdb_load_oid_mappings_drsuapi(s->self_made_schema, mapping_ctr);
370 if (!W_ERROR_IS_OK(status)) {
371 return werror_to_ntstatus(status);
374 s->schema = s->self_made_schema;
376 status = dsdb_verify_oid_mappings_drsuapi(s->schema, mapping_ctr);
377 if (!W_ERROR_IS_OK(status)) {
378 return werror_to_ntstatus(status);
382 if (!s->schema_part.first_object) {
383 s->schema_part.object_count = object_count;
384 s->schema_part.first_object = talloc_steal(s, first_object);
386 s->schema_part.object_count += object_count;
387 s->schema_part.last_object->next_object = talloc_steal(s->schema_part.last_object,
390 for (cur = first_object; cur->next_object; cur = cur->next_object) {}
391 s->schema_part.last_object = cur;
393 if (c->partition->highwatermark.tmp_highest_usn == c->partition->highwatermark.highest_usn) {
394 return test_apply_schema(s, c);
400 static NTSTATUS test_become_dc_store_chunk(void *private_data,
401 const struct libnet_BecomeDC_StoreChunk *c)
403 struct test_become_dc_state *s = talloc_get_type(private_data, struct test_become_dc_state);
405 const struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr;
406 uint32_t total_object_count;
407 uint32_t object_count;
408 struct drsuapi_DsReplicaObjectListItemEx *first_object;
409 uint32_t linked_attributes_count;
410 struct drsuapi_DsReplicaLinkedAttribute *linked_attributes;
411 const struct drsuapi_DsReplicaCursor2CtrEx *uptodateness_vector;
412 struct dsdb_extended_replicated_objects *objs;
413 struct repsFromTo1 *s_dsa;
417 s_dsa = talloc_zero(s, struct repsFromTo1);
418 NT_STATUS_HAVE_NO_MEMORY(s_dsa);
419 s_dsa->other_info = talloc(s_dsa, struct repsFromTo1OtherInfo);
420 NT_STATUS_HAVE_NO_MEMORY(s_dsa->other_info);
422 switch (c->ctr_level) {
424 mapping_ctr = &c->ctr1->mapping_ctr;
425 total_object_count = c->ctr1->total_object_count;
426 object_count = c->ctr1->object_count;
427 first_object = c->ctr1->first_object;
428 linked_attributes_count = 0;
429 linked_attributes = NULL;
430 s_dsa->highwatermark = c->ctr1->new_highwatermark;
431 s_dsa->source_dsa_obj_guid = c->ctr1->source_dsa_guid;
432 s_dsa->source_dsa_invocation_id = c->ctr1->source_dsa_invocation_id;
433 uptodateness_vector = NULL; /* TODO: map it */
436 mapping_ctr = &c->ctr6->mapping_ctr;
437 total_object_count = c->ctr6->total_object_count;
438 object_count = c->ctr6->object_count;
439 first_object = c->ctr6->first_object;
440 linked_attributes_count = c->ctr6->linked_attributes_count;
441 linked_attributes = c->ctr6->linked_attributes;
442 s_dsa->highwatermark = c->ctr6->new_highwatermark;
443 s_dsa->source_dsa_obj_guid = c->ctr6->source_dsa_guid;
444 s_dsa->source_dsa_invocation_id = c->ctr6->source_dsa_invocation_id;
445 uptodateness_vector = c->ctr6->uptodateness_vector;
448 return NT_STATUS_INVALID_PARAMETER;
451 s_dsa->replica_flags = DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE
452 | DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
453 | DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS;
454 memset(s_dsa->schedule, 0x11, sizeof(s_dsa->schedule));
456 tmp_dns_name = GUID_string(s_dsa->other_info, &s_dsa->source_dsa_obj_guid);
457 NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name);
458 tmp_dns_name = talloc_asprintf_append_buffer(tmp_dns_name, "._msdcs.%s", c->forest->dns_name);
459 NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name);
460 s_dsa->other_info->dns_name = tmp_dns_name;
462 if (total_object_count) {
463 DEBUG(0,("Partition[%s] objects[%u/%u]\n",
464 c->partition->nc.dn, object_count, total_object_count));
466 DEBUG(0,("Partition[%s] objects[%u]\n",
467 c->partition->nc.dn, object_count));
470 status = dsdb_extended_replicated_objects_commit(s->ldb,
475 linked_attributes_count,
481 if (!W_ERROR_IS_OK(status)) {
482 DEBUG(0,("Failed to commit objects: %s\n", win_errstr(status)));
483 return werror_to_ntstatus(status);
486 if (lp_parm_bool(s->tctx->lp_ctx, NULL, "become dc", "dump objects", false)) {
487 for (i=0; i < objs->num_objects; i++) {
488 struct ldb_ldif ldif;
489 fprintf(stdout, "#\n");
490 ldif.changetype = LDB_CHANGETYPE_NONE;
491 ldif.msg = objs->objects[i].msg;
492 ldb_ldif_write_file(s->ldb, stdout, &ldif);
493 NDR_PRINT_DEBUG(replPropertyMetaDataBlob, objs->objects[i].meta_data);
499 for (i=0; i < linked_attributes_count; i++) {
500 const struct dsdb_attribute *sa;
502 if (!linked_attributes[i].identifier) {
503 return NT_STATUS_FOOBAR;
506 if (!linked_attributes[i].value.blob) {
507 return NT_STATUS_FOOBAR;
510 sa = dsdb_attribute_by_attributeID_id(s->schema,
511 linked_attributes[i].attid);
513 return NT_STATUS_FOOBAR;
516 if (lp_parm_bool(s->tctx->lp_ctx, NULL, "become dc", "dump objects", false)) {
517 DEBUG(0,("# %s\n", sa->lDAPDisplayName));
518 NDR_PRINT_DEBUG(drsuapi_DsReplicaLinkedAttribute, &linked_attributes[i]);
520 linked_attributes[i].value.blob->data,
521 linked_attributes[i].value.blob->length);
528 bool torture_net_become_dc(struct torture_context *torture)
532 struct libnet_BecomeDC b;
533 struct libnet_UnbecomeDC u;
534 struct test_become_dc_state *s;
535 struct ldb_message *msg;
539 s = talloc_zero(torture, struct test_become_dc_state);
540 if (!s) return false;
544 s->netbios_name = lp_parm_string(torture->lp_ctx, NULL, "become dc", "smbtorture dc");
545 if (!s->netbios_name || !s->netbios_name[0]) {
546 s->netbios_name = "smbtorturedc";
549 s->path.samdb_ldb = talloc_asprintf(s, "%s_samdb.ldb", s->netbios_name);
550 if (!s->path.samdb_ldb) return false;
551 s->path.domaindn_ldb = talloc_asprintf(s, "%s_domain.ldb", s->netbios_name);
552 if (!s->path.domaindn_ldb) return false;
553 s->path.configdn_ldb = talloc_asprintf(s, "%s_config.ldb", s->netbios_name);
554 if (!s->path.configdn_ldb) return false;
555 s->path.schemadn_ldb = talloc_asprintf(s, "%s_schema.ldb", s->netbios_name);
556 if (!s->path.schemadn_ldb) return false;
557 s->path.secrets_ldb = talloc_asprintf(s, "%s_secrets.ldb", s->netbios_name);
558 if (!s->path.secrets_ldb) return false;
559 s->path.templates_ldb = talloc_asprintf(s, "%s_templates.ldb", s->netbios_name);
560 if (!s->path.templates_ldb) return false;
561 s->path.secrets_keytab = talloc_asprintf(s, "%s_secrets.keytab", s->netbios_name);
562 if (!s->path.secrets_keytab) return false;
563 s->path.dns_keytab = talloc_asprintf(s, "%s_dns.keytab", s->netbios_name);
564 if (!s->path.dns_keytab) return false;
566 /* Join domain as a member server. */
567 s->tj = torture_join_domain(torture, s->netbios_name,
569 &s->machine_account);
571 DEBUG(0, ("%s failed to join domain as workstation\n",
576 s->ctx = libnet_context_init(torture->ev, torture->lp_ctx);
577 s->ctx->cred = cmdline_credentials;
579 s->ldb = ldb_init(s);
582 b.in.domain_dns_name = torture_join_dom_dns_name(s->tj);
583 b.in.domain_netbios_name = torture_join_dom_netbios_name(s->tj);
584 b.in.domain_sid = torture_join_sid(s->tj);
585 b.in.source_dsa_address = torture_setting_string(torture, "host", NULL);
586 b.in.dest_dsa_netbios_name = s->netbios_name;
588 b.in.callbacks.private_data = s;
589 b.in.callbacks.check_options = test_become_dc_check_options;
590 b.in.callbacks.prepare_db = test_become_dc_prepare_db;
591 b.in.callbacks.schema_chunk = test_become_dc_schema_chunk;
592 b.in.callbacks.config_chunk = test_become_dc_store_chunk;
593 b.in.callbacks.domain_chunk = test_become_dc_store_chunk;
595 status = libnet_BecomeDC(s->ctx, s, &b);
596 if (!NT_STATUS_IS_OK(status)) {
597 printf("libnet_BecomeDC() failed - %s\n", nt_errstr(status));
602 msg = ldb_msg_new(s);
604 printf("ldb_msg_new() failed\n");
608 msg->dn = ldb_dn_new(msg, s->ldb, "@ROOTDSE");
610 printf("ldb_msg_new(@ROOTDSE) failed\n");
615 ldb_ret = ldb_msg_add_string(msg, "isSynchronized", "TRUE");
616 if (ldb_ret != LDB_SUCCESS) {
617 printf("ldb_msg_add_string(msg, isSynchronized, TRUE) failed: %d\n", ldb_ret);
622 for (i=0; i < msg->num_elements; i++) {
623 msg->elements[i].flags = LDB_FLAG_MOD_REPLACE;
626 printf("mark ROOTDSE with isSynchronized=TRUE\n");
627 ldb_ret = ldb_modify(s->ldb, msg);
628 if (ldb_ret != LDB_SUCCESS) {
629 printf("ldb_modify() failed: %d\n", ldb_ret);
635 talloc_free(s->ldb); /* this also free's the s->schema, because dsdb_set_schema() steals it */
638 DEBUG(0,("Reopen the SAM LDB with system credentials and all replicated data: %s\n", s->path.samdb_ldb));
639 s->ldb = ldb_wrap_connect(s, torture->lp_ctx, s->path.samdb_ldb,
640 system_session(s, torture->lp_ctx),
643 DEBUG(0,("Failed to open '%s'\n",
649 s->schema = dsdb_get_schema(s->ldb);
651 DEBUG(0,("Failed to get loaded dsdb_schema\n"));
656 if (lp_parm_bool(torture->lp_ctx, NULL, "become dc", "do not unjoin", false)) {
663 u.in.domain_dns_name = torture_join_dom_dns_name(s->tj);
664 u.in.domain_netbios_name = torture_join_dom_netbios_name(s->tj);
665 u.in.source_dsa_address = torture_setting_string(torture, "host", NULL);
666 u.in.dest_dsa_netbios_name = s->netbios_name;
668 status = libnet_UnbecomeDC(s->ctx, s, &u);
669 if (!NT_STATUS_IS_OK(status)) {
670 printf("libnet_UnbecomeDC() failed - %s\n", nt_errstr(status));
675 torture_leave_domain(s->tj);