]> git.sur5r.net Git - openldap/commitdiff
More "char *" to struct berval DN changes
authorKurt Zeilenga <kurt@openldap.org>
Tue, 25 Dec 2001 02:30:01 +0000 (02:30 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Tue, 25 Dec 2001 02:30:01 +0000 (02:30 +0000)
20 files changed:
build/main.dsw
servers/slapd/add.c
servers/slapd/back-monitor/backmon.dsp [new file with mode: 0644]
servers/slapd/back-monitor/init.c
servers/slapd/back-monitor/log.c
servers/slapd/back-monitor/thread.c
servers/slapd/backend.c
servers/slapd/bind.c
servers/slapd/compare.c
servers/slapd/config.c
servers/slapd/delete.c
servers/slapd/modify.c
servers/slapd/modrdn.c
servers/slapd/proto-slap.h
servers/slapd/repl.c
servers/slapd/saslauthz.c
servers/slapd/search.c
servers/slapd/slap.h
servers/slapd/tools/slapadd.c
servers/slapd/tools/slapcommon.c

index 11c768c33b9dfd67f051ef0f58971f1b85f6e291..13475f4a66c9f5a0d587a3c57758a02ca919071c 100644 (file)
@@ -69,6 +69,18 @@ Package=<4>
 
 ###############################################################################
 
+Project: "backmon"="..\servers\slapd\back-monitor\backmon.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
 Project: "build"=.\build.dsp - Package Owner=<4>
 
 Package=<5>
@@ -527,6 +539,9 @@ Package=<4>
     Begin Project Dependency
     Project_Dep_Name backbdb
     End Project Dependency
+    Begin Project Dependency
+    Project_Dep_Name backmon
+    End Project Dependency
 }}}
 
 ###############################################################################
@@ -569,6 +584,9 @@ Package=<4>
     Begin Project Dependency
     Project_Dep_Name backbdb
     End Project Dependency
+    Begin Project Dependency
+    Project_Dep_Name backmon
+    End Project Dependency
 }}}
 
 ###############################################################################
@@ -614,6 +632,9 @@ Package=<4>
     Begin Project Dependency
     Project_Dep_Name backbdb
     End Project Dependency
+    Begin Project Dependency
+    Project_Dep_Name backmon
+    End Project Dependency
 }}}
 
 ###############################################################################
@@ -656,6 +677,9 @@ Package=<4>
     Begin Project Dependency
     Project_Dep_Name backbdb
     End Project Dependency
+    Begin Project Dependency
+    Project_Dep_Name backmon
+    End Project Dependency
 }}}
 
 ###############################################################################
index 21fde149b8ae738d40f148c77b2d2a137927b088..458cdbaa08438f5ea564932f026ed591d7475df8 100644 (file)
@@ -234,7 +234,7 @@ do_add( Connection *conn, Operation *op )
         * appropriate one, or send a referral to our "referral server"
         * if we don't hold it.
         */
-       be = select_backend( e->e_ndn, manageDSAit, 0 );
+       be = select_backend( &e->e_nname, manageDSAit, 0 );
        if ( be == NULL ) {
                struct berval **ref = referral_rewrite( default_referral,
                        NULL, e->e_dn, LDAP_SCOPE_DEFAULT );
diff --git a/servers/slapd/back-monitor/backmon.dsp b/servers/slapd/back-monitor/backmon.dsp
new file mode 100644 (file)
index 0000000..e403851
--- /dev/null
@@ -0,0 +1,209 @@
+# Microsoft Developer Studio Project File - Name="backmon" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Static Library" 0x0104
+
+CFG=backmon - Win32 Single Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "backmon.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "backmon.mak" CFG="backmon - Win32 Single Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "backmon - Win32 Release" (based on "Win32 (x86) Static Library")
+!MESSAGE "backmon - Win32 Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE "backmon - Win32 Single Debug" (based on "Win32 (x86) Static Library")
+!MESSAGE "backmon - Win32 Single Release" (based on\
+ "Win32 (x86) Static Library")
+!MESSAGE 
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+
+!IF  "$(CFG)" == "backmon - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\..\..\Release"
+# PROP Intermediate_Dir "..\..\..\Release\backmon"
+# PROP Target_Dir ""
+RSC=rc.exe
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\\" /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ELSEIF  "$(CFG)" == "backmon - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "..\..\..\Debug"
+# PROP Intermediate_Dir "..\..\..\Debug\backmon"
+# PROP Target_Dir ""
+RSC=rc.exe
+# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\\" /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /c
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ELSEIF  "$(CFG)" == "backmon - Win32 Single Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "backmon"
+# PROP BASE Intermediate_Dir "backmon"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "..\..\..\SDebug"
+# PROP Intermediate_Dir "..\..\..\SDebug\backmon"
+# PROP Target_Dir ""
+RSC=rc.exe
+# ADD BASE CPP /nologo /MTd /W3 /GX /Z7 /Od /I "..\\" /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /c
+# ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\\" /I "..\..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /YX /FD /c
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ELSEIF  "$(CFG)" == "backmon - Win32 Single Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "backldb0"
+# PROP BASE Intermediate_Dir "backldb0"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "..\..\..\SRelease"
+# PROP Intermediate_Dir "..\..\..\SRelease\backmon"
+# PROP Target_Dir ""
+RSC=rc.exe
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /I "..\\" /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "..\\" /I "..\..\..\include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LIB32=link.exe -lib
+# ADD BASE LIB32 /nologo
+# ADD LIB32 /nologo
+
+!ENDIF 
+
+# Begin Target
+
+# Name "backmon - Win32 Release"
+# Name "backmon - Win32 Debug"
+# Name "backmon - Win32 Single Debug"
+# Name "backmon - Win32 Single Release"
+# Begin Source File
+
+SOURCE=.\abandon.c
+# End Source File
+# Begin Source File
+
+SOURCE=".\back-monitor.h"
+# End Source File
+# Begin Source File
+
+SOURCE=.\backend.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\bind.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\cache.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\compare.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\conn.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\database.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\entry.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\external.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\init.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\log.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\modify.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\operation.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\operational.c
+# End Source File
+# Begin Source File
+
+SOURCE=".\proto-back-monitor.h"
+# End Source File
+# Begin Source File
+
+SOURCE=.\rww.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\search.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sent.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\thread.c
+# End Source File
+# End Target
+# End Project
index 8758715e73798844a3083257474b96957020d61a..05a2a0ad317d0e118ec0102a057f5f74c966fac3 100644 (file)
@@ -339,7 +339,7 @@ monitor_back_db_init(
         * creates the "cn=Monitor" entry 
         */
        snprintf( buf, sizeof( buf ), 
-                       "dn: %s\n"
+                       "dn: " SLAPD_MONITOR_DN "\n"
                        "objectClass: top\n"
                        "objectClass: LDAPsubEntry\n"
 #ifdef SLAPD_MONITORSUBENTRY
@@ -347,9 +347,8 @@ monitor_back_db_init(
 #else /* !SLAPD_MONITORSUBENTRY */
                        "objectClass: extensibleObject\n"
 #endif /* !SLAPD_MONITORSUBENTRY */
-                       "cn: Monitor",
-                       SLAPD_MONITOR_DN
-                       );
+                       "cn: Monitor" );
+
        e = str2entry( buf );
        if ( e == NULL) {
 #ifdef NEW_LOGGING
@@ -415,22 +414,36 @@ monitor_back_open(
 {
        BackendDB               *be;
        struct monitorsubsys    *ms;
-       char                    *ndn;
+       struct berval dn = { sizeof(SLAPD_MONITOR_DN)-1, SLAPD_MONITOR_DN };
+       struct berval *ndn = NULL;
+       int rc;
 
        /*
         * adds the monitor backend
         */
-       ndn = ch_strdup( SLAPD_MONITOR_DN );
-       dn_normalize( ndn );
+       rc = dnNormalize( NULL, &dn, &ndn );
+       if( rc != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+               LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
+                       "monitor DN \"" SLAPD_MONITOR_DN "\" is invalid\n" ));
+#else
+               Debug( LDAP_DEBUG_ANY,
+                       "monitor DN \"" SLAPD_MONITOR_DN "\" is invalid\n",
+                       0, 0, 0 );
+#endif
+               return( -1 );
+       }
+
        be = select_backend( ndn , 0, 0 );
-       ch_free( ndn );
+       ber_bvfree( ndn );
+
        if ( be == NULL ) {
 #ifdef NEW_LOGGING
                LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
                        "unable to get monitor backend\n" ));
 #else
                Debug( LDAP_DEBUG_ANY,
-                       "unable to get monitor backend\n%s%s%s", "", "", "" );
+                       "unable to get monitor backend\n", 0, 0, 0 );
 #endif
                return( -1 );
        }
