-/*
+/*
Unix SMB/CIFS implementation.
DsGetNCChanges replication test
Copyright (C) Stefan (metze) Metzmacher 2005
Copyright (C) Brad Henry 2005
-
+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
struct DsSyncTest {
struct dcerpc_binding *drsuapi_binding;
-
+
const char *ldap_url;
const char *site_name;
const char *dest_address;
&b->drs_pipe, ctx->drsuapi_binding,
&ndr_table_drsuapi,
credentials, tctx->ev, tctx->lp_ctx);
-
+
if (!NT_STATUS_IS_OK(status)) {
printf("Failed to connect to server as a BDC: %s\n", nt_errstr(status));
return false;
return ret;
}
-static bool test_LDAPBind(struct torture_context *tctx, struct DsSyncTest *ctx,
+static bool test_LDAPBind(struct torture_context *tctx, struct DsSyncTest *ctx,
struct cli_credentials *credentials, struct DsSyncLDAPInfo *l)
{
bool ret = true;
talloc_free(ldb);
torture_assert_int_equal(tctx, ret, LDB_SUCCESS, "Failed to make LDB connection to target");
}
-
+
printf("connected to LDAP: %s\n", ctx->ldap_url);
return true;
}
ctx->domain_dn = r.out.ctr->ctr1->array[0].result_name;
-
+
ZERO_STRUCT(search);
search.in.dest_address = NULL;
search.in.dest_port = 0;
if (!NT_STATUS_IS_OK(status)) {
const char *errstr = nt_errstr(status);
ctx->site_name = talloc_asprintf(ctx, "%s", "Default-First-Site-Name");
- printf("cldap_netlogon() returned %s. Defaulting to Site-Name: %s\n", errstr, ctx->site_name);
+ printf("cldap_netlogon() returned %s. Defaulting to Site-Name: %s\n", errstr, ctx->site_name);
} else {
ctx->site_name = talloc_steal(ctx, search.out.netlogon.data.nt5_ex.client_site);
printf("cldap_netlogon() returned Client Site-Name: %s.\n",ctx->site_name);
return ret;
}
-static bool test_analyse_objects(struct torture_context *tctx,
+static bool test_analyse_objects(struct torture_context *tctx,
struct DsSyncTest *ctx,
- const char *partition,
+ const char *partition,
const struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr,
uint32_t object_count,
const struct drsuapi_DsReplicaObjectListItemEx *first_object,
struct dsdb_extended_replicated_objects *objs;
struct ldb_extended_dn_control *extended_dn_ctrl;
const char *err_msg;
-
+
if (!dsdb_get_schema(ldb, NULL)) {
struct dsdb_schema *ldap_schema;
struct ldb_result *a_res;
"dsdb_attribute_from_ldb() failed for: %s",
ldb_dn_get_linearized(a_res->msgs[i]->dn)));
}
-
+
for (i=0; i < c_res->count; i++) {
status = dsdb_class_from_ldb(ldap_schema, c_res->msgs[i]);
torture_assert_werr_ok(tctx, status,
mapping_ctr,
object_count,
first_object,
- 0, NULL,
- NULL, NULL,
+ 0, NULL,
+ NULL, NULL,
gensec_skey,
ctx, &objs);
torture_assert_werr_ok(tctx, status, "dsdb_extended_replicated_objects_convert() failed!");
deleted_dn = ldb_dn_new(objs, ldb, partition);
ldb_dn_add_child_fmt(deleted_dn, "CN=Deleted Objects");
-
+
for (i=0; i < object_count; i++) {
struct ldb_request *search_req;
struct ldb_result *res;
if (!res) {
return LDB_ERR_OPERATIONS_ERROR;
}
- ret = ldb_build_search_req(&search_req, ldb, objs,
+ ret = ldb_build_search_req(&search_req, ldb, objs,
objs->objects[i].msg->dn,
LDB_SCOPE_BASE,
NULL,
for (j=0; j < ldap_msg->num_elements; j++) {
ldap_msg->elements[j].flags = LDB_FLAG_MOD_ADD;
/* For unknown reasons, there is no nTSecurityDescriptor on cn=deleted objects over LDAP, but there is over DRS! Skip it on both transports for now here so */
- if ((ldb_attr_cmp(ldap_msg->elements[j].name, "nTSecurityDescriptor") == 0) &&
+ if ((ldb_attr_cmp(ldap_msg->elements[j].name, "nTSecurityDescriptor") == 0) &&
(ldb_dn_compare(ldap_msg->dn, deleted_dn) == 0)) {
ldb_msg_remove_element(ldap_msg, &ldap_msg->elements[j]);
/* Don't skip one */
ldb_msg_remove_element(drs_msg, &drs_msg->elements[j]);
/* Don't skip one */
j--;
-
+
/* For unknown reasons, there is no nTSecurityDescriptor on cn=deleted objects over LDAP, but there is over DRS! */
- } else if ((ldb_attr_cmp(drs_msg->elements[j].name, "nTSecurityDescriptor") == 0) &&
+ } else if ((ldb_attr_cmp(drs_msg->elements[j].name, "nTSecurityDescriptor") == 0) &&
(ldb_dn_compare(drs_msg->dn, deleted_dn) == 0)) {
ldb_msg_remove_element(drs_msg, &drs_msg->elements[j]);
/* Don't skip one */
drs_msg->elements[j].flags = LDB_FLAG_MOD_ADD;
}
}
-
-
+
+
new_msg = ldb_msg_diff(ldb, drs_msg, ldap_msg);
talloc_steal(search_req, new_msg);
if (new_msg->num_elements != 0) {
if (!lp_parm_bool(tctx->lp_ctx, NULL, "dssync", "print_pwd_blobs", false)) {
talloc_free(objs);
- return true;
+ return true;
}
save_values_dir = lp_parm_string(tctx->lp_ctx, NULL, "dssync", "save_pwd_blobs_dir");
case 5:
nc.guid = null_guid;
nc.sid = null_sid;
- nc.dn = partition;
+ nc.dn = partition;
r.in.req = &req;
r.in.req->req5.destination_dsa_guid = ctx->new_dc.invocation_id;
case 8:
nc.guid = null_guid;
nc.sid = null_sid;
- nc.dn = partition;
+ nc.dn = partition;
/* nc.dn can be set to any other ad partition */
r.in.req = &req;
break;
}
-
+
printf("Dumping AD partition: %s\n", nc.dn);
for (y=0; ;y++) {
uint32_t _level = 0;
ctr1->new_highwatermark.tmp_highest_usn,
ctr1->new_highwatermark.highest_usn);
- if (!test_analyse_objects(tctx, ctx, partition, &ctr1->mapping_ctr, ctr1->object_count,
+ if (!test_analyse_objects(tctx, ctx, partition, &ctr1->mapping_ctr, ctr1->object_count,
ctr1->first_object, &gensec_skey)) {
return false;
}
ctr6->new_highwatermark.tmp_highest_usn,
ctr6->new_highwatermark.highest_usn);
- if (!test_analyse_objects(tctx, ctx, partition, &ctr6->mapping_ctr, ctr6->object_count,
+ if (!test_analyse_objects(tctx, ctx, partition, &ctr6->mapping_ctr, ctr6->object_count,
ctr6->first_object, &gensec_skey)) {
return false;
}
return ret;
}
-static bool test_FetchNT4Data(struct torture_context *tctx,
+static bool test_FetchNT4Data(struct torture_context *tctx,
struct DsSyncTest *ctx)
{
NTSTATUS status;