3 * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
4 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
6 /* ava.c - routines for dealing with attribute value assertions */
12 #include <ac/string.h>
13 #include <ac/socket.h>
17 #ifdef SLAPD_SCHEMA_NOT_COMPAT
21 AttributeAssertion *ava,
25 ad_free( ava->aa_desc, 1 );
26 ber_bvfree( ava->aa_value );
28 ch_free( (char *) ava );
35 AttributeAssertion **ava,
41 struct berval type, value, *nvalue;
42 AttributeAssertion *aa;
44 rc = ber_scanf( ber, "{oo}", &type, &value );
46 if( rc == LBER_ERROR ) {
47 Debug( LDAP_DEBUG_ANY, " get_ava ber_scanf\n", 0, 0, 0 );
48 *text = "Error decoding attribute value assertion";
49 return SLAPD_DISCONNECT;
52 aa = ch_malloc( sizeof( AttributeAssertion ) );
56 rc = slap_bv2ad( &type, &aa->aa_desc, text );
58 if( rc != LDAP_SUCCESS ) {
59 ch_free( type.bv_val );
60 ch_free( value.bv_val );
65 rc = value_normalize( aa->aa_desc, usage, &value, &nvalue, text );
66 ch_free( value.bv_val );
68 if( rc != LDAP_SUCCESS ) {
69 ch_free( type.bv_val );
70 ad_free( aa->aa_desc, 1 );
75 aa->aa_value = nvalue;
89 ch_free( (char *) ava->ava_type );
90 ch_free( (char *) ava->ava_value.bv_val );
92 ch_free( (char *) ava );
103 if ( ber_scanf( ber, "{ao}", &ava->ava_type, &ava->ava_value )
105 Debug( LDAP_DEBUG_ANY, " get_ava ber_scanf\n", 0, 0, 0 );
106 *text = "Error decoding attribute value assertion";
107 return SLAPD_DISCONNECT;
110 attr_normalize( ava->ava_type );
111 value_normalize( ava->ava_value.bv_val, attr_syntax( ava->ava_type ) );