From 1a9bc6655ddf9a1d08ee4f5e6e4ef6a7707ca5f7 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Sun, 11 Jan 2004 23:40:33 +0000 Subject: [PATCH] don't segfault if a database doesn't have the suffix --- servers/slapd/backend.c | 6 ++++-- servers/slapd/backglue.c | 8 ++++++++ servers/slapd/root_dse.c | 5 +++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index fb936b0588..e18009e01d 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -283,11 +283,13 @@ int backend_startup(Backend *be) #ifdef NEW_LOGGING LDAP_LOG( BACKEND, DETAIL1, "backend_startup: starting \"%s\"\n", - be->be_suffix[0].bv_val, 0, 0 ); + be->be_suffix ? be->be_suffix[0].bv_val : "(unknown)", + 0, 0 ); #else Debug( LDAP_DEBUG_TRACE, "backend_startup: starting \"%s\"\n", - be->be_suffix[0].bv_val, 0, 0 ); + be->be_suffix ? be->be_suffix[0].bv_val : "(unknown)", + 0, 0 ); #endif if ( be->bd_info->bi_open ) { diff --git a/servers/slapd/backglue.c b/servers/slapd/backglue.c index 6afc6252d1..bd0a4338f2 100644 --- a/servers/slapd/backglue.c +++ b/servers/slapd/backglue.c @@ -76,6 +76,8 @@ glue_back_select ( bv.bv_val = (char *) dn; for (i = 0; inodes; i++) { + assert( gi->n[i].be->be_nsuffix ); + if (dnIsSuffix(&bv, &gi->n[i].be->be_nsuffix[0])) { return gi->n[i].be; } @@ -323,6 +325,10 @@ glue_back_search ( Operation *op, SlapReply *rs ) goto done; } op->o_bd = gi->n[i].be; + + assert( op->o_bd->be_suffix ); + assert( op->o_bd->be_nsuffix ); + if (scope0 == LDAP_SCOPE_ONELEVEL && dn_match(&gi->n[i].pdn, &ndn)) { @@ -573,6 +579,8 @@ glue_sub_init( ) if ( SLAP_GLUE_LINKED( be ) ) { continue; } + assert( be->be_nsuffix ); + assert( b1->be_nsuffix ); if (!dnIsSuffix(&be->be_nsuffix[0], &b1->be_nsuffix[0])) { continue; } diff --git a/servers/slapd/root_dse.c b/servers/slapd/root_dse.c index 0e3cb7da83..d5ef3f54d4 100644 --- a/servers/slapd/root_dse.c +++ b/servers/slapd/root_dse.c @@ -119,6 +119,11 @@ root_dse_info( } for ( i = 0; i < nbackends; i++ ) { + if ( backends[i].be_suffix == NULL + || backends[i].be_nsuffix == NULL ) { + /* no suffix! */ + continue; + } if ( backends[i].be_flags & SLAP_BFLAG_MONITOR ) { vals[0] = backends[i].be_suffix[0]; nvals[0] = backends[i].be_nsuffix[0]; -- 2.39.5