Add kccsrv_add_repsFrom() possibility of NULL res argument
authorDave Craft <wimberosa@gmail.com>
Wed, 6 Jul 2011 02:34:32 +0000 (21:34 -0500)
committerAndrew Tridgell <tridge@samba.org>
Wed, 13 Jul 2011 21:05:10 +0000 (07:05 +1000)
We need the ability to utilize this function in a different
manner.  KCC intra-site topology has already vetted the
replica as being appropriate to produce a repsFrom from.
We do not want kccsrv_add_repsFrom() to produce further
checking as was the case for simple topology.   Thus if
we pass a NULL (res) parameter this extra check will
be skipped.

Signed-off-by: Andrew Tridgell <tridge@samba.org>
source4/dsdb/kcc/kcc_periodic.c

index ad61e71025c0055d4003e13e01a7ba732eba1580..820aee350020db699868edcc5a9877cca346740e 100644 (file)
@@ -226,7 +226,7 @@ NTSTATUS kccsrv_add_repsFrom(struct kccsrv_service *s, TALLOC_CTX *mem_ctx,
                                /* we don't have the new one - add it
                                 * if it is a master
                                 */
-                               if (!check_MasterNC(p, &reps[i], res)) {
+                               if (res && !check_MasterNC(p, &reps[i], res)) {
                                        /* its not a master, we don't
                                           want to pull from it */
                                        continue;
@@ -246,7 +246,7 @@ NTSTATUS kccsrv_add_repsFrom(struct kccsrv_service *s, TALLOC_CTX *mem_ctx,
                /* remove any stale ones */
                for (i=0; i<our_count; i++) {
                        if (!reps_in_list(&our_reps[i], reps, count) ||
-                           !check_MasterNC(p, &our_reps[i], res)) {
+                           (res && !check_MasterNC(p, &our_reps[i], res))) {
                                DEBUG(4,(__location__ ": Removed repsFrom for %s\n",
                                         our_reps[i].ctr.ctr1.other_info->dns_name));
                                memmove(&our_reps[i], &our_reps[i+1], (our_count-(i+1))*sizeof(our_reps[0]));