andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
dc8c34
From 589b2113330c678c1dfeba49ea489992168e41fa Mon Sep 17 00:00:00 2001
dc8c34
From: Mark Reynolds <mreynolds@redhat.com>
dc8c34
Date: Fri, 4 Apr 2014 13:16:27 -0400
dc8c34
Subject: [PATCH 194/225] Ticket 47766 - Tombstone purging can crash the server
dc8c34
 if the backend is stopped/disabled
dc8c34
dc8c34
Bug Description:  The tombstone purge thread issues a callback search that will start
dc8c34
                  reading id2entry, even if the backend is stopped.  This can crash the
dc8c34
                  server.
dc8c34
dc8c34
Fix Description:  When performing a search and returning entries, check if the backend
dc8c34
                  is started before reading id2entry.
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/47766
dc8c34
dc8c34
Reviewed by: nhosoi(Thanks!)
dc8c34
(cherry picked from commit 559d70e0a1e3df75a66e41fd1c009b25ca6f6a08)
dc8c34
(cherry picked from commit 0232f37a14bfff6e9865fb4d121bbcdf249e1834)
dc8c34
---
dc8c34
 ldap/servers/slapd/back-ldbm/ldbm_search.c | 10 ++++++++++
dc8c34
 1 file changed, 10 insertions(+)
dc8c34
dc8c34
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_search.c b/ldap/servers/slapd/back-ldbm/ldbm_search.c
dc8c34
index d092b2e..552b65b 100644
dc8c34
--- a/ldap/servers/slapd/back-ldbm/ldbm_search.c
dc8c34
+++ b/ldap/servers/slapd/back-ldbm/ldbm_search.c
dc8c34
@@ -1487,6 +1487,16 @@ ldbm_back_next_search_entry_ext( Slapi_PBlock *pb, int use_extension )
dc8c34
 
dc8c34
         ++sr->sr_lookthroughcount;    /* checked above */
dc8c34
 
dc8c34
+        /* Make sure the backend is available */
dc8c34
+        if( be->be_state != BE_STATE_STARTED ){
dc8c34
+            slapi_send_ldap_result( pb, LDAP_UNWILLING_TO_PERFORM, NULL,
dc8c34
+                                   "Backend is stopped", 0, NULL );
dc8c34
+            slapi_pblock_set( pb, SLAPI_SEARCH_RESULT_ENTRY, NULL );
dc8c34
+            delete_search_result_set(pb, &sr);
dc8c34
+            rc = SLAPI_FAIL_GENERAL;
dc8c34
+            goto bail;
dc8c34
+        }
dc8c34
+
dc8c34
         /* get the entry */
dc8c34
         e = id2entry( be, id, &txn, &err );
dc8c34
         if ( e == NULL )
dc8c34
-- 
dc8c34
1.8.1.4
dc8c34