Blame SOURCES/0036-Issue-49731-undo-db_home_dir-under-dev-shm-dirsrv-fo.patch

ea1d1b
From 9ab266c88350c3387a8521897cd599f80b0ec6be Mon Sep 17 00:00:00 2001
ea1d1b
From: Mark Reynolds <mreynolds@redhat.com>
ea1d1b
Date: Tue, 21 Apr 2020 14:48:11 -0400
ea1d1b
Subject: [PATCH] Issue 49731 - undo db_home_dir under /dev/shm/dirsrv for now
ea1d1b
ea1d1b
Bug Description:  There are several issues with using /dec/shm/disrv/
ea1d1b
                  for the db home directory.  Cantainers have issues,
ea1d1b
                  and system reboots can cause issues too.
ea1d1b
ea1d1b
Fix Description:  Using just /dev/shm/slapd-INST solves all the permission
ea1d1b
                  issues, but that requires a new selinux label, so
ea1d1b
                  for now we will just set the db home directory to the
ea1d1b
                  database directory (effectively disabling the change).
ea1d1b
ea1d1b
relates: https://pagure.io/389-ds-base/issue/49731
ea1d1b
ea1d1b
Reviewed by: firstyear & tbordaz(Thanks!)
ea1d1b
---
ea1d1b
 ldap/admin/src/defaults.inf.in      |  1 +
ea1d1b
 ldap/servers/slapd/util.c           | 11 +++++++++++
ea1d1b
 src/lib389/lib389/instance/setup.py |  5 +++--
ea1d1b
 3 files changed, 15 insertions(+), 2 deletions(-)
ea1d1b
ea1d1b
diff --git a/ldap/admin/src/defaults.inf.in b/ldap/admin/src/defaults.inf.in
ea1d1b
index f74929581..d60f24cda 100644
ea1d1b
--- a/ldap/admin/src/defaults.inf.in
ea1d1b
+++ b/ldap/admin/src/defaults.inf.in
ea1d1b
@@ -57,6 +57,7 @@ access_log = @localstatedir@/log/dirsrv/slapd-{instance_name}/access
ea1d1b
 audit_log = @localstatedir@/log/dirsrv/slapd-{instance_name}/audit
ea1d1b
 error_log = @localstatedir@/log/dirsrv/slapd-{instance_name}/errors
ea1d1b
 db_dir = @localstatedir@/lib/dirsrv/slapd-{instance_name}/db
ea1d1b
+db_home_dir = @localstatedir@/lib/dirsrv/slapd-{instance_name}/db
ea1d1b
 backup_dir = @localstatedir@/lib/dirsrv/slapd-{instance_name}/bak
ea1d1b
 ldif_dir = @localstatedir@/lib/dirsrv/slapd-{instance_name}/ldif
ea1d1b
 
ea1d1b
diff --git a/ldap/servers/slapd/util.c b/ldap/servers/slapd/util.c
ea1d1b
index e1219c555..78ee68da9 100644
ea1d1b
--- a/ldap/servers/slapd/util.c
ea1d1b
+++ b/ldap/servers/slapd/util.c
ea1d1b
@@ -467,6 +467,17 @@ slapi_escape_filter_value(char *filter_str, int len)
ea1d1b
     }
ea1d1b
 }
ea1d1b
 
ea1d1b
+/* replace c with c2 in str */
ea1d1b
+void
ea1d1b
+replace_char(char *str, char c, char c2)
ea1d1b
+{
ea1d1b
+    for (size_t i = 0; (str != NULL) && (str[i] != '\0'); i++) {
ea1d1b
+        if (c == str[i]) {
ea1d1b
+            str[i] = c2;
ea1d1b
+        }
ea1d1b
+    }
ea1d1b
+}
ea1d1b
+
ea1d1b
 /*
ea1d1b
 ** This function takes a quoted attribute value of the form "abc",
ea1d1b
 ** and strips off the enclosing quotes.  It also deals with quoted
ea1d1b
diff --git a/src/lib389/lib389/instance/setup.py b/src/lib389/lib389/instance/setup.py
ea1d1b
index bb0ff32f5..887eae57c 100644
ea1d1b
--- a/src/lib389/lib389/instance/setup.py
ea1d1b
+++ b/src/lib389/lib389/instance/setup.py
ea1d1b
@@ -853,8 +853,9 @@ class SetupDs(object):
ea1d1b
 
ea1d1b
         # Do selinux fixups
ea1d1b
         if general['selinux']:
ea1d1b
-            selinux_paths = ('backup_dir', 'cert_dir', 'config_dir', 'db_dir', 'ldif_dir',
ea1d1b
-                             'lock_dir', 'log_dir', 'run_dir', 'schema_dir', 'tmp_dir')
ea1d1b
+            selinux_paths = ('backup_dir', 'cert_dir', 'config_dir', 'db_dir',
ea1d1b
+                             'ldif_dir', 'lock_dir', 'log_dir',
ea1d1b
+                             'run_dir', 'schema_dir', 'tmp_dir')
ea1d1b
             for path in selinux_paths:
ea1d1b
                 selinux_restorecon(slapd[path])
ea1d1b
 
ea1d1b
-- 
ea1d1b
2.26.2
ea1d1b