Blame SOURCES/0001-Issue-4884-server-crashes-when-dnaInterval-attribute.patch

7e63d6
From 6e21d41f5d9f6437c00dd0150654415b172e391a Mon Sep 17 00:00:00 2001
7e63d6
From: Mark Reynolds <mreynolds@redhat.com>
7e63d6
Date: Wed, 25 Aug 2021 16:54:57 -0400
7e63d6
Subject: [PATCH 1/3] Issue 4884 - server crashes when dnaInterval attribute is
7e63d6
 set to zero
7e63d6
7e63d6
Bug Description:
7e63d6
7e63d6
A division by zero crash occurs if the dnaInterval is set to zero
7e63d6
7e63d6
Fix Description:
7e63d6
7e63d6
Validate the config value of dnaInterval and adjust it to the
7e63d6
default/safe value of "1" if needed.
7e63d6
7e63d6
relates: https://github.com/389ds/389-ds-base/issues/4884
7e63d6
7e63d6
Reviewed by: tbordaz(Thanks!)
7e63d6
---
7e63d6
 ldap/servers/plugins/dna/dna.c | 7 +++++++
7e63d6
 1 file changed, 7 insertions(+)
7e63d6
7e63d6
diff --git a/ldap/servers/plugins/dna/dna.c b/ldap/servers/plugins/dna/dna.c
7e63d6
index 928a3f54a..c983ebdd0 100644
7e63d6
--- a/ldap/servers/plugins/dna/dna.c
7e63d6
+++ b/ldap/servers/plugins/dna/dna.c
7e63d6
@@ -1025,7 +1025,14 @@ dna_parse_config_entry(Slapi_PBlock *pb, Slapi_Entry *e, int apply)
7e63d6
 
7e63d6
     value = slapi_entry_attr_get_charptr(e, DNA_INTERVAL);
7e63d6
     if (value) {
7e63d6
+        errno = 0;
7e63d6
         entry->interval = strtoull(value, 0, 0);
7e63d6
+        if (entry->interval == 0 || errno == ERANGE) {
7e63d6
+            slapi_log_err(SLAPI_LOG_WARNING, DNA_PLUGIN_SUBSYSTEM,
7e63d6
+                          "dna_parse_config_entry - Invalid value for dnaInterval (%s), "
7e63d6
+                          "Using default value of 1\n", value);
7e63d6
+            entry->interval = 1;
7e63d6
+        }
7e63d6
         slapi_ch_free_string(&value);
7e63d6
     }
7e63d6
 
7e63d6
-- 
7e63d6
2.31.1
7e63d6