X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fattr.c;h=ee0f46daabc5d87fc631f06bb2c5f13295a6d49c;hb=5c3a4e176e9539f58a1ac666ad370b4c204cd44c;hp=70600c4eb942fd4a362c160728fba4948ed5578c;hpb=761f2879435deec0dc8369de98381557de416b89;p=openldap diff --git a/servers/slapd/attr.c b/servers/slapd/attr.c index 70600c4eb9..ee0f46daab 100644 --- a/servers/slapd/attr.c +++ b/servers/slapd/attr.c @@ -2,7 +2,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 1998-2004 The OpenLDAP Foundation. + * Copyright 1998-2005 The OpenLDAP Foundation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,12 +43,30 @@ void attr_free( Attribute *a ) { - if ( a->a_nvals && a->a_nvals != a->a_vals ) + if ( a->a_nvals && a->a_nvals != a->a_vals ) { ber_bvarray_free( a->a_nvals ); + } ber_bvarray_free( a->a_vals ); free( a ); } +#ifdef LDAP_COMP_MATCH +void +comp_tree_free( Attribute *a ) +{ + Attribute *next; + + for( ; a != NULL ; a = next ) { + next = a->a_next; + if ( component_destructor && a->a_comp_data ) { + if ( a->a_comp_data->cd_mem_op ) + component_destructor( a->a_comp_data->cd_mem_op ); + free ( a->a_comp_data ); + } + } +} +#endif + void attrs_free( Attribute *a ) { @@ -108,6 +126,9 @@ attr_dup( Attribute *a ) tmp->a_desc = a->a_desc; tmp->a_next = NULL; tmp->a_flags = 0; +#ifdef LDAP_COMP_MATCH + tmp->a_comp_data = NULL; +#endif return tmp; } @@ -156,7 +177,7 @@ attr_merge( Attribute **a; for ( a = &e->e_attrs; *a != NULL; a = &(*a)->a_next ) { - if ( ad_cmp( (*a)->a_desc, desc ) == 0 ) { + if ( (*a)->a_desc == desc ) { break; } } @@ -168,6 +189,9 @@ attr_merge( (*a)->a_nvals = NULL; (*a)->a_next = NULL; (*a)->a_flags = 0; +#ifdef LDAP_COMP_MATCH + (*a)->a_comp_data = NULL; +#endif } rc = value_add( &(*a)->a_vals, vals ); @@ -237,7 +261,7 @@ attr_merge_one( Attribute **a; for ( a = &e->e_attrs; *a != NULL; a = &(*a)->a_next ) { - if ( ad_cmp( (*a)->a_desc, desc ) == 0 ) { + if ( (*a)->a_desc == desc ) { break; } } @@ -249,6 +273,9 @@ attr_merge_one( (*a)->a_nvals = NULL; (*a)->a_next = NULL; (*a)->a_flags = 0; +#ifdef LDAP_COMP_MATCH + (*a)->a_comp_data = NULL; +#endif } rc = value_add_one( &(*a)->a_vals, val ); @@ -326,7 +353,7 @@ attr_find( AttributeDescription *desc ) { for ( ; a != NULL; a = a->a_next ) { - if ( ad_cmp( a->a_desc, desc ) == 0 ) { + if ( a->a_desc == desc ) { return( a ); } } @@ -349,7 +376,7 @@ attr_delete( Attribute **a; for ( a = attrs; *a != NULL; a = &(*a)->a_next ) { - if ( ad_cmp( (*a)->a_desc, desc ) == 0 ) { + if ( (*a)->a_desc == desc ) { Attribute *save = *a; *a = (*a)->a_next; attr_free( save );