diff --git a/servers/slapd/back-bdb/attr.c b/servers/slapd/back-bdb/attr.c
index b60f82c8dedb33932c0a708859016aa4bdb86804..07bfc92cabec4f606fb32f8d4c53b8e3466a4c4e 100644
--- a/servers/slapd/back-bdb/attr.c
+++ b/servers/slapd/back-bdb/attr.c
@@ -67,7 +67,7 @@ bdb_attr_index_config(
 	char **attrs;
 	char **indexes = NULL;
 
-	attrs = str2charray( argv[0], "," );
+	attrs = ldap_str2charray( argv[0], "," );
 
 	if( attrs == NULL ) {
 		fprintf( stderr, "%s: line %d: "
@@ -77,7 +77,7 @@ bdb_attr_index_config(
 	}
 
 	if ( argc > 1 ) {
-		indexes = str2charray( argv[1], "," );
+		indexes = ldap_str2charray( argv[1], "," );
 
 		if( indexes == NULL ) {
 			fprintf( stderr, "%s: line %d: "
@@ -205,8 +205,8 @@ bdb_attr_index_config(
 		}
 	}
 
-	charray_free( attrs );
-	if ( indexes != NULL ) charray_free( indexes );
+	ldap_charray_free( attrs );
+	if ( indexes != NULL ) ldap_charray_free( indexes );
 
 	return LDAP_SUCCESS;
 }
diff --git a/servers/slapd/back-bdb/dn2id.c b/servers/slapd/back-bdb/dn2id.c
index 4e8d02cd60aab4b6439f1344fdb8379d78de9ad8..96eedca61bcc981b05b78e045bd66816af24e305 100644
--- a/servers/slapd/back-bdb/dn2id.c
+++ b/servers/slapd/back-bdb/dn2id.c
@@ -744,7 +744,7 @@ int bdb_build_tree(
 	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 );
@@ -938,7 +938,7 @@ bdb_dn2id_matched(
 	for (i=0; rdns[i]; i++);
 	i -= bdb->bi_nrdns;
 	if (i < 0) {
-		charray_free(rdns);
+		ldap_charray_free(rdns);
 		return -1;
 	}
 	n = p;
@@ -951,7 +951,7 @@ bdb_dn2id_matched(
 		p = n;
 	}
 	ldap_pvt_thread_rdwr_runlock(&bdb->bi_tree_rdwr);
-	charray_free(rdns);
+	ldap_charray_free(rdns);
 
 	if (n) {
 		*id = n->i_id;
diff --git a/servers/slapd/back-dnssrv/referral.c b/servers/slapd/back-dnssrv/referral.c
index 6d7e240dcecf9ecdfa712763c80a051c420866b5..4bd8fbe037827c2e57655f2fa87d86d335c9e1f6 100644
--- a/servers/slapd/back-dnssrv/referral.c
+++ b/servers/slapd/back-dnssrv/referral.c
@@ -65,7 +65,7 @@ dnssrv_back_referrals(
 		goto done;
 	}
 
-	hosts = str2charray( hostlist, " " );
+	hosts = ldap_str2charray( hostlist, " " );
 
 	if( hosts == NULL ) {
 		Debug( LDAP_DEBUG_TRACE, "DNSSRV: str2charrary error\n", 0, 0, 0 );
@@ -103,7 +103,7 @@ dnssrv_back_referrals(
 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;
 }
diff --git a/servers/slapd/back-dnssrv/search.c b/servers/slapd/back-dnssrv/search.c
index a619e3c23d391c7b137acf10de218f58d8fb9bcb..1af13a27e4f4c73fd22427c432a779bd1d282dcd 100644
--- a/servers/slapd/back-dnssrv/search.c
+++ b/servers/slapd/back-dnssrv/search.c
@@ -63,7 +63,7 @@ dnssrv_back_search(
 		goto done;
 	}
 
-	hosts = str2charray( hostlist, " " );
+	hosts = ldap_str2charray( hostlist, " " );
 
 	if( hosts == NULL ) {
 		Debug( LDAP_DEBUG_TRACE, "DNSSRV: str2charrary error\n", 0, 0, 0 );
@@ -225,7 +225,7 @@ dnssrv_back_search(
 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;
 }
diff --git a/servers/slapd/back-ldbm/attr.c b/servers/slapd/back-ldbm/attr.c
index 6bfa9824b4a12a096fe6e6b15697924b852d99be..47022cfe40bcfb7e6409807a9ce781234b7cbcc7 100644
--- a/servers/slapd/back-ldbm/attr.c
+++ b/servers/slapd/back-ldbm/attr.c
@@ -67,7 +67,7 @@ attr_index_config(
 	char **attrs;
 	char **indexes = NULL;
 
-	attrs = str2charray( argv[0], "," );
+	attrs = ldap_str2charray( argv[0], "," );
 
 	if( attrs == NULL ) {
 		fprintf( stderr, "%s: line %d: "
@@ -77,7 +77,7 @@ attr_index_config(
 	}
 
 	if ( argc > 1 ) {
-		indexes = str2charray( argv[1], "," );
+		indexes = ldap_str2charray( argv[1], "," );
 
 		if( indexes == NULL ) {
 			fprintf( stderr, "%s: line %d: "
@@ -206,8 +206,8 @@ attr_index_config(
 		}
 	}
 
-	charray_free( attrs );
-	if ( indexes != NULL ) charray_free( indexes );
+	ldap_charray_free( attrs );
+	if ( indexes != NULL ) ldap_charray_free( indexes );
 
 	return LDAP_SUCCESS;
 }
diff --git a/servers/slapd/back-shell/shell.h b/servers/slapd/back-shell/shell.h
index 25b7aaf28db2ece77d2fc5446ba5fde579ca07f8..907de602ca59f0d051b6308b5493e79a2dd8c538 100644
--- a/servers/slapd/back-shell/shell.h
+++ b/servers/slapd/back-shell/shell.h
@@ -32,7 +32,7 @@ extern void make_surrogate_parent LDAP_P(( void ));
 #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 */
diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c
index a6237ec5db8148b55ff0604e84cc0418337afdff..461fc7a9f5af79c7a20cf4936215356fc948680f 100644
--- a/servers/slapd/backend.c
+++ b/servers/slapd/backend.c
@@ -748,7 +748,7 @@ backend_check_controls(
 
 	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;
diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c
index c732e1afa68c268f3d15aece89b7307a449d21db..f4022fc27c4be7f938cb624a53c4b80159e3138e 100644
--- a/servers/slapd/daemon.c
+++ b/servers/slapd/daemon.c
@@ -95,7 +95,7 @@ static SLPHandle slapd_hslp = 0;
 void slapd_slp_init( const char* urls ) {
 	int i;
 
-	slapd_srvurls = str2charray( urls, " " );
+	slapd_srvurls = ldap_str2charray( urls, " " );
 
 	if( slapd_srvurls == NULL ) return;
 
@@ -134,7 +134,7 @@ void slapd_slp_init( const char* urls ) {
 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 */
@@ -927,7 +927,7 @@ int slapd_daemon_init( const char *urls )
 		urls = "ldap:///";
 	}
 
-	u = str2charray( urls, " " );
+	u = ldap_str2charray( urls, " " );
 
 	if( u == NULL || u[0] == NULL ) {
 #ifdef NEW_LOGGING
@@ -958,7 +958,7 @@ int slapd_daemon_init( const char *urls )
 		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;
 	}
 
@@ -973,7 +973,7 @@ int slapd_daemon_init( const char *urls )
 
 	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;
 		}
 	}
@@ -992,7 +992,7 @@ int slapd_daemon_init( const char *urls )
 	slapd_slp_reg();
 #endif
 
-	charray_free( u );
+	ldap_charray_free( u );
 	ldap_pvt_thread_mutex_init( &slap_daemon.sd_mutex );
 	return !i;
 }
diff --git a/servers/slapd/libslapd.dsp b/servers/slapd/libslapd.dsp
index a441af9c62a2aaa0bc0a5513780b4fe862d639c7..41614b649119c930c80c6244fef22116756e1592 100644
--- a/servers/slapd/libslapd.dsp
+++ b/servers/slapd/libslapd.dsp
@@ -176,10 +176,6 @@ SOURCE=.\ch_malloc.c
 # End Source File
 # Begin Source File
 
-SOURCE=.\charray.c
-# End Source File
-# Begin Source File
-
 SOURCE=.\compare.c
 # End Source File
 # Begin Source File
diff --git a/servers/slapd/oidm.c b/servers/slapd/oidm.c
index d779496a412177901ae6b5f9ab5edfbfa49de0c0..a244d18b9b223fbf51cb6db0b33d6bc0f82c10c4 100644
--- a/servers/slapd/oidm.c
+++ b/servers/slapd/oidm.c
@@ -65,7 +65,7 @@ oidm_destroy()
 
 	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);
 	}
@@ -101,7 +101,7 @@ usage:	fprintf( stderr, "\tObjectIdentifier <name> <oid>\n");
 	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) {
diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h
index fe3b1546df8c73f21f557b9ddf46aa6e1f11bcf5..e414844832b15f7754ee977de03f904c5a810eae 100644
--- a/servers/slapd/proto-slap.h
+++ b/servers/slapd/proto-slap.h
@@ -7,6 +7,7 @@
 #define PROTO_SLAP_H
 
 #include <ldap_cdefs.h>
+#include "ldap_pvt.h"
 
 LDAP_BEGIN_DECL
 
@@ -257,19 +258,6 @@ LDAP_SLAPD_F (void) ch_free LDAP_P(( void * ));
 #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
  */
diff --git a/servers/slapd/root_dse.c b/servers/slapd/root_dse.c
index 62c2fc7cf05c673f080062a4b4f25f9ddcb6bb14..854bb0e2ec9e7652288cae77f13244da46c4c083 100644
--- a/servers/slapd/root_dse.c
+++ b/servers/slapd/root_dse.c
@@ -143,7 +143,7 @@ root_dse_info(
 			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 ) {
diff --git a/servers/slapd/sasl.c b/servers/slapd/sasl.c
index 756ae1187beef67aa04c8f65909902af918525db..6c7cd68e02bed51582c185f1b6bb1f9d43773623 100644
--- a/servers/slapd/sasl.c
+++ b/servers/slapd/sasl.c
@@ -1371,7 +1371,7 @@ char ** slap_sasl_mechs( Connection *conn )
 			return NULL;
 		}
 
-		mechs = str2charray( mechstr, "," );
+		mechs = ldap_str2charray( mechstr, "," );
 
 #if SASL_VERSION_MAJOR < 2
 		ch_free( mechstr );
diff --git a/servers/slapd/tools/slapadd.c b/servers/slapd/tools/slapadd.c
index 3c71859e832a8ac70eac77f6aa4f69d86ae12a4c..91fb15c3822c863933894db3fc882f80ed919f2d 100644
--- a/servers/slapd/tools/slapadd.c
+++ b/servers/slapd/tools/slapadd.c
@@ -16,6 +16,7 @@
 
 #include <lber.h>
 #include <ldif.h>
+#include <lutil.h>
 
 #include "slapcommon.h"