#include "librpc/gen_ndr/ndr_drsblobs.h"
#include "librpc/gen_ndr/ndr_irpc.h"
#include "param/param.h"
+#include "libds/common/roles.h"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_DRS_REPL
/**
* Call-back data for _drepl_replica_sync_done_cb()
{
service->system_session_info = system_session(service->task->lp_ctx);
if (service->system_session_info == NULL) {
- return WERR_NOMEM;
+ return WERR_NOT_ENOUGH_MEMORY;
}
return WERR_OK;
} else {
cb_data = talloc_zero(msg, struct drepl_replica_sync_cb_data);
if (!cb_data) {
- REPLICA_SYNC_FAIL("Not enought memory",
+ REPLICA_SYNC_FAIL("Not enough memory",
WERR_DS_DRA_INTERNAL_ERROR);
}
werr = dreplsrv_partition_source_dsa_by_guid(p,
&req1->source_dsa_guid,
&dsa);
+ if (W_ERROR_EQUAL(werr, WERR_DS_DRA_NO_REPLICA)) {
+ /* we don't have this source setup as
+ a replication partner. Create a
+ temporary dsa structure for this
+ replication */
+ werr = dreplsrv_partition_source_dsa_temporary(p,
+ msg,
+ &req1->source_dsa_guid,
+ &dsa);
+ }
}
if (!W_ERROR_IS_OK(werr)) {
REPLICA_SYNC_FAIL("Failed to locate source DSA for given NC",
* schedule replication event to force
* replication as soon as possible
*/
- dreplsrv_periodic_schedule(service, 0);
+ dreplsrv_pendingops_schedule_pull_now(service);
done:
return NT_STATUS_OK;
task_server_terminate(task, "dreplsrv: no DSDB replication required in domain member configuration",
false);
return;
- case ROLE_DOMAIN_CONTROLLER:
+ case ROLE_ACTIVE_DIRECTORY_DC:
/* Yes, we want DSDB replication */
break;
}
return;
}
+ service->pending.im = tevent_create_immediate(service);
+ if (service->pending.im == NULL) {
+ task_server_terminate(task,
+ "dreplsrv: Failed to create immediate "
+ "task for future DsReplicaSync\n",
+ true);
+ return;
+ }
+
/* if we are a RODC then we do not send DSReplicaSync*/
if (!service->am_rodc) {
service->notify.interval = lpcfg_parm_int(task->lp_ctx, NULL, "dreplsrv",
/*
register ourselves as a available server
*/
-NTSTATUS server_service_drepl_init(void)
+NTSTATUS server_service_drepl_init(TALLOC_CTX *ctx)
{
- return register_server_service("drepl", dreplsrv_task_init);
+ return register_server_service(ctx, "drepl", dreplsrv_task_init);
}