zrhoffman / rpms / 389-ds-base

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

Blame SOURCES/0012-Ticket-50063-Crash-after-attempting-to-restore-a-sin.patch

26521d
From ed430bcca3e1cf0788fc15786002b0b1c31a130b Mon Sep 17 00:00:00 2001
26521d
From: Mark Reynolds <mreynolds@redhat.com>
26521d
Date: Fri, 30 Nov 2018 11:45:39 -0500
26521d
Subject: [PATCH] Ticket 50063 - Crash after attempting to restore a single
26521d
 backend
26521d
26521d
Description:  While we do not support backup/restore of individual backends,
26521d
              it should not crash the server either.  PR_OpenDir will crash
26521d
              if the file name is NULL, so this fix just prevents the crash
26521d
              by returning an error if the filename is NULL.
26521d
26521d
https://pagure.io/389-ds-base/issue/50063
26521d
26521d
Reviewed by: firstyear & tbordaz(Thanks!!)
26521d
26521d
(cherry picked from commit d36f796a7b35bade5a05e197690abf4e49d212ce)
26521d
---
26521d
 ldap/servers/slapd/back-ldbm/dblayer.c | 5 +++++
26521d
 1 file changed, 5 insertions(+)
26521d
26521d
diff --git a/ldap/servers/slapd/back-ldbm/dblayer.c b/ldap/servers/slapd/back-ldbm/dblayer.c
26521d
index fa931ccbf..64a4e9e4f 100644
26521d
--- a/ldap/servers/slapd/back-ldbm/dblayer.c
26521d
+++ b/ldap/servers/slapd/back-ldbm/dblayer.c
26521d
@@ -5292,6 +5292,11 @@ dblayer_delete_database_ex(struct ldbminfo *li, char *instance, char *cldir)
26521d
     }
26521d
 
26521d
     /* now smash everything else in the db/ dir */
26521d
+    if (priv->dblayer_home_directory == NULL){
26521d
+        slapi_log_err(SLAPI_LOG_ERR, "dblayer_delete_database_ex",
26521d
+                      "dblayer_home_directory is NULL, can not proceed\n");
26521d
+        return -1;
26521d
+    }
26521d
     dirhandle = PR_OpenDir(priv->dblayer_home_directory);
26521d
     if (!dirhandle) {
26521d
         slapi_log_err(SLAPI_LOG_ERR, "dblayer_delete_database_ex", "PR_OpenDir (%s) failed (%d): %s\n",
26521d
-- 
26521d
2.17.2
26521d