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

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