|
|
dc8c34 |
From 810d8677e03d9ce8b3428348ece04399e085b6a3 Mon Sep 17 00:00:00 2001
|
|
|
dc8c34 |
From: Noriko Hosoi <nhosoi@redhat.com>
|
|
|
dc8c34 |
Date: Mon, 27 Jan 2014 15:15:01 -0800
|
|
|
dc8c34 |
Subject: [PATCH 296/305] Ticket #47659 - ldbm_usn_init: Valgrind reports
|
|
|
dc8c34 |
Invalid read / SIGSEGV
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Bug description: A suffix mapping tree could exist without the corresponding
|
|
|
dc8c34 |
backend. The existing code did not properly check the backend returned from
|
|
|
dc8c34 |
slapi_mapping_tree_find_backend_for_sdn. When NULL backend is returned, it
|
|
|
dc8c34 |
triggers the NULL pointer dereference.
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Fix description: This patch added a NULL backend check to usn_get_last_usn,
|
|
|
dc8c34 |
and moved a logging to the if clause where the backend is not NULL.
|
|
|
dc8c34 |
|
|
|
dc8c34 |
https://fedorahosted.org/389/ticket/47659
|
|
|
dc8c34 |
|
|
|
dc8c34 |
Reviewed by rmeggins@redhat.com (Thank you, Rich!!)
|
|
|
dc8c34 |
|
|
|
dc8c34 |
(cherry picked from commit a6f66e7fcbd5d17d975cc2ac65806d7c64571254)
|
|
|
dc8c34 |
(cherry picked from commit 6ad2397fa5d1319840d66f9ec47dfdd7bde8f129)
|
|
|
dc8c34 |
(cherry picked from commit 412ec0e9c8367f2d1c446237cb2bc27791ea8e6c)
|
|
|
dc8c34 |
(cherry picked from commit 4b7184c823da5117ddb1deb04bf1ef47eb9019e2)
|
|
|
dc8c34 |
---
|
|
|
dc8c34 |
ldap/servers/slapd/back-ldbm/ldbm_usn.c | 7 ++++---
|
|
|
dc8c34 |
1 file changed, 4 insertions(+), 3 deletions(-)
|
|
|
dc8c34 |
|
|
|
dc8c34 |
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_usn.c b/ldap/servers/slapd/back-ldbm/ldbm_usn.c
|
|
|
dc8c34 |
index 7c11a68..1ca16b1 100644
|
|
|
dc8c34 |
--- a/ldap/servers/slapd/back-ldbm/ldbm_usn.c
|
|
|
dc8c34 |
+++ b/ldap/servers/slapd/back-ldbm/ldbm_usn.c
|
|
|
dc8c34 |
@@ -80,10 +80,11 @@ ldbm_usn_init(struct ldbminfo *li)
|
|
|
dc8c34 |
for ( sdn = slapi_get_first_suffix( &node, 0 ); sdn != NULL;
|
|
|
dc8c34 |
sdn = slapi_get_next_suffix_ext( &node, 0 )) {
|
|
|
dc8c34 |
be = slapi_mapping_tree_find_backend_for_sdn(sdn);
|
|
|
dc8c34 |
- slapi_log_error(SLAPI_LOG_BACKLDBM, "ldbm_usn_init",
|
|
|
dc8c34 |
- "backend: %s%s\n", be->be_name, isglobal?" (global mode)":"");
|
|
|
dc8c34 |
rc = usn_get_last_usn(be, &last_usn);
|
|
|
dc8c34 |
if (0 == rc) { /* only when the last usn is available */
|
|
|
dc8c34 |
+ slapi_log_error(SLAPI_LOG_BACKLDBM, "ldbm_usn_init",
|
|
|
dc8c34 |
+ "backend: %s%s\n", be->be_name,
|
|
|
dc8c34 |
+ isglobal?" (global mode)":"");
|
|
|
dc8c34 |
if (isglobal) {
|
|
|
dc8c34 |
if (isfirst) {
|
|
|
dc8c34 |
li->li_global_usn_counter = slapi_counter_new();
|
|
|
dc8c34 |
@@ -126,7 +127,7 @@ usn_get_last_usn(Slapi_Backend *be, PRUint64 *last_usn)
|
|
|
dc8c34 |
DBT value;
|
|
|
dc8c34 |
PRInt64 signed_last_usn;
|
|
|
dc8c34 |
|
|
|
dc8c34 |
- if (NULL == last_usn) {
|
|
|
dc8c34 |
+ if ((NULL == be) || (NULL == last_usn)) {
|
|
|
dc8c34 |
return rc;
|
|
|
dc8c34 |
}
|
|
|
dc8c34 |
|
|
|
dc8c34 |
--
|
|
|
dc8c34 |
1.9.3
|
|
|
dc8c34 |
|