ldap/servers/plugins/replication/repl5_agmt.c | 61 ++++++++------------------
1 file changed, 21 insertions(+), 40 deletions(-)
New commits:
commit 07cd61f6265067546758a4ee355b0a2c77279432
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Tue Feb 10 17:38:51 2015 -0800
Ticket #47836 - Do not return '0' as empty fallback value of
nsds5replicalastupdatestart and nsds5replicalastupdatestart
Bug Description: In a replica agreement entry, if any of the
nsds5replicaLastUpdateStart, nsds5replicaLastUpdateEnd,
nsds5replicaLastInitStart or nsds5replicaLastInitEnd are not set,
it's initialized as "0" which is invalid. It should be in the
LDAP Generalized time format.
Fix Description: When these attributes are not set, instead of "0"
they are initialized with the epoch time 0 == 19700101000000Z.
https://fedorahosted.org/389/ticket/47836
Reviewed by mreynolds(a)redhat.com (Thank you, Mark!!)
(cherry picked from commit ed0a504a876fcfcd229ceca8470763355d54f9c6)
diff --git a/ldap/servers/plugins/replication/repl5_agmt.c
b/ldap/servers/plugins/replication/repl5_agmt.c
index 91be757..7e66a44 100644
--- a/ldap/servers/plugins/replication/repl5_agmt.c
+++ b/ldap/servers/plugins/replication/repl5_agmt.c
@@ -2614,26 +2614,16 @@ get_agmt_status(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry*
entryAfter,
slapi_entry_attr_delete(e, "nsds5replicaLastInitEnd");
/* now, add the real values (singly) */
- if (ra->last_update_start_time == 0)
- {
- slapi_entry_add_string(e, "nsds5replicaLastUpdateStart", "0");
- }
- else
- {
- time_tmp = format_genTime(ra->last_update_start_time);
- slapi_entry_add_string(e, "nsds5replicaLastUpdateStart", time_tmp);
- slapi_ch_free((void **)&time_tmp);
- }
- if (ra->last_update_end_time == 0)
- {
- slapi_entry_add_string(e, "nsds5replicaLastUpdateEnd", "0");
- }
- else
- {
- time_tmp = format_genTime(ra->last_update_end_time);
- slapi_entry_add_string(e, "nsds5replicaLastUpdateEnd", time_tmp);
- slapi_ch_free((void **)&time_tmp);
- }
+ /* In case last_update_start_time is not set, 19700101000000Z is set. */
+ time_tmp = format_genTime(ra->last_update_start_time);
+ slapi_entry_add_string(e, "nsds5replicaLastUpdateStart", time_tmp);
+ slapi_ch_free((void **)&time_tmp);
+
+ /* In case last_update_end_time is not set, 19700101000000Z is set. */
+ time_tmp = format_genTime(ra->last_update_end_time);
+ slapi_entry_add_string(e, "nsds5replicaLastUpdateEnd", time_tmp);
+ slapi_ch_free((void **)&time_tmp);
+
agmt_get_changecount_string (ra, changecount_string, sizeof (changecount_string) );
slapi_entry_add_string(e, "nsds5replicaChangesSentSinceStartup",
changecount_string);
if (ra->last_update_status[0] == '\0')
@@ -2645,26 +2635,17 @@ get_agmt_status(Slapi_PBlock *pb, Slapi_Entry* e, Slapi_Entry*
entryAfter,
slapi_entry_add_string(e, "nsds5replicaLastUpdateStatus",
ra->last_update_status);
}
slapi_entry_add_string(e, "nsds5replicaUpdateInProgress",
ra->update_in_progress ? "TRUE" : "FALSE");
- if (ra->last_init_start_time == 0)
- {
- slapi_entry_add_string(e, "nsds5replicaLastInitStart", "0");
- }
- else
- {
- time_tmp = format_genTime(ra->last_init_start_time);
- slapi_entry_add_string(e, "nsds5replicaLastInitStart", time_tmp);
- slapi_ch_free((void **)&time_tmp);
- }
- if (ra->last_init_end_time == 0)
- {
- slapi_entry_add_string(e, "nsds5replicaLastInitEnd", "0");
- }
- else
- {
- time_tmp = format_genTime(ra->last_init_end_time);
- slapi_entry_add_string(e, "nsds5replicaLastInitEnd", time_tmp);
- slapi_ch_free((void **)&time_tmp);
- }
+
+ /* In case last_init_start_time is not set, 19700101000000Z is set. */
+ time_tmp = format_genTime(ra->last_init_start_time);
+ slapi_entry_add_string(e, "nsds5replicaLastInitStart", time_tmp);
+ slapi_ch_free((void **)&time_tmp);
+
+ /* In case last_init_end_time is not set, 19700101000000Z is set. */
+ time_tmp = format_genTime(ra->last_init_end_time);
+ slapi_entry_add_string(e, "nsds5replicaLastInitEnd", time_tmp);
+ slapi_ch_free((void **)&time_tmp);
+
if (ra->last_init_status[0] != '\0')
{
slapi_entry_add_string(e, "nsds5replicaLastInitStatus",
ra->last_init_status);