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 ) );
55 rc = slap_bv2ad( &type, &aa->aa_desc, text );
57 if( rc != LDAP_SUCCESS ) {
58 ch_free( type.bv_val );
59 ch_free( value.bv_val );
64 rc = value_normalize( aa->aa_desc, usage, &value, &nvalue, text );
65 ch_free( value.bv_val );
67 if( rc != LDAP_SUCCESS ) {
68 ch_free( type.bv_val );
69 ad_free( aa->aa_desc, 1 );
74 aa->aa_value = nvalue;
88 ch_free( (char *) ava->ava_type );
89 ch_free( (char *) ava->ava_value.bv_val );
91 ch_free( (char *) ava );
102 if ( ber_scanf( ber, "{ao}", &ava->ava_type, &ava->ava_value )
104 Debug( LDAP_DEBUG_ANY, " get_ava ber_scanf\n", 0, 0, 0 );
105 *text = "Error decoding attribute value assertion";
106 return SLAPD_DISCONNECT;
109 attr_normalize( ava->ava_type );
110 value_normalize( ava->ava_value.bv_val, attr_syntax( ava->ava_type ) );