index 8528da8ca9b5b7eefe3f704638b5f3ec32da4715..58f8d358fde38d92b291fdd858d87e98e409b6f3 100644 (file)
@@ -89,7 +89,6 @@ monitor_subsys_log_init(
        struct monitorinfo      *mi;
        Entry                   *e;
        int                     i;
-       struct monitorentrypriv *mp;
        struct berval           val, *bv[2] = { &val, NULL };
 
        ldap_pvt_thread_mutex_init( &monitor_log_mutex );
@@ -292,8 +291,9 @@ check_constraints( Modification *mod, int *newlevel )
        int             i;
 
        for ( i = 0; mod->sm_bvalues && mod->sm_bvalues[i] != NULL; i++ ) {
-               int len, l;
+               int l;
                const char *s;
+               ber_len_t len;
                
                l = loglevel2int( mod->sm_bvalues[i]->bv_val );
                if ( !l ) {
@@ -476,7 +476,7 @@ delete_values( Entry *e, Modification *mod, int *newlevel )
 static int
 replace_values( Entry *e, Modification *mod, int *newlevel )
 {
-       int i, rc;
+       int rc;
 
        *newlevel = 0;
        rc = check_constraints( mod, newlevel );
index b1e05f29d6de1dce20d2c9ae0f72bb8bf37b94d0..838d41ca2b51a6f8addc8d85995414e922d2dcb2 100644 (file)
@@ -51,26 +51,22 @@ monitor_subsys_thread_init(
 {
        struct monitorinfo      *mi;
        Entry                   *e;
-       struct monitorentrypriv *mp;
        struct berval           val, *bv[2] = { &val, NULL };
        static char             buf[1024];
 
        mi = ( struct monitorinfo * )be->be_private;
 
        if ( monitor_cache_get( mi, 
-                               monitor_subsys[SLAPD_MONITOR_THREAD].mss_ndn,
-                               &e ) ) {
+               monitor_subsys[SLAPD_MONITOR_THREAD].mss_ndn, &e ) )
+       {
 #ifdef NEW_LOGGING
                LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
-                                       "monitor_subsys_thread_init: "
-                                       "unable to get entry '%s'\n",
-                                       monitor_subsys[SLAPD_MONITOR_THREAD].mss_ndn ));
+                       "monitor_subsys_thread_init: unable to get entry '%s'\n",
+                       monitor_subsys[SLAPD_MONITOR_THREAD].mss_ndn ));
 #else
                Debug( LDAP_DEBUG_ANY,
-                               "monitor_subsys_thread_init: "
-                               "unable to get entry '%s'\n%s%s",
-                               monitor_subsys[SLAPD_MONITOR_THREAD].mss_ndn,
-                               "", "" );
+                       "monitor_subsys_thread_init: unable to get entry '%s'\n",
+                       monitor_subsys[SLAPD_MONITOR_THREAD].mss_ndn, 0, 0 );
 #endif
                return( -1 );
        }
