summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-12-31 12:32:15 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:30:37 -0500
commit41d6fe36e7f4cd5170fdbed108b8e4d429e94338 (patch)
tree689111d7cf15caccedc66b2b406582895e6abb25
parentcc70ee0739d7ffb4b18c9fee56a906b9dc5f6877 (diff)
downloadsamba-41d6fe36e7f4cd5170fdbed108b8e4d429e94338.tar.gz
samba-41d6fe36e7f4cd5170fdbed108b8e4d429e94338.tar.bz2
samba-41d6fe36e7f4cd5170fdbed108b8e4d429e94338.zip
r20438: - bail out on conversation errors
- create a valid ldb_message - dump the ldb_message if --option="become dc:dump objects=yes" is passed to smbtorture metze (This used to be commit 34e126f6590e3fc7ac1f46e09e777993ca10401d)
-rw-r--r--source4/torture/libnet/libnet_BecomeDC.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c
index 9fc4231620..f9aedb8e72 100644
--- a/source4/torture/libnet/libnet_BecomeDC.c
+++ b/source4/torture/libnet/libnet_BecomeDC.c
@@ -37,6 +37,8 @@ struct test_become_dc_state {
struct cli_credentials *machine_account;
struct dsdb_schema *schema;
+ struct ldb_context *ldb;
+
struct {
struct drsuapi_DsReplicaObjectListItemEx *first_object;
struct drsuapi_DsReplicaObjectListItemEx *last_object;
@@ -99,16 +101,35 @@ static WERROR test_object_to_ldb(struct test_become_dc_state *s,
{
WERROR status;
uint32_t i;
+ struct ldb_message *msg;
+
+ msg = ldb_msg_new(mem_ctx);
+ W_ERROR_HAVE_NO_MEMORY(msg);
+
+ msg->dn = ldb_dn_new(msg, s->ldb, obj->object.identifier->dn);
+ W_ERROR_HAVE_NO_MEMORY(msg->dn);
+
+ msg->num_elements = obj->object.attribute_ctr.num_attributes;
+ msg->elements = talloc_array(msg, struct ldb_message_element,
+ msg->num_elements);
+ W_ERROR_HAVE_NO_MEMORY(msg->elements);
- for (i=0; i < obj->object.attribute_ctr.num_attributes; i++) {
+ for (i=0; i < msg->num_elements; i++) {
status = dsdb_attribute_drsuapi_to_ldb(s->schema,
&obj->object.attribute_ctr.attributes[i],
- mem_ctx, NULL);
-#if 0 /* ignore the error till all attribute syntaxes have a valid implementation */
+ msg->elements, &msg->elements[i]);
W_ERROR_NOT_OK_RETURN(status);
-#endif
}
+ if (lp_parm_bool(-1, "become dc", "dump objects", False)) {
+ struct ldb_ldif ldif;
+ fprintf(stdout, "#\n");
+ ldif.changetype = LDB_CHANGETYPE_NONE;
+ ldif.msg = msg;
+ ldb_ldif_write_file(s->ldb, stdout, &ldif);
+ }
+
+ *_msg = msg;
return WERR_OK;
}
@@ -335,6 +356,8 @@ BOOL torture_net_become_dc(struct torture_context *torture)
s->ctx = libnet_context_init(event_context_init(s));
s->ctx->cred = cmdline_credentials;
+ s->ldb = ldb_init(s);
+
ZERO_STRUCT(b);
b.in.domain_dns_name = torture_join_dom_dns_name(s->tj);
b.in.domain_netbios_name = torture_join_dom_netbios_name(s->tj);