char **attrs;
        char **indexes = NULL;
 
-       attrs = str2charray( argv[0], "," );
+       attrs = ldap_str2charray( argv[0], "," );
 
        if( attrs == NULL ) {
                fprintf( stderr, "%s: line %d: "
        }
 
        if ( argc > 1 ) {
-               indexes = str2charray( argv[1], "," );
+               indexes = ldap_str2charray( argv[1], "," );
 
                if( indexes == NULL ) {
                        fprintf( stderr, "%s: line %d: "
                }
        }
 
-       charray_free( attrs );
-       if ( indexes != NULL ) charray_free( indexes );
+       ldap_charray_free( attrs );
+       if ( indexes != NULL ) ldap_charray_free( indexes );
 
        return LDAP_SUCCESS;
 }
 
        rdns = ldap_explode_dn(be->be_nsuffix[0].bv_val, 0);
        for (i=0; rdns[i]; i++);
        bdb->bi_nrdns = i;
-       charray_free(rdns);
+       ldap_charray_free(rdns);
 
        DBTzero( &key );
        DBTzero( &data );
        for (i=0; rdns[i]; i++);
        i -= bdb->bi_nrdns;
        if (i < 0) {
-               charray_free(rdns);
+               ldap_charray_free(rdns);
                return -1;
        }
        n = p;
                p = n;
        }
        ldap_pvt_thread_rdwr_runlock(&bdb->bi_tree_rdwr);
-       charray_free(rdns);
+       ldap_charray_free(rdns);
 
        if (n) {
                *id = n->i_id;
 
                goto done;
        }
 
-       hosts = str2charray( hostlist, " " );
+       hosts = ldap_str2charray( hostlist, " " );
 
        if( hosts == NULL ) {
                Debug( LDAP_DEBUG_TRACE, "DNSSRV: str2charrary error\n", 0, 0, 0 );
 done:
        if( domain != NULL ) ch_free( domain );
        if( hostlist != NULL ) ch_free( hostlist );
-       if( hosts != NULL ) charray_free( hosts );
+       if( hosts != NULL ) ldap_charray_free( hosts );
        ber_bvarray_free( urls );
        return rc;
 }
 
                goto done;
        }
 
-       hosts = str2charray( hostlist, " " );
+       hosts = ldap_str2charray( hostlist, " " );
 
        if( hosts == NULL ) {
                Debug( LDAP_DEBUG_TRACE, "DNSSRV: str2charrary error\n", 0, 0, 0 );
 done:
        if( domain != NULL ) ch_free( domain );
        if( hostlist != NULL ) ch_free( hostlist );
-       if( hosts != NULL ) charray_free( hosts );
+       if( hosts != NULL ) ldap_charray_free( hosts );
        if( urls != NULL ) ber_bvarray_free( urls );
        return 0;
 }
 
        char **attrs;
        char **indexes = NULL;
 