index 7eec0d624f0cfa7839586710053d6494dbd7fecc..88fd1f8118691760e7570f175dc7009b80a8918e 100644 (file)
@@ -521,14 +521,14 @@ be_db_close( void )
 
 Backend *
 select_backend(
-       const char * dn,
+       struct berval * dn,
        int manageDSAit,
        int noSubs )
 {
-       int     i, j, len, dnlen;
+       int     i, j;
+       ber_len_t len, dnlen = dn->bv_len;
        Backend *be = NULL;
 
-       dnlen = strlen( dn );
        for ( i = 0; i < nbackends; i++ ) {
                for ( j = 0; backends[i].be_nsuffix != NULL &&
                    backends[i].be_nsuffix[j] != NULL; j++ )
@@ -543,15 +543,18 @@ select_backend(
                                /* suffix is longer than DN */
                                continue;
                        }
-
                        
-                       if ( len && len < dnlen && ( !DN_SEPARATOR( dn[(dnlen-len)-1] ) || DN_ESCAPE( dn[(dnlen-len)-2] ) ) ) {
+                       if ( len && len < dnlen &&
+                               ( !DN_SEPARATOR( dn->bv_val[(dnlen-len)-1] ) ||
+                                       DN_ESCAPE( dn->bv_val[(dnlen-len)-2] ) ) )
+                       {
                                /* make sure we have a separator */
                                continue;
                        }
-                       
 
-                       if ( strcmp( backends[i].be_nsuffix[j]->bv_val, &dn[dnlen-len] ) == 0 ) {
+                       if ( strcmp( backends[i].be_nsuffix[j]->bv_val,
+                               &dn->bv_val[dnlen-len] ) == 0 )
+                       {
                                if( be == NULL ) {
                                        be = &backends[i];
 
@@ -990,19 +993,21 @@ backend_group(
 )
 {
        GroupAssertion *g;
-       int len = strlen(gr_ndn);
+       struct berval gr;
        int i;
 
+       gr.bv_val = (char *) gr_ndn;
+       gr.bv_len = strlen(gr_ndn);
+
        ldap_pvt_thread_mutex_lock( &op->o_abandonmutex );
        i = op->o_abandon;
        ldap_pvt_thread_mutex_unlock( &op->o_abandonmutex );
-       if (i)
-               return SLAPD_ABANDON;
+       if (i) return SLAPD_ABANDON;
 
        if( strcmp( target->e_ndn, gr_ndn ) != 0 ) {
                /* we won't attempt to send it to a different backend */
                
-               be = select_backend(gr_ndn, 0,
+               be = select_backend( &gr, 0,
                        (be->be_glueflags & SLAP_GLUE_INSTANCE));
 
                if (be == NULL) {
@@ -1013,7 +1018,7 @@ backend_group(
        ldap_pvt_thread_mutex_lock( &conn->c_mutex );
        for (g = conn->c_groups; g; g=g->next) {
                if (g->be != be || g->oc != group_oc || g->at != group_at ||
-                   g->len != len)
+                   g->len != gr.bv_len)
                        continue;
                if (strcmp( g->ndn, gr_ndn ) == 0)
                        break;
@@ -1028,12 +1033,12 @@ backend_group(
                        group_oc, group_at );
                
                if (op->o_tag != LDAP_REQ_BIND) {
-                       g = ch_malloc(sizeof(GroupAssertion) + len);
+                       g = ch_malloc(sizeof(GroupAssertion) + gr.bv_len);
                        g->be = be;
                        g->oc = group_oc;
                        g->at = group_at;
                        g->res = res;
-                       g->len = len;
+                       g->len = gr.bv_len;
                        strcpy(g->ndn, gr_ndn);
                        ldap_pvt_thread_mutex_lock( &conn->c_mutex );
                        g->next = conn->c_groups;
@@ -1058,12 +1063,16 @@ backend_attribute(
        struct berval ***vals
 )
 {
+       struct berval edn;
+       edn.bv_val = (char *) entry_ndn;
+       edn.bv_len = strlen( entry_ndn );
+
        if( target == NULL ||
                strcmp( target->e_ndn, entry_ndn ) != 0 )
        {
                /* we won't attempt to send it to a different backend */
                
-               be = select_backend(entry_ndn, 0,
+               be = select_backend( &edn, 0,
                        (be->be_glueflags & SLAP_GLUE_INSTANCE));
 
                if (be == NULL) {
index da436aa3c561ff0288e1372ff627eb367f378f56..afe1aa38f018fb65331f4140c688b9962bfb6dbe 100644 (file)
@@ -456,7 +456,7 @@ do_bind(
         * if we don't hold it.
         */
 
-       if ( (be = select_backend( ndn->bv_val, 0, 0 )) == NULL ) {
+       if ( (be = select_backend( ndn, 0, 0 )) == NULL ) {
                if ( default_referral ) {
                        struct berval **ref = referral_rewrite( default_referral,
                                NULL, pdn->bv_val, LDAP_SCOPE_DEFAULT );
index fda1f045183bc77b6da0a4089bff48c18eecb804..163a4f538c59ae72785e87f8da0d3103b8634fd2 100644 (file)
@@ -239,7 +239,7 @@ do_compare(
         * appropriate one, or send a referral to our "referral server"
         * if we don't hold it.
         */
-       if ( (be = select_backend( ndn->bv_val, manageDSAit, 0 )) == NULL ) {
+       if ( (be = select_backend( ndn, manageDSAit, 0 )) == NULL ) {
                struct berval **ref = referral_rewrite( default_referral,
                        NULL, pdn->bv_val, LDAP_SCOPE_DEFAULT );
 
index b7b16f13a1829186a38bd9826f902b06338101a6..81b9223c94881f5f571187af382ffea2d75d0feb 100644 (file)
@@ -46,8 +46,8 @@ char  *global_host = NULL;
 char   *global_realm = NULL;
 char           *ldap_srvtab = "";
 char           *default_passwd_hash;
-char           *default_search_base = NULL;
-char           *default_search_nbase = NULL;
+struct berval default_search_base = { 0, NULL };
+struct berval default_search_nbase = { 0, NULL };
 int            num_subs = 0;
 
 ber_len_t sockbuf_max_incoming = SLAP_SB_MAX_INCOMING_DEFAULT;
@@ -335,8 +335,8 @@ read_config( const char *fname )
                        if ( cargc < 2 ) {
 #ifdef NEW_LOGGING
                                LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
-                                          "%s: line %d: missing dn in \"defaultSearchBase <dn\" "
-                                          "line\n", fname, lineno ));
+                                       "%s: line %d: missing dn in \"defaultSearchBase <dn\" "
+                                       "line\n", fname, lineno ));
 #else
                                Debug( LDAP_DEBUG_ANY, "%s: line %d: "
                                        "missing dn in \"defaultSearchBase <dn>\" line\n",
@@ -348,24 +348,23 @@ read_config( const char *fname )
                        } else if ( cargc > 2 ) {
 #ifdef NEW_LOGGING
                                LDAP_LOG(( "config", LDAP_LEVEL_INFO,
-                                          "%s: line %d: extra cruft after <dn> in "
-                                          "\"defaultSearchBase %s\" line (ignored)\n",
-                                          fname, lineno, cargv[1] ));
+                                       "%s: line %d: extra cruft after <dn> in "
+                                       "\"defaultSearchBase %s\" line (ignored)\n",
+                                       fname, lineno, cargv[1] ));
 #else
                                Debug( LDAP_DEBUG_ANY, "%s: line %d: "
                                        "extra cruft after <dn> in \"defaultSearchBase %s\", "
                                        "line (ignored)\n",
                                        fname, lineno, cargv[1] );
 #endif
-
                        }
 
                        if ( bi != NULL || be != NULL ) {
 #ifdef NEW_LOGGING
                                LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
-                                          "%s: line %d: defaultSearchBase line must appear "
-                                          "prior to any backend or database definitions\n",
-                                          fname, lineno ));
+                                       "%s: line %d: defaultSearchBase line must appear "
+                                       "prior to any backend or database definitions\n",
+                                       fname, lineno ));
 #else
                                Debug( LDAP_DEBUG_ANY, "%s: line %d: "
                                        "defaultSearchBaase line must appear prior to "
@@ -376,42 +375,67 @@ read_config( const char *fname )
                                return 1;
                        }
 
-                       if ( default_search_nbase != NULL ) {
+                       if ( default_search_nbase.bv_len ) {
 #ifdef NEW_LOGGING
-                               LDAP_LOG(( "config", LDAP_LEVEL_INFO,
-                                          "%s: line %d: default search base \"%s\" already defined "
-                                          "(discarding old)\n", fname, lineno, default_search_base ));
+                               LDAP_LOG(( "config", LDAP_LEVEL_INFO, "%s: line %d: "
+                                       "default search base \"%s\" already defined "
+                                       "(discarding old)\n", fname, lineno,
+                                       default_search_base->bv_val ));
 #else
                                Debug( LDAP_DEBUG_ANY, "%s: line %d: "
                                        "default search base \"%s\" already defined "
                                        "(discarding old)\n",
-                                       fname, lineno, default_search_base );
+                                       fname, lineno, default_search_base.bv_val );
 #endif
 
-                               free( default_search_base );
-                               free( default_search_nbase );
+                               free( default_search_base.bv_val );
+                               free( default_search_nbase.bv_val );
                        }
 
-                       default_search_base = ch_strdup( cargv[1] );
-                       default_search_nbase = ch_strdup( cargv[1] );
+                       if ( load_ucdata( NULL ) < 0 ) return 1;
 
-                       if ( load_ucdata( NULL ) < 0 ) {
-                               return( 1 );
-                       }
-                       if( dn_normalize( default_search_nbase ) == NULL ) {
+                       {
+                               struct berval dn, *pdn, *ndn;
+
+                               dn.bv_val = cargv[1];
+                               dn.bv_len = strlen( dn.bv_val );
+
+                               rc = dnPretty( NULL, &dn, &pdn );
+                               if( rc != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
-                               LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
-                                          "%s:  %d: invalid default search base \"%s\"\n",
-                                          fname, lineno, default_search_base ));
+                                       LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+                                               "%s: line %d: defaultSearchBase DN is invalid.\n",
+                                               fname, lineno ));
 #else
-                               Debug( LDAP_DEBUG_ANY, "%s: line %d: "
-                                       "invalid default search base \"%s\"\n",
-                                       fname, lineno, default_search_base );
+                                       Debug( LDAP_DEBUG_ANY,
+                                               "%s: line %d: defaultSearchBase DN is invalid\n",
+                                          fname, lineno, 0 );
 #endif
+                                       return( 1 );
+                               }
 
-                               return 1;
+                               rc = dnNormalize( NULL, &dn, &ndn );
+                               if( rc != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+                                       LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+                                               "%s: line %d: defaultSearchBase DN is invalid.\n",
+                                               fname, lineno ));
+#else
+                                       Debug( LDAP_DEBUG_ANY,
+                                               "%s: line %d: defaultSearchBase DN is invalid\n",
+                                          fname, lineno, 0 );
+#endif
+                                       ber_bvfree( ndn );
+                                       return( 1 );
+                               }
+
+                               default_search_base = *pdn;
+                               default_search_nbase = *ndn;
+
+                               free( pdn );
+                               free( ndn );
                        }
-              
+
                /* set maximum threads in thread pool */
                } else if ( strcasecmp( cargv[0], "threads" ) == 0 ) {
                        int c;
@@ -829,12 +853,12 @@ read_config( const char *fname )
                } else if ( strcasecmp( cargv[0], "subordinate" ) == 0 ) {
                        if ( be == NULL ) {
 #ifdef NEW_LOGGING
-                               LDAP_LOG(( "config", LDAP_LEVEL_INFO,
-                                          "%s: line %d: subordinate keyword must appear inside a database "
-                                          "definition (ignored).\n", fname, lineno ));
+                               LDAP_LOG(( "config", LDAP_LEVEL_INFO, "%s: line %d: "
+                                       "subordinate keyword must appear inside a database "
+                                       "definition (ignored).\n", fname, lineno ));
 #else
-                               Debug( LDAP_DEBUG_ANY,
-"%s: line %d: suffix line must appear inside a database definition (ignored)\n",
+                               Debug( LDAP_DEBUG_ANY, "%s: line %d: suffix line "
+                                       "must appear inside a database definition (ignored)\n",
                                    fname, lineno, 0 );
 #endif
                        } else {
@@ -845,143 +869,159 @@ read_config( const char *fname )
                /* set database suffix */
                } else if ( strcasecmp( cargv[0], "suffix" ) == 0 ) {
                        Backend *tmp_be;
+                       struct berval dn;
+                       struct berval *pdn = NULL;
+                       struct berval *ndn = NULL;
+
                        if ( cargc < 2 ) {
 #ifdef NEW_LOGGING
                                LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
-                                          "%s: line %d: missing dn in \"suffix <dn>\" line.\n",
-                                          fname, lineno ));
+                                       "%s: line %d: missing dn in \"suffix <dn>\" line.\n",
+                                       fname, lineno ));
 #else
-                               Debug( LDAP_DEBUG_ANY,
-                   "%s: line %d: missing dn in \"suffix <dn>\" line\n",
+                               Debug( LDAP_DEBUG_ANY, "%s: line %d: "
+                                       "missing dn in \"suffix <dn>\" line\n",
                                    fname, lineno, 0 );
 #endif
 
                                return( 1 );
+
                        } else if ( cargc > 2 ) {
 #ifdef NEW_LOGGING
                                LDAP_LOG(( "config", LDAP_LEVEL_INFO,
-                                          "%s: line %d: extra cruft after <dn> in \"suffix %s\""
-                                          " line (ignored).\n", fname, lineno, cargv[1] ));
+                                       "%s: line %d: extra cruft after <dn> in \"suffix %s\""
+                                       " line (ignored).\n", fname, lineno, cargv[1] ));
 #else
-                               Debug( LDAP_DEBUG_ANY,
-    "%s: line %d: extra cruft after <dn> in \"suffix %s\" line (ignored)\n",
+                               Debug( LDAP_DEBUG_ANY, "%s: line %d: extra cruft "
+                                       "after <dn> in \"suffix %s\" line (ignored)\n",
                                    fname, lineno, cargv[1] );
 #endif
-
                        }
+
                        if ( be == NULL ) {
 #ifdef NEW_LOGGING
                                LDAP_LOG(( "config", LDAP_LEVEL_INFO,
-                                          "%s: line %d: suffix line must appear inside a database "
-                                          "definition (ignored).\n", fname, lineno ));
+                                       "%s: line %d: suffix line must appear inside a database "
+                                       "definition.\n", fname, lineno ));
 #else
-                               Debug( LDAP_DEBUG_ANY,
-"%s: line %d: suffix line must appear inside a database definition (ignored)\n",
+                               Debug( LDAP_DEBUG_ANY, "%s: line %d: suffix line "
+                                       "must appear inside a database definition\n",
                                    fname, lineno, 0 );
 #endif
+                               return( 1 );
 
 #if defined(SLAPD_MONITOR_DN)
                        /* "cn=Monitor" is reserved for monitoring slap */
                        } else if ( strcasecmp( cargv[1], SLAPD_MONITOR_DN ) == 0 ) {
 #ifdef NEW_LOGGING
-                               LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
-"%s: line %d: \"%s\" is reserved for monitoring slapd\n", 
-                                       fname, lineno, SLAPD_MONITOR_DN ));
+                               LDAP_LOG(( "config", LDAP_LEVEL_CRIT, "%s: line %d: \""
+                                       SLAPD_MONITOR_DN "\" is reserved for monitoring slapd\n", 
+                                       fname, lineno ));
 #else
-                               Debug( LDAP_DEBUG_ANY,
-"%s: line %d: \"%s\" is reserved for monitoring slapd\n",
-                                       fname, lineno, SLAPD_MONITOR_DN );
+                               Debug( LDAP_DEBUG_ANY, "%s: line %d: \""
+                                       SLAPD_MONITOR_DN "\" is reserved for monitoring slapd\n", 
+                                       fname, lineno, 0 );
 #endif
                                return( 1 );
 #endif /* SLAPD_MONITOR_DN */
+                       }
+
+                       if ( load_ucdata( NULL ) < 0 ) return 1;
 
-                       } else if ( ( tmp_be = select_backend( cargv[1], 0, 0 ) ) == be ) {
+                       dn.bv_val = cargv[1];
+                       dn.bv_len = strlen( cargv[1] );
+
+                       rc = dnPretty( NULL, &dn, &pdn );
+                       if( rc != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
-                               LDAP_LOG(( "config", LDAP_LEVEL_INFO,
-                                          "%s: line %d: suffix already served by this backend "
-                                          "(ignored)\n", fname, lineno ));
+                               LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+                                       "%s: line %d: suffix DN is invalid.\n",
+                                       fname, lineno ));
 #else
                                Debug( LDAP_DEBUG_ANY,
-"%s: line %d: suffix already served by this backend (ignored)\n",
-                                   fname, lineno, 0 );
+                                       "%s: line %d: suffix DN is invalid\n",
+                                  fname, lineno, 0 );
 #endif
+                               return( 1 );
+                       }
 
-                       } else if ( tmp_be  != NULL ) {
+                       rc = dnNormalize( NULL, &dn, &ndn );
+                       if( rc != LDAP_SUCCESS ) {
 #ifdef NEW_LOGGING
-                               LDAP_LOG(( "config", LDAP_LEVEL_INFO,
-                                          "%s: line %d: suffix already served by a preceding "
-                                          "backend \"%s\" (ignored)\n", fname, lineno,
-                                          tmp_be->be_suffix[0] ));
+                               LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+                                       "%s: line %d: suffix DN is invalid.\n",
+                                       fname, lineno ));
 #else
                                Debug( LDAP_DEBUG_ANY,
-"%s: line %d: suffix already served by a preceeding backend \"%s\" (ignored)\n",
-                                   fname, lineno, tmp_be->be_suffix[0] );
+                                       "%s: line %d: suffix DN is invalid\n",
+                                  fname, lineno, 0 );
 #endif
