From 23efa07a994c94c4e78a9495ac6e2981b87b4ba0 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Sat, 24 Aug 2002 00:55:24 +0000 Subject: [PATCH] use ldap_charray_*() instead of charray_*() --- servers/slapd/back-bdb/attr.c | 8 ++++---- servers/slapd/back-bdb/dn2id.c | 6 +++--- servers/slapd/back-dnssrv/referral.c | 4 ++-- servers/slapd/back-dnssrv/search.c | 4 ++-- servers/slapd/back-ldbm/attr.c | 8 ++++---- servers/slapd/back-shell/shell.h | 2 +- servers/slapd/backend.c | 2 +- servers/slapd/daemon.c | 12 ++++++------ servers/slapd/libslapd.dsp | 4 ---- servers/slapd/oidm.c | 4 ++-- servers/slapd/proto-slap.h | 14 +------------- servers/slapd/root_dse.c | 2 +- servers/slapd/sasl.c | 2 +- servers/slapd/tools/slapadd.c | 1 + 14 files changed, 29 insertions(+), 44 deletions(-) diff --git a/servers/slapd/back-bdb/attr.c b/servers/slapd/back-bdb/attr.c index b60f82c8de..07bfc92cab 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 4e8d02cd60..96eedca61b 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 6d7e240dce..4bd8fbe037 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 a619e3c23d..1af13a27e4 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 6bfa9824b4..47022cfe40 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 25b7aaf28d..907de602ca 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 a6237ec5db..461fc7a9f5 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 c732e1afa6..f4022fc27c 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 a441af9c62..41614b6491 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 d779496a41..a244d18b9b 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 \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 fe3b1546df..e414844832 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -7,6 +7,7 @@ #define PROTO_SLAP_H #include +#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 62c2fc7cf0..854bb0e2ec 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 756ae1187b..6c7cd68e02 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 3c71859e83..91fb15c382 100644 --- a/servers/slapd/tools/slapadd.c +++ b/servers/slapd/tools/slapadd.c @@ -16,6 +16,7 @@ #include #include +#include #include "slapcommon.h" -- 2.39.5