summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-01-19 15:33:11 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:43:50 -0500
commit0f6a080ee3b7e773c595cf67a402eaab81da079f (patch)
tree1eb858d147d2e33a7d1719f0cd8d80ceecd5da81
parent89278a1469fe8f6c6080d6cb6b81de504802470d (diff)
downloadsamba-0f6a080ee3b7e773c595cf67a402eaab81da079f.tar.gz
samba-0f6a080ee3b7e773c595cf67a402eaab81da079f.tar.bz2
samba-0f6a080ee3b7e773c595cf67a402eaab81da079f.zip
r20907: reset krbtgt, machine and administator account passwords to "test"
(same values which are given the provision code for setup test_secrets.ldb) metze (This used to be commit 42a0304b1f903894bf6902baea47c86e64f9f60a)
-rw-r--r--source4/torture/libnet/libnet_BecomeDC.c92
1 files changed, 91 insertions, 1 deletions
diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c
index 79dc7acc99..3ed4d8ab8b 100644
--- a/source4/torture/libnet/libnet_BecomeDC.c
+++ b/source4/torture/libnet/libnet_BecomeDC.c
@@ -113,6 +113,8 @@ struct test_become_dc_state {
struct drsuapi_DsReplicaObjectListItemEx *first_object;
struct drsuapi_DsReplicaObjectListItemEx *last_object;
} schema_part;
+
+ const char *computer_dn;
};
static NTSTATUS test_become_dc_check_options(void *private_data,
@@ -691,6 +693,92 @@ static NTSTATUS test_become_dc_store_chunk(void *private_data,
return NT_STATUS_OK;
}
+static NTSTATUS test_become_dc_domain_chunk(void *private_data,
+ const struct libnet_BecomeDC_StoreChunk *c)
+{
+ struct test_become_dc_state *s = talloc_get_type(private_data, struct test_become_dc_state);
+
+ s->computer_dn = talloc_strdup(s, c->dest_dsa->computer_dn_str);
+ NT_STATUS_HAVE_NO_MEMORY(s->computer_dn);
+
+ return test_become_dc_store_chunk(private_data, c);
+}
+
+static BOOL test_become_dc_set_test_passwords(struct test_become_dc_state *s)
+{
+ struct ldb_message *msg;
+ int ret;
+
+ printf("Set up \"test\" as password for the krbtgt, machine and administrator accounts\n");
+
+ /*
+ * first krbtgt password
+ */
+ msg = ldb_msg_new(s);
+ if (!msg) return False;
+
+ msg->dn = ldb_dn_new_fmt(msg, s->ldb, "CN=krbtgt,CN=Users,%s",
+ ldb_dn_get_linearized(samdb_base_dn(s->ldb)));
+ if (!msg) return False;
+
+ ret = ldb_msg_add_string(msg, "sambaPassword", "test");
+ if (ret != LDB_SUCCESS) return False;
+
+ ret = samdb_replace(s->ldb, s, msg);
+ if (ret != LDB_SUCCESS) {
+ printf("failed to replace sambaPassword for '%s': %s\n",
+ ldb_dn_get_linearized(msg->dn),
+ ldb_strerror(ret));
+ return False;
+ }
+ talloc_free(msg);
+
+ /*
+ * our machine account password
+ */
+ msg = ldb_msg_new(s);
+ if (!msg) return False;
+
+ msg->dn = ldb_dn_new(msg, s->ldb, s->computer_dn);
+ if (!msg) return False;
+
+ ret = ldb_msg_add_string(msg, "sambaPassword", "test");
+ if (ret != LDB_SUCCESS) return False;
+
+ ret = samdb_replace(s->ldb, s, msg);
+ if (ret != LDB_SUCCESS) {
+ printf("failed to replace sambaPassword for '%s': %s\n",
+ ldb_dn_get_linearized(msg->dn),
+ ldb_strerror(ret));
+ return False;
+ }
+ talloc_free(msg);
+
+ /*
+ * the Administrator account password
+ */
+ msg = ldb_msg_new(s);
+ if (!msg) return False;
+
+ msg->dn = ldb_dn_new_fmt(msg, s->ldb, "CN=Administrator,CN=Users,%s",
+ ldb_dn_get_linearized(samdb_base_dn(s->ldb)));
+ if (!msg) return False;
+
+ ret = ldb_msg_add_string(msg, "sambaPassword", "test");
+ if (ret != LDB_SUCCESS) return False;
+
+ ret = samdb_replace(s->ldb, s, msg);
+ if (ret != LDB_SUCCESS) {
+ printf("failed to replace sambaPassword for '%s': %s\n",
+ ldb_dn_get_linearized(msg->dn),
+ ldb_strerror(ret));
+ return False;
+ }
+ talloc_free(msg);
+
+ return True;
+}
+
BOOL torture_net_become_dc(struct torture_context *torture)
{
BOOL ret = True;
@@ -732,7 +820,7 @@ BOOL torture_net_become_dc(struct torture_context *torture)
b.in.callbacks.prepare_db = test_become_dc_prepare_db;
b.in.callbacks.schema_chunk = test_become_dc_schema_chunk;
b.in.callbacks.config_chunk = test_become_dc_store_chunk;
- b.in.callbacks.domain_chunk = test_become_dc_store_chunk;
+ b.in.callbacks.domain_chunk = test_become_dc_domain_chunk;
status = libnet_BecomeDC(s->ctx, s, &b);
if (!NT_STATUS_IS_OK(status)) {
@@ -795,6 +883,8 @@ BOOL torture_net_become_dc(struct torture_context *torture)
goto cleanup;
}
+ ret &= test_become_dc_set_test_passwords(s);
+
cleanup:
ZERO_STRUCT(u);
u.in.domain_dns_name = torture_join_dom_dns_name(s->tj);