-       attrs = str2charray( argv[0], "," );
+       attrs = ldap_str2charray( argv[0], "," );
 
        if( attrs == NULL ) {
                fprintf( stderr, "%s: line %d: "
        }
 
        if ( argc > 1 ) {
-               indexes = str2charray( argv[1], "," );
+               indexes = ldap_str2charray( argv[1], "," );
 
                if( indexes == NULL ) {
                        fprintf( stderr, "%s: line %d: "
                }
        }
 
-       charray_free( attrs );
-       if ( indexes != NULL ) charray_free( indexes );
+       ldap_charray_free( attrs );
+       if ( indexes != NULL ) ldap_charray_free( indexes );
 
        return LDAP_SUCCESS;
 }
 
 #else /* !SHELL_SURROGATE_PARENT */
 
 typedef char **Cmd_info;
-#define MAKE_CMD_INFO(args)  charray_dup( args )
+#define MAKE_CMD_INFO(args)  ldap_charray_dup( args )
 #define IS_NULLCMD(cmd)      ((cmd) == NULL)
 
 #endif /* SHELL_SURROGATE_PARENT */
 
 
        for( ; *ctrls != NULL ; ctrls++ ) {
                if( (*ctrls)->ldctl_iscritical &&
-                       !charray_inlist( be->be_controls, (*ctrls)->ldctl_oid ) )
+                       !ldap_charray_inlist( be->be_controls, (*ctrls)->ldctl_oid ) )
                {
                        *text = "control unavailable in context";
                        return LDAP_UNAVAILABLE_CRITICAL_EXTENSION;
 
 void slapd_slp_init( const char* urls ) {
        int i;
 
-       slapd_srvurls = str2charray( urls, " " );
+       slapd_srvurls = ldap_str2charray( urls, " " );
 
        if( slapd_srvurls == NULL ) return;
 
 void slapd_slp_deinit() {
        if( slapd_srvurls == NULL ) return;
 
-       charray_free( slapd_srvurls );
+       ldap_charray_free( slapd_srvurls );
        slapd_srvurls = NULL;
 
        /* close the SLP handle */
                urls = "ldap:///";
        }
 
-       u = str2charray( urls, " " );
+       u = ldap_str2charray( urls, " " );
 
        if( u == NULL || u[0] == NULL ) {
 #ifdef NEW_LOGGING
                Debug( LDAP_DEBUG_ANY, "daemon_init: no listeners to open (%s)\n",
                        urls, 0, 0 );
 #endif
-               charray_free( u );
+               ldap_charray_free( u );
                return -1;
        }
 
 
        for(n = 0, j = 0; u[n]; n++ ) {
                if ( slap_open_listener( u[n], &i, &j ) ) {
-                       charray_free( u );
+                       ldap_charray_free( u );
                        return -1;
                }
        }
        slapd_slp_reg();
 #endif
 
-       charray_free( u );
+       ldap_charray_free( u );
        ldap_pvt_thread_mutex_init( &slap_daemon.sd_mutex );
        return !i;
 }
 
 # End Source File
 # Begin Source File
 
-SOURCE=.\charray.c
-# End Source File
-# Begin Source File
-
 SOURCE=.\compare.c
 # End Source File
 # Begin Source File
 
 
        for (om = om_list; om; om = n) {
                n = om->som_next;
-               charray_free(om->som_names);
+               ldap_charray_free(om->som_names);
                free(om->som_oid.bv_val);
                free(om);
        }
        om = (OidMacro *) ch_malloc( sizeof(OidMacro) );
 
        om->som_names = NULL;
-       charray_add( &om->som_names, argv[1] );
+       ldap_charray_add( &om->som_names, argv[1] );
        om->som_oid.bv_val = oidm_find( argv[2] );
 
        if (!om->som_oid.bv_val) {
 
 #define PROTO_SLAP_H
 
 #include <ldap_cdefs.h>
+#include "ldap_pvt.h"
 
 LDAP_BEGIN_DECL
 
 #endif
 #endif
 
-/*
- * charray.c
- */
-LDAP_SLAPD_F (void) charray_add LDAP_P(( char ***a, const char *s ));
-LDAP_SLAPD_F (void) charray_add_n LDAP_P(( char ***a, const char *s, int l ));
-LDAP_SLAPD_F (void) charray_merge LDAP_P(( char ***a, char **s ));
-LDAP_SLAPD_F (void) charray_free LDAP_P(( char **array ));
-LDAP_SLAPD_F (int) charray_inlist LDAP_P(( char **a, const char *s ));
-LDAP_SLAPD_F (char **) charray_dup LDAP_P(( char **a ));
-LDAP_SLAPD_F (char **) str2charray LDAP_P(( const char *str, const char *brkstr ));
-LDAP_SLAPD_F (int) charray_strcmp LDAP_P(( const char **a1, const char **a2 ));
-LDAP_SLAPD_F (int) charray_strcasecmp LDAP_P(( const char **a1, const char **a2 ));
-
 /*
  * controls.c
  */
 
                        vals[0].bv_len = strlen( vals[0].bv_val );
                        attr_merge( e, ad_supportedSASLMechanisms, vals );
                }
-               charray_free( supportedSASLMechanisms );
+               ldap_charray_free( supportedSASLMechanisms );
        }
 
        if ( default_referral != NULL ) {
 
                        return NULL;
                }
 
-               mechs = str2charray( mechstr, "," );
+               mechs = ldap_str2charray( mechstr, "," );
 
 #if SASL_VERSION_MAJOR < 2
                ch_free( mechstr );
 
 
 #include <lber.h>
 #include <ldif.h>
+#include <lutil.h>
 
 #include "slapcommon.h"