+                               ber_bvfree( ndn );
+                               return( 1 );
+                       }
 
-                       } else {
-                               char *dn;
-
-                               if ( load_ucdata( NULL ) < 0 ) {
-                                       return( 1 );
-                               }
-                               dn = ch_strdup( cargv[1] );
-                               if( dn_validate( dn ) == NULL ) {
+                       tmp_be = select_backend( ndn, 0, 0 );
+                       if ( tmp_be == be ) {
 #ifdef NEW_LOGGING
-                                       LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
-                                                  "%s: line %d: suffix DN invalid\"%s\"\n",
-                                                  fname, lineno, cargv[1] ));
+                               LDAP_LOG(( "config", LDAP_LEVEL_INFO,
+                                       "%s: line %d: suffix already served by this backend "
+                                       "(ignored)\n", fname, lineno ));
 #else
-                                       Debug( LDAP_DEBUG_ANY, "%s: line %d: "
-                                               "suffix DN invalid \"%s\"\n",
-                                       fname, lineno, cargv[1] );
+                               Debug( LDAP_DEBUG_ANY, "%s: line %d: suffix "
+                                       "already served by this backend (ignored)\n",
+                                   fname, lineno, 0 );
 #endif
-                                       free( dn );
-                                       return 1;
+                               ber_bvfree( pdn );
+                               ber_bvfree( ndn );
 
-                               } else if( *dn == '\0' && default_search_nbase != NULL ) {
+                       } else if ( tmp_be  != NULL ) {
 #ifdef NEW_LOGGING
-                                       LDAP_LOG(( "config", LDAP_LEVEL_INFO,
-                                                  "%s: line %d: suffix DN empty and default search "
-                                                  "base provided \"%s\" (assuming okay).\n",
-                                                  fname, lineno, default_search_base ));
+                               LDAP_LOG(( "config", LDAP_LEVEL_INFO,
+                                       "%s: line %d: suffix already served by a preceding "
+                                       "backend \"%s\"\n", fname, lineno,
+                                       tmp_be->be_suffix[0] ));
 #else
-                                       Debug( LDAP_DEBUG_ANY, "%s: line %d: "
-                                               "suffix DN empty and default "
-                                               "search base provided \"%s\" (assuming okay)\n",
-                                       fname, lineno, default_search_base );
+                               Debug( LDAP_DEBUG_ANY, "%s: line %d: suffix "
+                                       "already served by a preceeding backend \"%s\"\n",
+                                   fname, lineno, tmp_be->be_suffix[0] );
 #endif
+                               ber_bvfree( pdn );
+                               ber_bvfree( ndn );
+                               return( 1 );
 
-                               }
-                               charray_add( &be->be_suffix, dn );
-                               if ( dn_normalize( dn ) == NULL ) {
+                       } else if( pdn->bv_len == 0 && default_search_nbase.bv_len ) {
 #ifdef NEW_LOGGING
-                                       LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
-                                               "%s: line %d: "
-                                               "unable to normalize suffix "
-                                               "\"%s\"\n", fname, lineno, dn ));
+                                       LDAP_LOG(( "config", LDAP_LEVEL_INFO,
+                                               "%s: line %d: suffix DN empty and default search "
+                                               "base provided \"%s\" (assuming okay).\n",
+                                               fname, lineno, default_search_base.bv_val ));
 #else
                                        Debug( LDAP_DEBUG_ANY, "%s: line %d: "
-                                               "unable to normalize suffix "
-                                               "\"%s\"\n", fname, lineno, dn );
+                                               "suffix DN empty and default "
+                                               "search base provided \"%s\" (assuming okay)\n",
+                                       fname, lineno, default_search_base.bv_val );
 #endif
