#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,
char **str,
unsigned flags ));
-LDAP_F( void )
-ldapava_free_dn LDAP_P(( LDAPDN *dn ));
-
LDAP_F( int )
ldap_str2rdn LDAP_P((
const char *str,
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,
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,
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;
}
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 */
}
rc = ldap_dn2str( tmpDN, dnout, fout );
- ldapava_free_dn( tmpDN );
+ ldap_dnfree( tmpDN );
return( rc );
}
}
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 );
}
void
-ldapava_free_rdn( LDAPRDN *rdn )
+ldap_rdnfree( LDAPRDN *rdn )
{
int iAVA;
for ( iAVA = 0; rdn[ iAVA ]; iAVA++ ) {
assert( rdn[ iAVA ][ 0 ] );
- ldapava_free( rdn[ iAVA ][ 0 ] );
+ ldap_avafree( rdn[ iAVA ][ 0 ] );
}
LDAP_VFREE( rdn );
}
void
-ldapava_free_dn( LDAPDN *dn )
+ldap_dnfree( LDAPDN *dn )
{
int iRDN;
for ( iRDN = 0; dn[ iRDN ]; iRDN++ ) {
assert( dn[ iRDN ][ 0 ] );
- ldapava_free_rdn( dn[ iRDN ][ 0 ] );
+ ldap_rdnfree( dn[ iRDN ][ 0 ] );
}
LDAP_VFREE( dn );
parsing_error:;
if ( newRDN ) {
- ldapava_free_rdn( newRDN );
+ ldap_rdnfree( newRDN );
}
if ( newDN ) {
- ldapava_free_dn( newDN );
+ ldap_dnfree( newDN );
newDN = NULL;
}
}
if ( newRDN ) {
- ldapava_free_rdn( newRDN );
+ ldap_rdnfree( newRDN );
newRDN = NULL;
}
rc = LDAPDN_validate( dn );
}
- ldapava_free_dn( dn );
+ ldap_dnfree( dn );
if ( rc != LDAP_SUCCESS ) {
return( LDAP_INVALID_SYNTAX );
* Schema-aware rewrite
*/
if ( LDAPDN_rewrite( dn, 0 ) != LDAP_SUCCESS ) {
- ldapava_free_dn( dn );
+ ldap_dnfree( dn );
return LDAP_INVALID_SYNTAX;
}
*/
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;
* Schema-aware rewrite
*/
if ( LDAPDN_rewrite( dn, SLAP_LDAPDN_PRETTY ) != LDAP_SUCCESS ) {
- ldapava_free_dn( dn );
+ ldap_dnfree( dn );
return LDAP_INVALID_SYNTAX;
}
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;