#include "auth/auth.h"
#include "smbd/service.h"
#include "lib/messaging/irpc.h"
+#include "dsdb/kcc/kcc_connection.h"
#include "dsdb/kcc/kcc_service.h"
#include "lib/ldb/include/ldb_errors.h"
#include "../lib/util/dlinklist.h"
We just add a repsFrom entry for all DCs we find that have nTDSDSA
objects, except for ourselves
*/
-static NTSTATUS kccsrv_simple_update(struct kccsrv_service *s, TALLOC_CTX *mem_ctx)
+NTSTATUS kccsrv_simple_update(struct kccsrv_service *s, TALLOC_CTX *mem_ctx)
{
struct ldb_result *res;
int ret, i;
const char *attrs[] = { "objectGUID", "invocationID", NULL };
struct repsFromToBlob *reps = NULL;
uint32_t count = 0;
+ struct kcc_connection_list *ntds_conn, *dsa_conn;
ret = ldb_search(s->samdb, mem_ctx, &res, s->config_dn, LDB_SCOPE_SUBTREE,
attrs, "objectClass=nTDSDSA");
return NT_STATUS_INTERNAL_DB_CORRUPTION;
}
+ /* get the current list of connections */
+ ntds_conn = kccsrv_find_connections(s, mem_ctx);
+
+ dsa_conn = talloc_zero(mem_ctx, struct kcc_connection_list);
+
for (i=0; i<res->count; i++) {
struct repsFromTo1 *r1;
struct GUID ntds_guid, invocation_id;
r1->other_info = talloc_zero(reps, struct repsFromTo1OtherInfo);
r1->other_info->dns_name = talloc_asprintf(r1->other_info, "%s._msdcs.%s",
GUID_string(mem_ctx, &ntds_guid),
- lp_realm(s->task->lp_ctx));
+ lp_dnsdomain(s->task->lp_ctx));
r1->source_dsa_obj_guid = ntds_guid;
r1->source_dsa_invocation_id = invocation_id;
r1->replica_flags =
- DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE |
- DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP |
- DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS;
+ DRSUAPI_DRS_WRIT_REP |
+ DRSUAPI_DRS_INIT_SYNC |
+ DRSUAPI_DRS_PER_SYNC;
memset(r1->schedule, 0x11, sizeof(r1->schedule));
+
+ dsa_conn->servers = talloc_realloc(dsa_conn, dsa_conn->servers,
+ struct kcc_connection,
+ dsa_conn->count + 1);
+ NT_STATUS_HAVE_NO_MEMORY(dsa_conn->servers);
+ dsa_conn->servers[dsa_conn->count].dsa_guid = r1->source_dsa_obj_guid;
+ dsa_conn->count++;
+
count++;
}
+ kccsrv_apply_connections(s, ntds_conn, dsa_conn);
+
return kccsrv_add_repsFrom(s, mem_ctx, reps, count);
}
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("kccsrv_simple_update failed - %s\n", nt_errstr(status)));
}
+
+ status = kccsrv_check_deleted(service, mem_ctx);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(0,("kccsrv_check_deleted failed - %s\n", nt_errstr(status)));
+ }
talloc_free(mem_ctx);
}