From: Kurt Zeilenga Date: Sun, 23 Dec 2001 22:46:37 +0000 (+0000) Subject: Minor cleanup, rename ldapava_free_*() routines and X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~565 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=9d56c59d1b3ac7f97f21da4c2cc3d09bd0129575;p=openldap Minor cleanup, rename ldapava_free_*() routines and don't expose symbols of ava helper routines --- diff --git a/include/ldap.h b/include/ldap.h index b987ed587b..1b8d3dff7d 100644 --- a/include/ldap.h +++ b/include/ldap.h @@ -1186,12 +1186,19 @@ typedef LDAPRDN** LDAPDN; #define LDAP_DN_FORMAT_AD_CANONICAL 0x0050U /* dn2str only */ #define LDAP_DN_FORMAT_MASK 0x00F0U -/* str2dn flags */ +/* DN flags */ #define LDAP_DN_PRETTY 0x0100U #define LDAP_DN_P_NOLEADTRAILSPACES 0x1000U #define LDAP_DN_P_NOSPACEAFTERRDN 0x2000U #define LDAP_DN_PEDANTIC 0xF000U +LDAP_F( void ) +ldap_avafree LDAP_P(( LDAPAVA *ava )); +LDAP_F( void ) +ldap_rdnfree LDAP_P(( LDAPRDN *rdn )); +LDAP_F( void ) +ldap_dnfree LDAP_P(( LDAPDN *dn )); + LDAP_F( int ) ldap_str2dn LDAP_P(( LDAP_CONST char *str, @@ -1204,9 +1211,6 @@ ldap_dn2str LDAP_P(( char **str, unsigned flags )); -LDAP_F( void ) -ldapava_free_dn LDAP_P(( LDAPDN *dn )); - LDAP_F( int ) ldap_str2rdn LDAP_P(( const char *str, @@ -1220,9 +1224,6 @@ ldap_rdn2str LDAP_P(( char **str, unsigned flags )); -LDAP_F( void ) -ldapava_free_rdn LDAP_P(( LDAPRDN *rdn )); - LDAP_F( int ) ldap_dn_normalize LDAP_P(( LDAP_CONST char *in, unsigned iflags, diff --git a/libraries/libldap/dntest.c b/libraries/libldap/dntest.c index 3fc988869f..a1a65f5feb 100644 --- a/libraries/libldap/dntest.c +++ b/libraries/libldap/dntest.c @@ -236,12 +236,12 @@ main( int argc, char *argv[] ) } } - ldapava_free_dn( dn2 ); + ldap_dnfree( dn2 ); ldap_memfree( str2 ); } ldap_memfree( str ); } - ldapava_free_dn( dn ); + ldap_dnfree( dn ); /* note: dn is not freed */ diff --git a/libraries/libldap/getdn.c b/libraries/libldap/getdn.c index f0be32b57a..0207a3f025 100644 --- a/libraries/libldap/getdn.c +++ b/libraries/libldap/getdn.c @@ -65,15 +65,14 @@ static int strval2ADstr( struct berval *val, char *str, unsigned flags, static int dn2domain( LDAPDN *dn, char *str, int *iRDN ); /* AVA helpers */ -LDAPAVA * ldapava_new( const struct berval *attr, const struct berval *val, - unsigned flags ); -void ldapava_free( LDAPAVA *ava ); -LDAPRDN * ldapava_append_to_rdn( LDAPRDN *rdn, LDAPAVA *ava ); -LDAPRDN * ldapava_insert_into_rdn( LDAPRDN *rdn, LDAPAVA *ava, unsigned where ); -/* void ldapava_free_rdn( LDAPRDN *rdn ); in ldap.h */ -LDAPDN * ldapava_append_to_dn( LDAPDN *dn, LDAPRDN *rdn ); -LDAPDN * ldapava_insert_into_dn( LDAPDN *dn, LDAPRDN *rdn, unsigned where ); -/* void ldapava_free_dn( LDAPDN *dn ); in ldap.h */ +static LDAPAVA * ldapava_new( + const struct berval *attr, const struct berval *val, unsigned flags ); +static LDAPRDN * ldapava_append_to_rdn( LDAPRDN *rdn, LDAPAVA *ava ); +static LDAPRDN * ldapava_insert_into_rdn( + LDAPRDN *rdn, LDAPAVA *ava, unsigned where ); +static LDAPDN * ldapava_append_to_dn( LDAPDN *dn, LDAPRDN *rdn ); +static LDAPDN * ldapava_insert_into_dn( + LDAPDN *dn, LDAPRDN *rdn, unsigned where ); /* Higher level helpers */ static int rdn2strlen( LDAPRDN *rdn, unsigned flags, ber_len_t *len, @@ -204,7 +203,7 @@ ldap_explode_dn( LDAP_CONST char *dn, int notypes ) v = LDAP_REALLOC( values, sizeof( char * ) * ( 2 + iRDN ) ); if ( v == NULL ) { LBER_VFREE( values ); - ldapava_free_dn( tmpDN ); + ldap_dnfree( tmpDN ); return( NULL ); } values = v; @@ -292,13 +291,13 @@ ldap_explode_rdn( LDAP_CONST char *rdn, int notypes ) } values[ iAVA ] = NULL; - ldapava_free_dn( tmpDN ); + ldap_dnfree( tmpDN ); return( values ); error_return:; LBER_VFREE( values ); - ldapava_free_dn( tmpDN ); + ldap_dnfree( tmpDN ); return( NULL ); #endif /* USE_LDAP_DN_PARSING */ } @@ -606,7 +605,7 @@ dn2dn( const char *dnin, unsigned fin, char **dnout, unsigned fout ) rc = ldap_dn2str( tmpDN, dnout, fout ); - ldapava_free_dn( tmpDN ); + ldap_dnfree( tmpDN ); return( rc ); } @@ -795,10 +794,13 @@ ldapava_new( const struct berval *attr, const struct berval *val, } void -ldapava_free( LDAPAVA *ava ) +ldap_avafree( LDAPAVA *ava ) { assert( ava ); + /* ava's private must be freed by caller */ + assert( ava->la_private != NULL ); + ber_bvfree( ava->la_attr ); ber_bvfree( ava->la_value ); @@ -859,7 +861,7 @@ ldapava_insert_into_rdn( LDAPRDN *rdn, LDAPAVA *ava, unsigned where ) } void -ldapava_free_rdn( LDAPRDN *rdn ) +ldap_rdnfree( LDAPRDN *rdn ) { int iAVA; @@ -870,7 +872,7 @@ ldapava_free_rdn( LDAPRDN *rdn ) for ( iAVA = 0; rdn[ iAVA ]; iAVA++ ) { assert( rdn[ iAVA ][ 0 ] ); - ldapava_free( rdn[ iAVA ][ 0 ] ); + ldap_avafree( rdn[ iAVA ][ 0 ] ); } LDAP_VFREE( rdn ); @@ -930,7 +932,7 @@ ldapava_insert_into_dn( LDAPDN *dn, LDAPRDN *rdn, unsigned where ) } void -ldapava_free_dn( LDAPDN *dn ) +ldap_dnfree( LDAPDN *dn ) { int iRDN; @@ -941,7 +943,7 @@ ldapava_free_dn( LDAPDN *dn ) for ( iRDN = 0; dn[ iRDN ]; iRDN++ ) { assert( dn[ iRDN ][ 0 ] ); - ldapava_free_rdn( dn[ iRDN ][ 0 ] ); + ldap_rdnfree( dn[ iRDN ][ 0 ] ); } LDAP_VFREE( dn ); @@ -1085,11 +1087,11 @@ ldap_str2dn( const char *str, LDAPDN **dn, unsigned flags ) parsing_error:; if ( newRDN ) { - ldapava_free_rdn( newRDN ); + ldap_rdnfree( newRDN ); } if ( newDN ) { - ldapava_free_dn( newDN ); + ldap_dnfree( newDN ); newDN = NULL; } @@ -1537,7 +1539,7 @@ parsing_error:; } if ( newRDN ) { - ldapava_free_rdn( newRDN ); + ldap_rdnfree( newRDN ); newRDN = NULL; } diff --git a/servers/slapd/dn.c b/servers/slapd/dn.c index ab49adeb40..55ed2b520f 100644 --- a/servers/slapd/dn.c +++ b/servers/slapd/dn.c @@ -124,7 +124,7 @@ dnValidate( rc = LDAPDN_validate( dn ); } - ldapava_free_dn( dn ); + ldap_dnfree( dn ); if ( rc != LDAP_SUCCESS ) { return( LDAP_INVALID_SYNTAX ); @@ -328,7 +328,7 @@ dnNormalize( * Schema-aware rewrite */ if ( LDAPDN_rewrite( dn, 0 ) != LDAP_SUCCESS ) { - ldapava_free_dn( dn ); + ldap_dnfree( dn ); return LDAP_INVALID_SYNTAX; } @@ -337,7 +337,7 @@ dnNormalize( */ rc = ldap_dn2str( dn, &dn_out, LDAP_DN_FORMAT_LDAPV3 ); - ldapava_free_dn( dn ); + ldap_dnfree( dn ); if ( rc != LDAP_SUCCESS ) { return LDAP_INVALID_SYNTAX; @@ -387,7 +387,7 @@ dnPretty( * Schema-aware rewrite */ if ( LDAPDN_rewrite( dn, SLAP_LDAPDN_PRETTY ) != LDAP_SUCCESS ) { - ldapava_free_dn( dn ); + ldap_dnfree( dn ); return LDAP_INVALID_SYNTAX; } @@ -398,7 +398,7 @@ dnPretty( rc = ldap_dn2str( dn, &dn_out, LDAP_DN_FORMAT_LDAPV3 | LDAP_DN_PRETTY ); - ldapava_free_dn( dn ); + ldap_dnfree( dn ); if ( rc != LDAP_SUCCESS ) { return LDAP_INVALID_SYNTAX;