summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Boreham <dboreham@redhat.com>2005-05-06 03:33:36 +0000
committerDavid Boreham <dboreham@redhat.com>2005-05-06 03:33:36 +0000
commitc574a5401c8a26ed4d760331097d3d2ea2bb3359 (patch)
tree9d29823d4dc0a332baf16960565a3823e1e45931
parent2930910e6503a99d220454203a10f01e6503e31b (diff)
downloadds-c574a5401c8a26ed4d760331097d3d2ea2bb3359.tar.gz
ds-c574a5401c8a26ed4d760331097d3d2ea2bb3359.tar.xz
ds-c574a5401c8a26ed4d760331097d3d2ea2bb3359.zip
Fix for #155591: treat an ruv with no min_csn as pristine
-rw-r--r--ldap/servers/plugins/replication/repl5_ruv.c21
-rw-r--r--ldap/servers/plugins/replication/repl5_ruv.h1
-rw-r--r--ldap/servers/plugins/replication/windows_inc_protocol.c9
3 files changed, 30 insertions, 1 deletions
diff --git a/ldap/servers/plugins/replication/repl5_ruv.c b/ldap/servers/plugins/replication/repl5_ruv.c
index effc4af2..6ece3676 100644
--- a/ldap/servers/plugins/replication/repl5_ruv.c
+++ b/ldap/servers/plugins/replication/repl5_ruv.c
@@ -1857,6 +1857,27 @@ PRBool ruv_has_csns(const RUV *ruv)
return retval;
}
+PRBool ruv_has_both_csns(const RUV *ruv)
+{
+ PRBool retval = PR_TRUE;
+ CSN *mincsn = NULL;
+ CSN *maxcsn = NULL;
+
+ ruv_get_min_csn(ruv, &mincsn);
+ ruv_get_max_csn(ruv, &maxcsn);
+ if (mincsn) {
+ csn_free(&mincsn);
+ csn_free(&maxcsn);
+ } else if (maxcsn) {
+ csn_free(&maxcsn);
+ retval = PR_FALSE; /* it has a maxcsn but no mincsn */
+ } else {
+ retval = PR_FALSE; /* both min and max are false */
+ }
+
+ return retval;
+}
+
/* Check if the first ruv is newer than the second one */
PRBool
ruv_is_newer (Object *sruvobj, Object *cruvobj)
diff --git a/ldap/servers/plugins/replication/repl5_ruv.h b/ldap/servers/plugins/replication/repl5_ruv.h
index a85318b4..aa4b04db 100644
--- a/ldap/servers/plugins/replication/repl5_ruv.h
+++ b/ldap/servers/plugins/replication/repl5_ruv.h
@@ -112,6 +112,7 @@ int ruv_local_contains_supplier(RUV *ruv, ReplicaId rid);
/* returns true if the ruv has any csns, false otherwise - used for testing
whether or not an RUV is empty */
PRBool ruv_has_csns(const RUV *ruv);
+PRBool ruv_has_both_csns(const RUV *ruv);
PRBool ruv_is_newer (Object *sruv, Object *cruv);
void ruv_force_csn_update (RUV *ruv, CSN *csn);
#ifdef __cplusplus
diff --git a/ldap/servers/plugins/replication/windows_inc_protocol.c b/ldap/servers/plugins/replication/windows_inc_protocol.c
index b5325b92..c3a642ef 100644
--- a/ldap/servers/plugins/replication/windows_inc_protocol.c
+++ b/ldap/servers/plugins/replication/windows_inc_protocol.c
@@ -1632,7 +1632,14 @@ windows_examine_update_vector(Private_Repl_Protocol *prp, RUV *remote_ruv)
}
else
{
- return_value = EXAMINE_RUV_OK;
+ /* Check for the case where part of the RUV remote is missing */
+ if (ruv_has_both_csns(remote_ruv))
+ {
+ return_value = EXAMINE_RUV_OK;
+ } else
+ {
+ return_value = EXAMINE_RUV_PRISTINE_REPLICA;
+ }
}
slapi_ch_free((void**)&remote_gen);
slapi_ch_free((void**)&local_gen);