summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/dsdb/kcc/kcc_periodic.c7
-rw-r--r--source4/dsdb/kcc/kcc_service.c5
-rw-r--r--source4/dsdb/kcc/kcc_service.h2
-rw-r--r--source4/dsdb/kcc/kcc_topology.c21
4 files changed, 14 insertions, 21 deletions
diff --git a/source4/dsdb/kcc/kcc_periodic.c b/source4/dsdb/kcc/kcc_periodic.c
index c396912aa3..bfb6bdc3a5 100644
--- a/source4/dsdb/kcc/kcc_periodic.c
+++ b/source4/dsdb/kcc/kcc_periodic.c
@@ -307,9 +307,12 @@ NTSTATUS kccsrv_simple_update(struct kccsrv_service *s, TALLOC_CTX *mem_ctx)
r1->source_dsa_obj_guid = ntds_guid;
r1->source_dsa_invocation_id = invocation_id;
r1->replica_flags =
- DRSUAPI_DRS_WRIT_REP |
DRSUAPI_DRS_INIT_SYNC |
- DRSUAPI_DRS_PER_SYNC;
+ DRSUAPI_DRS_PER_SYNC |
+ DRSUAPI_DRS_ADD_REF;
+ if (!s->am_rodc) {
+ r1->replica_flags |= DRSUAPI_DRS_WRIT_REP;
+ }
memset(r1->schedule, 0x11, sizeof(r1->schedule));
dsa_conn->servers = talloc_realloc(dsa_conn, dsa_conn->servers,
diff --git a/source4/dsdb/kcc/kcc_service.c b/source4/dsdb/kcc/kcc_service.c
index 9bacca9bc7..0d78443d98 100644
--- a/source4/dsdb/kcc/kcc_service.c
+++ b/source4/dsdb/kcc/kcc_service.c
@@ -67,6 +67,11 @@ static WERROR kccsrv_connect_samdb(struct kccsrv_service *service, struct loadpa
service->ntds_guid = *ntds_guid;
+ if (samdb_rodc(service->samdb, &service->am_rodc) != LDB_SUCCESS) {
+ DEBUG(0,(__location__ ": Failed to determine RODC status\n"));
+ return WERR_DS_UNAVAILABLE;
+ }
+
return WERR_OK;
}
diff --git a/source4/dsdb/kcc/kcc_service.h b/source4/dsdb/kcc/kcc_service.h
index 64c78a361f..f56488560a 100644
--- a/source4/dsdb/kcc/kcc_service.h
+++ b/source4/dsdb/kcc/kcc_service.h
@@ -80,6 +80,8 @@ struct kccsrv_service {
} periodic;
time_t last_deleted_check;
+
+ bool am_rodc;
};
struct kcc_connection_list;
diff --git a/source4/dsdb/kcc/kcc_topology.c b/source4/dsdb/kcc/kcc_topology.c
index cb32a0bf81..fbf2885ad8 100644
--- a/source4/dsdb/kcc/kcc_topology.c
+++ b/source4/dsdb/kcc/kcc_topology.c
@@ -1077,7 +1077,6 @@ static NTSTATUS kcctpl_get_all_bridgehead_dcs(struct kccsrv_service *service,
const char * const dc_attrs[] = { "objectGUID", "options", NULL };
struct ldb_message_element *el;
unsigned int i;
- bool rodc;
const char *transport_name, *transport_address_attr;
uint64_t site_opts;
@@ -1156,14 +1155,6 @@ static NTSTATUS kcctpl_get_all_bridgehead_dcs(struct kccsrv_service *service,
el = ldb_msg_find_element(transport, "bridgeheadServerListBL");
- ret = samdb_rodc(ldb, &rodc);
- if (ret != LDB_SUCCESS) {
- DEBUG(1, (__location__ ": unable to tell if we are an RODC: %s\n",
- ldb_strerror(ret)));
- talloc_free(tmp_ctx);
- return NT_STATUS_INTERNAL_DB_CORRUPTION;
- }
-
transport_name = samdb_result_string(transport, "name", NULL);
if (!transport_name) {
DEBUG(1, (__location__ ": failed to find name attribute of "
@@ -3151,7 +3142,7 @@ static NTSTATUS kcctpl_create_connections(struct kccsrv_service *service,
bool *_found_failed_dcs,
bool *_connected)
{
- bool connected, found_failed_dcs, partial_replica_okay, rodc;
+ bool connected, found_failed_dcs, partial_replica_okay;
NTSTATUS status;
struct ldb_message *site;
TALLOC_CTX *tmp_ctx;
@@ -3231,14 +3222,6 @@ static NTSTATUS kcctpl_create_connections(struct kccsrv_service *service,
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
- ret = samdb_rodc(ldb, &rodc);
- if (ret != LDB_SUCCESS) {
- DEBUG(1, (__location__ ": Unable to tell if we are an RODC: %s\n",
- ldb_strerror(ret)));
- talloc_free(tmp_ctx);
- return NT_STATUS_INTERNAL_DB_CORRUPTION;
- }
-
for (i = 0; i < st_edge_list.count; i++) {
struct kcctpl_multi_edge *edge;
struct GUID other_site_id;
@@ -3309,7 +3292,7 @@ static NTSTATUS kcctpl_create_connections(struct kccsrv_service *service,
return status;
}
- if (rodc) {
+ if (service->am_rodc) {
/* TODO: l_bridgehad = nTDSDSA of local DC */
} else {
status = kcctpl_get_bridgehead_dc(service, tmp_ctx,