-                                       free( dn );
-                                       return 1;
-                               }
-                               ber_bvecadd( &be->be_nsuffix, ber_bvstr( dn ) );
                        }
 
+                       charray_add( &be->be_suffix, pdn->bv_val );
+                       ber_bvecadd( &be->be_nsuffix, ndn );
+
                /* set database suffixAlias */
                } else if ( strcasecmp( cargv[0], "suffixAlias" ) == 0 ) {
                        Backend *tmp_be;
+                       struct berval alias, *palias, *nalias;
+                       struct berval aliased, *paliased, *naliased;
+
                        if ( cargc < 2 ) {
 #ifdef NEW_LOGGING
                                LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
-                                          "%s: line %d: missing alias and aliased_dn in "
-                                          "\"suffixAlias <alias> <aliased_dn>\" line.\n",
-                                          fname, lineno ));
+                                       "%s: line %d: missing alias and aliased_dn in "
+                                       "\"suffixAlias <alias> <aliased_dn>\" line.\n",
+                                       fname, lineno ));
 #else
                                Debug( LDAP_DEBUG_ANY,
-"%s: line %d: missing alias and aliased_dn in \"suffixAlias <alias> <aliased_dn>\" line\n",
+                                       "%s: line %d: missing alias and aliased_dn in "
+                                       "\"suffixAlias <alias> <aliased_dn>\" line.\n",
                                        fname, lineno, 0 );
 #endif
 
