zrhoffman / rpms / 389-ds-base

Forked from rpms/389-ds-base 3 years ago
Clone

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

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