s4-repl: fall back to repsFrom if repsTo not set
authorAndrew Tridgell <tridge@samba.org>
Mon, 14 Sep 2009 10:43:26 +0000 (03:43 -0700)
committerAndrew Tridgell <tridge@samba.org>
Mon, 14 Sep 2009 16:41:52 +0000 (09:41 -0700)
Windows does not seem to be always setting up repsTo using
DsUpdateRefs(). For now we will fall back to using repsFrom if repsTo
is empty. This is almost certainly incorrect, but it does get
notification based replication working with both w2k3 and w2k8.

source4/dsdb/repl/drepl_notify.c

index 83c6df48dc2eff88acb8603b5b7e09a4587ce4c4..73280917c52770c27936004bb4c32df637af1027 100644 (file)
@@ -293,13 +293,16 @@ static WERROR dreplsrv_notify_check(struct dreplsrv_service *s,
                                    struct dreplsrv_partition *p,
                                    TALLOC_CTX *mem_ctx)
 {
-       uint32_t count;
+       uint32_t count=0;
        struct repsFromToBlob *reps;
        WERROR werr;
        uint64_t uSN;
        int ret, i;
 
        werr = dsdb_loadreps(s->samdb, mem_ctx, p->dn, "repsTo", &reps, &count);
+       if (count == 0) {
+               werr = dsdb_loadreps(s->samdb, mem_ctx, p->dn, "repsFrom", &reps, &count);
+       }
        if (!W_ERROR_IS_OK(werr)) {
                DEBUG(0,(__location__ ": Failed to load repsTo for %s\n",
                         ldb_dn_get_linearized(p->dn)));
@@ -331,7 +334,6 @@ static WERROR dreplsrv_notify_check(struct dreplsrv_service *s,
                }
        }
 
-
        return WERR_OK;
 }