@@ -989,25 +1029,26 @@ read_config( const char *fname )
                        } else if ( cargc < 3 ) {
 #ifdef NEW_LOGGING
                                LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
-                                          "%s: line %d: missing aliased_dn in "
-                                          "\"suffixAlias <alias> <aliased_dn>\" line\n",
-                                          fname, lineno ));
+                                       "%s: line %d: missing aliased_dn in "
+                                       "\"suffixAlias <alias> <aliased_dn>\" line\n",
+                                       fname, lineno ));
 #else
                                Debug( LDAP_DEBUG_ANY,
-"%s: line %d: missing aliased_dn in \"suffixAlias <alias> <aliased_dn>\" line\n",
-                               fname, lineno, 0 );
+                                       "%s: line %d: missing aliased_dn in "
+                                       "\"suffixAlias <alias> <aliased_dn>\" line\n",
+                                       fname, lineno, 0 );
 #endif
 
                                return( 1 );
                        } else if ( cargc > 3 ) {
 #ifdef NEW_LOGGING
                                LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
-                                          "%s: line %d: extra cruft in suffixAlias line (ignored)\n",
-                                          fname, lineno ));
+                                       "%s: line %d: extra cruft in suffixAlias line (ignored)\n",
+                                       fname, lineno ));
 #else
                                Debug( LDAP_DEBUG_ANY,
                                        "%s: line %d: extra cruft in suffixAlias line (ignored)\n",
-                               fname, lineno, 0 );
+                                       fname, lineno, 0 );
 #endif
 
                        }
@@ -1015,62 +1056,124 @@ read_config( const char *fname )
                        if ( be == NULL ) {
 #ifdef NEW_LOGGING
                                LDAP_LOG(( "config", LDAP_LEVEL_INFO,
-                                          "%s: line %d: suffixAlias line must appear inside a "
-                                          "database definition (ignored).\n", fname, lineno ));
+                                       "%s: line %d: suffixAlias line must appear inside a "
+                                       "database definition (ignored).\n", fname, lineno ));
 #else
                                Debug( LDAP_DEBUG_ANY,
                                        "%s: line %d: suffixAlias line"
                                        " must appear inside a database definition (ignored)\n",
                                        fname, lineno, 0 );
 #endif
+                       }
+
+                       if ( load_ucdata( NULL ) < 0 ) return 1;
+                       
+                       alias.bv_val = cargv[1];
+                       alias.bv_len = strlen( cargv[1] );
+
+                       rc = dnPretty( NULL, &alias, &palias );
+                       if( rc != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+                               LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+                                       "%s: line %d: alias DN is invalid.\n",
+                                       fname, lineno ));
+#else
+                               Debug( LDAP_DEBUG_ANY,
+                                       "%s: line %d: alias DN is invalid\n",
+                                  fname, lineno, 0 );
+#endif
+                               return( 1 );
+                       }
+
+                       rc = dnNormalize( NULL, &alias, &nalias );
+                       if( rc != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+                               LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+                                       "%s: line %d: alias DN is invalid.\n",
+                                       fname, lineno ));
+#else
+                               Debug( LDAP_DEBUG_ANY,
+                                       "%s: line %d: alias DN is invalid\n",
+                                  fname, lineno, 0 );
+#endif
+                               ber_bvfree( palias );
+                               return( 1 );
+                       }
 
-                       } else if ( (tmp_be = select_backend( cargv[1], 0, 0 )) != NULL ) {
+                       tmp_be = select_backend( nalias, 0, 0 );
+                       ber_bvfree( nalias );
+                       if ( tmp_be != be ) {
 #ifdef NEW_LOGGING
                                LDAP_LOG(( "config", LDAP_LEVEL_INFO,
-                                          "%s: line %d: suffixAlias served by a preceeding "
-                                          "backend \"%s\" (ignored).\n", fname, lineno,
-                                          tmp_be->be_suffix[0] ));
+                                       "%s: line %d: suffixAlias served by a preceeding "
+                                       "backend \"%s\"\n",
+                                       fname, lineno, tmp_be->be_suffix[0] ));
 #else
                                Debug( LDAP_DEBUG_ANY,
                                        "%s: line %d: suffixAlias served by"
-                                       "  a preceeding backend \"%s\" (ignored)\n",
+                                       "  a preceeding backend \"%s\"\n",
                                        fname, lineno, tmp_be->be_suffix[0] );
 #endif
+                               ber_bvfree( palias );
+                               return -1;
+                       }
+
+                       aliased.bv_val = cargv[2];
+                       aliased.bv_len = strlen( cargv[2] );
 
+                       rc = dnPretty( NULL, &aliased, &paliased );
+                       if( rc != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+                               LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+                                       "%s: line %d: aliased DN is invalid.\n",
+                                       fname, lineno ));
+#else
+                               Debug( LDAP_DEBUG_ANY,
+                                       "%s: line %d: aliased DN is invalid\n",
+                                  fname, lineno, 0 );
+#endif
+                               ber_bvfree( palias );
+                               return( 1 );
+                       }
+
+                       rc = dnNormalize( NULL, &aliased, &naliased );
+                       if( rc != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+                               LDAP_LOG(( "config", LDAP_LEVEL_CRIT,
+                                       "%s: line %d: aliased DN is invalid.\n",
+                                       fname, lineno ));
+#else
+                               Debug( LDAP_DEBUG_ANY,
+                                       "%s: line %d: aliased DN is invalid\n",
+                                  fname, lineno, 0 );
+#endif
+                               ber_bvfree( palias );
+                               ber_bvfree( paliased );
+                               return( 1 );
+                       }
 
-                       } else if ( (tmp_be = select_backend( cargv[2], 0, 0 )) != NULL ) {
+                       tmp_be = select_backend( naliased, 0, 0 );
+                       ber_bvfree( naliased );
+                       if ( tmp_be != be ) {
 #ifdef NEW_LOGGING
                                LDAP_LOG(( "config", LDAP_LEVEL_INFO,
-                                          "%s: line %d: suffixAlias derefs to a different backend "
-                                          "a preceeding backend \"%s\" (ignored)\n",
-                                          fname, lineno, tmp_be->be_suffix[0] ));
+                                       "%s: line %d: suffixAlias derefs to a different backend "
+                                       "a preceeding backend \"%s\" (ignored)\n",
+                                       fname, lineno, tmp_be->be_suffix[0] ));
 #else
                                Debug( LDAP_DEBUG_ANY,
                                        "%s: line %d: suffixAlias derefs to differnet backend"
                                        "  a preceeding backend \"%s\" (ignored)\n",
                                        fname, lineno, tmp_be->be_suffix[0] );
 #endif
