]> git.sur5r.net Git - openldap/commitdiff
don't segfault if a database doesn't have the suffix
authorPierangelo Masarati <ando@openldap.org>
Sun, 11 Jan 2004 23:40:33 +0000 (23:40 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sun, 11 Jan 2004 23:40:33 +0000 (23:40 +0000)
servers/slapd/backend.c
servers/slapd/backglue.c
servers/slapd/root_dse.c

index fb936b05885e5553332e2c7e0bd266575a3b69ba..e18009e01da7bc138db67e6b1b65f79ad5aa1781 100644 (file)
@@ -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 ) {
index 6afc6252d10c548cdc40f33f9c9f9b722355c234..bd0a4338f23ec7a412c75ae73ca3d6a5b1f084f1 100644 (file)
@@ -76,6 +76,8 @@ glue_back_select (
        bv.bv_val = (char *) dn;
 
        for (i = 0; i<gi->nodes; 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;
                        }
index 0e3cb7da83ae98c79061b9c30024bee9c763d7b2..d5ef3f54d46ee72962d9490dc10776b87f69a216 100644 (file)
@@ -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];