Correct "enought" typo.
[nivanova/samba-autobuild/.git] / source4 / dsdb / repl / drepl_service.c
index ec803f6fdb05c1345371e363cfdbdd6d6e59bb60..c0ea1f2ba23ffa7eea626d78a5985b508e1ce268 100644 (file)
@@ -33,6 +33,7 @@
 #include "librpc/gen_ndr/ndr_drsblobs.h"
 #include "librpc/gen_ndr/ndr_irpc.h"
 #include "param/param.h"
+#include "libds/common/roles.h"
 
 /**
  * Call-back data for _drepl_replica_sync_done_cb()
@@ -53,7 +54,7 @@ static WERROR dreplsrv_init_creds(struct dreplsrv_service *service)
 {
        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;
@@ -265,7 +266,7 @@ static NTSTATUS drepl_replica_sync(struct irpc_message *msg,
        } 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);
                }
 
@@ -306,6 +307,16 @@ static NTSTATUS drepl_replica_sync(struct irpc_message *msg,
                        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",
@@ -328,7 +339,7 @@ static NTSTATUS drepl_replica_sync(struct irpc_message *msg,
         * schedule replication event to force
         * replication as soon as possible
         */
-       dreplsrv_periodic_schedule(service, 0);
+       dreplsrv_pendingops_schedule(service, 0);
 
 done:
        return NT_STATUS_OK;
@@ -424,7 +435,7 @@ static void dreplsrv_task_init(struct task_server *task)
                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;
        }