-
-
-                       } else {
-                               char *alias, *aliased_dn;
-
-                               if ( load_ucdata( NULL ) < 0 ) {
-                                       return( 1 );
-                               }
-
-                               alias = ch_strdup( cargv[1] );
-                               (void) dn_normalize( alias );
-
-                               aliased_dn = ch_strdup( cargv[2] );
-                               (void) dn_normalize( aliased_dn );
-
-                               ber_bvecadd( &be->be_suffixAlias, 
-                                       ber_bvstr( alias ) );
-                               ber_bvecadd( &be->be_suffixAlias,
-                                       ber_bvstr( aliased_dn ) );
+                               ber_bvfree( palias );
+                               ber_bvfree( paliased );
+                               return -1;
                        }
 
+                       ber_bvecadd( &be->be_suffixAlias, palias ); 
+                       ber_bvecadd( &be->be_suffixAlias, paliased );
+
                /* set max deref depth */
                } else if ( strcasecmp( cargv[0], "maxDerefDepth" ) == 0 ) {
                                        int i;
@@ -1144,9 +1247,7 @@ read_config( const char *fname )
                        } else {
                                struct berval dn, *pdn = NULL, *ndn = NULL;
                                
-                               if ( load_ucdata( NULL ) < 0 ) {
-                                       return( 1 );
-                               }
+                               if ( load_ucdata( NULL ) < 0 ) return 1;
 
                                dn.bv_val = cargv[1];
                                dn.bv_len = strlen( cargv[1] );
@@ -1822,9 +1923,7 @@ read_config( const char *fname )
                        } else {
                                struct berval dn, *ndn = NULL;
 
-                               if ( load_ucdata( NULL ) < 0 ) {
-                                       return( 1 );
-                               }
+                               if ( load_ucdata( NULL ) < 0 ) return 1;
 
                                dn.bv_val = cargv[1];
                                dn.bv_len = strlen( cargv[1] );
@@ -2226,9 +2325,8 @@ read_config( const char *fname )
                free( saveline );
        }
        fclose( fp );
-       if ( load_ucdata( NULL ) < 0 ) {
-               return( 1 );
-       }
+
+       if ( load_ucdata( NULL ) < 0 ) return 1;
        return( 0 );
 }
 
