Blame SOURCES/0067-Ticket-49380-Crash-when-adding-invalid-replication.patch

b69e47
From af59afa03296160577e419257772d5319796a992 Mon Sep 17 00:00:00 2001
b69e47
From: Mark Reynolds <mreynolds@redhat.com>
b69e47
Date: Thu, 14 Sep 2017 08:32:11 -0400
b69e47
Subject: [PATCH] Ticket 49380 - Crash when adding invalid replication 
b69e47
 agreement
b69e47
b69e47
    Bug Description:  If you add a replication agreement with an invalid "replicaEnabled" value
b69e47
                      the server crashes when freeing the replica schedule.  This is because the
b69e47
                      schedule never gets allocated before the rror conidtion is hit, and then
b69e47
                      it get dereferenced.
b69e47
b69e47
    Fix Description:  Check for a NULL schedule before trying to destroy it.
b69e47
b69e47
    https://pagure.io/389-ds-base/issue/49380
b69e47
b69e47
    Reviewed by: tbordaz(Thanks!)
b69e47
---
b69e47
 ldap/servers/plugins/replication/repl5_schedule.c | 10 +++++++++-
b69e47
 1 file changed, 9 insertions(+), 1 deletion(-)
b69e47
b69e47
diff --git a/ldap/servers/plugins/replication/repl5_schedule.c b/ldap/servers/plugins/replication/repl5_schedule.c
b69e47
index 60ee6f2..4572e63 100644
b69e47
--- a/ldap/servers/plugins/replication/repl5_schedule.c
b69e47
+++ b/ldap/servers/plugins/replication/repl5_schedule.c
b69e47
@@ -130,6 +130,10 @@ schedule_destroy(Schedule *s)
b69e47
 {
b69e47
 	int i;
b69e47
 
b69e47
+	if (s == NULL) {
b69e47
+		return;
b69e47
+	}
b69e47
+
b69e47
     /* unschedule update window event if exists */
b69e47
     unschedule_window_state_change_event (s);
b69e47
 
b69e47
@@ -177,11 +181,15 @@ free_schedule_list(schedule_item **schedule_list)
b69e47
 int
b69e47
 schedule_set(Schedule *sch, Slapi_Attr *attr)
b69e47
 {
b69e47
-	int return_value;
b69e47
+	int return_value = -1;
b69e47
 	schedule_item *si = NULL;
b69e47
 	schedule_item *new_schedule_list = NULL;
b69e47
 	int valid = 1;
b69e47
 	
b69e47
+	if (sch == NULL) {
b69e47
+		return return_value;
b69e47
+	}
b69e47
+
b69e47
 	if (NULL != attr)
b69e47
 	{
b69e47
 		int ind;
b69e47
-- 
b69e47
2.9.5
b69e47