index cf6c4e00fa3eb6d9d507795e183600bebb5d2c24..2eeb56daacaf548d324511fba3af5abdfd954590 100644 (file)
@@ -143,7 +143,7 @@ do_delete(
         * appropriate one, or send a referral to our "referral server"
         * if we don't hold it.
         */
-       if ( (be = select_backend( ndn->bv_val, manageDSAit, 0 )) == NULL ) {
+       if ( (be = select_backend( ndn, manageDSAit, 0 )) == NULL ) {
                struct berval **ref = referral_rewrite( default_referral,
                        NULL, pdn->bv_val, LDAP_SCOPE_DEFAULT );
 
index 4832d8dc8d18b382100f814e8fd1ccfcb21f1b5c..80adab778e1fb40510a46b6a76778d1d8856ba61 100644 (file)
@@ -297,7 +297,7 @@ do_modify(
         * appropriate one, or send a referral to our "referral server"
         * if we don't hold it.
         */
-       if ( (be = select_backend( ndn->bv_val, manageDSAit, 0 )) == NULL ) {
+       if ( (be = select_backend( ndn, manageDSAit, 0 )) == NULL ) {
                struct berval **ref = referral_rewrite( default_referral,
                        NULL, pdn->bv_val, LDAP_SCOPE_DEFAULT );
 
index b4b8e04c205f1076d2d7f80b8291a1e1fe757952..15f88529ea0bf105720bddd1f8df5b8528d7a42c 100644 (file)
@@ -323,7 +323,7 @@ do_modrdn(
         * appropriate one, or send a referral to our "referral server"
         * if we don't hold it.
         */
-       if ( (be = select_backend( ndn->bv_val, manageDSAit, 0 )) == NULL ) {
+       if ( (be = select_backend( ndn, manageDSAit, 0 )) == NULL ) {
                struct berval **ref = referral_rewrite( default_referral,
                        NULL, dn.bv_val, LDAP_SCOPE_DEFAULT );
 
@@ -352,7 +352,7 @@ do_modrdn(
         * the same backend, otherwise we return an error.
         */
        if( newSuperior.bv_len ) {
-               newSuperior_be = select_backend( nnewSuperior->bv_val, 0, 0 );
+               newSuperior_be = select_backend( nnewSuperior, 0, 0 );
 
                if ( newSuperior_be != be ) {
                        /* newSuperior is in same backend */
index fb0bd6896c7d7e6cdca3abebbcad2d2e28929163..ee071973a946c10b47bc46e4ce0d5cc741dd4d70 100644 (file)
@@ -153,7 +153,7 @@ LDAP_SLAPD_F (BackendInfo *) backend_info LDAP_P(( const char *type ));
 LDAP_SLAPD_F (BackendDB *) backend_db_init LDAP_P(( const char *type ));
 
 LDAP_SLAPD_F (BackendDB *) select_backend LDAP_P((
-       const char * dn,
+       struct berval * dn,
        int manageDSAit,
        int noSubordinates ));
 
@@ -889,7 +889,7 @@ LDAP_SLAPD_F (int) slap_passwd_parse(
  * kerberos.c
  */
 #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
-LDAP_SLAPD_V (char)    *ldap_srvtab;
+LDAP_SLAPD_V (char *)  ldap_srvtab;
 LDAP_SLAPD_V (int)     krbv4_ldap_auth();
 #endif
 
@@ -925,14 +925,14 @@ LDAP_SLAPD_V (slap_access_t)      global_default_access;
 LDAP_SLAPD_V (int)             global_lastmod;
 LDAP_SLAPD_V (int)             global_idletimeout;
 LDAP_SLAPD_V (int)             global_schemacheck;
-LDAP_SLAPD_V (char)            *global_host;
-LDAP_SLAPD_V (char)            *global_realm;
+LDAP_SLAPD_V (char *)  global_host;
+LDAP_SLAPD_V (char *)  global_realm;
 LDAP_SLAPD_V (int)             sasl_external_x509dn_convert;
-LDAP_SLAPD_V (char)            *default_passwd_hash;
+LDAP_SLAPD_V (char *)  default_passwd_hash;
 LDAP_SLAPD_V (int)             lber_debug;
 LDAP_SLAPD_V (int)             ldap_syslog;
-LDAP_SLAPD_V (char *)  default_search_base;
-LDAP_SLAPD_V (char *)  default_search_nbase;
+LDAP_SLAPD_V (struct berval)   default_search_base;
+LDAP_SLAPD_V (struct berval)   default_search_nbase;
 
 LDAP_SLAPD_V (int)             nSaslRegexp;
 LDAP_SLAPD_V (SaslRegexp_t*) SaslRegexp;
@@ -949,7 +949,7 @@ LDAP_SLAPD_V (long)         num_ops_initiated;
 
 LDAP_SLAPD_V (char *)          slapd_pid_file;
 LDAP_SLAPD_V (char *)          slapd_args_file;
-LDAP_SLAPD_V (char)            **g_argv;
+LDAP_SLAPD_V (char **)         g_argv;
 LDAP_SLAPD_V (time_t)          starttime;
 
 /* use time(3) -- no mutex */
index 055972730f156ba0e6b7e79d881e51c54c5ff696..6007de18e0fe1a4246294b41a81cfaf93a293784 100644 (file)
@@ -53,21 +53,24 @@ add_replica_suffix(
     const char  *suffix
 )
 {
-       char    *nsuffix = ch_strdup( suffix );
-       int     rc = 0;
-
-       if ( dn_normalize( nsuffix ) != NULL ) {
-               if ( select_backend( nsuffix, 0, 0 ) == be ) {
-                       charray_add( &be->be_replica[nr]->ri_nsuffix, nsuffix );
-               } else {
-                       rc = 1;
-               }
-       } else {
-               rc = 2;
+       struct berval dn, *ndn = NULL;
+       int rc;
+
+       dn.bv_val = (char *) suffix;
+       dn.bv_len = strlen( dn.bv_val );
+
+       rc = dnNormalize( NULL, &dn, &ndn );
+       if( rc != LDAP_SUCCESS ) {
+               return 2;
+       }
+
+       if ( select_backend( ndn, 0, 0 ) != be ) {
+               ber_bvfree( ndn );
+               return 1;
        }
-       free( nsuffix );
 
-       return( rc );
+       ber_bvecadd( &be->be_replica[nr]->ri_nsuffix, ndn );
+       return 0;
 }
 
 void
@@ -108,7 +111,7 @@ replog(
                        int j;
 
                        for ( j = 0; be->be_replica[i]->ri_nsuffix[j]; j++ ) {
-                               if ( dn_issuffix( ndn, be->be_replica[i]->ri_nsuffix[j] ) ) {
+                               if ( dn_issuffix( ndn, be->be_replica[i]->ri_nsuffix[j]->bv_val ) ) {
                                        break;
                                }
                        }
index 1b00a6923b4eeabcd7d5dee0ae9412d5a3938287..57b204ee73f9b886940d2dad593ed25871119ffe 100644 (file)
@@ -344,7 +344,7 @@ char *slap_sasl2dn( char *saslname )
 #endif
 
 
-       be = select_backend( searchbase.bv_val, 0, 1 );
+       be = select_backend( &searchbase, 0, 1 );
        if(( be == NULL ) || ( be->be_search == NULL))
                goto FINISHED;
        suffix_alias( be, &searchbase );
@@ -467,7 +467,7 @@ int slap_sasl_match( char *rule, char *assertDN, char *authc )
 #endif
 
 
-       be = select_backend( searchbase.bv_val, 0, 1 );
+       be = select_backend( &searchbase, 0, 1 );
        if(( be == NULL ) || ( be->be_search == NULL)) {
                rc = LDAP_INAPPROPRIATE_AUTH;
                goto CONCLUDED;
index 6d07293a95130e63f92edec8fb7a445612fcca42..5f8d78c0a689bad18d857ade47bc4bbd748b5086 100644 (file)
@@ -282,13 +282,14 @@ do_search(
                }
        }
 
-       if( nbase->bv_len == 0 && default_search_nbase != NULL ) {
+       if( !nbase->bv_len && default_search_nbase.bv_len ) {
                ch_free( base.bv_val );
                ch_free( nbase->bv_val );
-               base.bv_val = ch_strdup( default_search_base );
-               base.bv_len = strlen( default_search_nbase );
-               nbase->bv_val = ch_strdup( default_search_nbase );
-               nbase->bv_len = strlen( default_search_nbase );
+
+               base.bv_val = ch_strdup( default_search_base.bv_val );
+               base.bv_len = default_search_base.bv_len;
+               nbase->bv_val = ch_strdup( default_search_nbase.bv_val );
+               nbase->bv_len = default_search_nbase.bv_len;
        }
 
        /*
@@ -296,7 +297,7 @@ do_search(
         * appropriate one, or send a referral to our "referral server"
         * if we don't hold it.
         */
-       if ( (be = select_backend( nbase->bv_val, manageDSAit, 1 )) == NULL ) {
+       if ( (be = select_backend( nbase, manageDSAit, 1 )) == NULL ) {
                struct berval **ref = referral_rewrite( default_referral,
                        NULL, pbase->bv_val, scope );
 
index 2c61ffa273059040a5397259133a8629ed59e7db..c72f119ace389bf9cdb274d84404b325050e0273 100644 (file)
@@ -862,8 +862,8 @@ LDAP_SLAPD_V (int) slapMode;
 #define SLAP_TRUNCATE_MODE     0x0100
 
 struct slap_replica_info {
-       char   *ri_host;        /* supersedes be_replica */
-       char  **ri_nsuffix;     /* array of suffixes this replica accepts */
+       char *ri_host;                          /* supersedes be_replica */
+       struct berval **ri_nsuffix;     /* array of suffixes this replica accepts */
 };
 
 struct slap_limits_set {
@@ -1245,7 +1245,7 @@ typedef struct slap_gacl {
        ObjectClass *oc;
        AttributeDescription *at;
        int res;
-       int len;
+       ber_len_t len;
        char ndn[1];
 } GroupAssertion;
 
index 581072850af746a5306892d15b8d73e2d6056bd5..2e9fdeca59a0398e7b17dddb918ee0f0ca011785 100644 (file)
@@ -75,7 +75,7 @@ main( int argc, char **argv )
                }
 
                /* check backend */
-               if( select_backend( e->e_ndn, is_entry_referral(e), nosubs ) != be ) {
+               if( select_backend( &e->e_nname, is_entry_referral(e), nosubs ) != be ) {
                        fprintf( stderr, "%s: line %d: "
                                "database (%s) not configured to hold \"%s\"\n",
                                progname, lineno,
index ffa14fa6e4253830cc9dac93bc0ce8d64bef0ba6..e2f90b88f46a6ac9f329c465e72048bf9a23532a 100644 (file)
@@ -221,7 +221,7 @@ slap_tool_init(
                        exit( EXIT_FAILURE );
                }
 
-               be = select_backend( nbase->bv_val, 0, 0 );
+               be = select_backend( nbase, 0, 0 );
                ber_bvfree( nbase );
 
                if( be == NULL ) {