]> git.sur5r.net Git - openldap/blob - servers/slapd/ava.c
Exit loop after matching command is found in openldap_ldap_init_w_conf
[openldap] / servers / slapd / ava.c
1 /* $OpenLDAP$ */
2 /*
3  * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
4  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
5  */
6 /* ava.c - routines for dealing with attribute value assertions */
7
8 #include "portable.h"
9
10 #include <stdio.h>
11
12 #include <ac/string.h>
13 #include <ac/socket.h>
14
15 #include "slap.h"
16
17 #ifdef SLAPD_SCHEMA_NOT_COMPAT
18
19 void
20 ava_free(
21     AttributeAssertion *ava,
22     int freeit
23 )
24 {
25         ad_free( ava->aa_desc, 1 );
26         ber_bvfree( ava->aa_value );
27         if ( freeit ) {
28                 ch_free( (char *) ava );
29         }
30 }
31
32 #else
33
34 void
35 ava_free(
36     Ava *ava,
37     int freeit
38 )
39 {
40         ch_free( (char *) ava->ava_type );
41         ch_free( (char *) ava->ava_value.bv_val );
42         if ( freeit ) {
43                 ch_free( (char *) ava );
44         }
45 }
46
47 int
48 get_ava(
49     BerElement  *ber,
50     Ava         *ava
51 )
52 {
53         if ( ber_scanf( ber, "{ao}", &ava->ava_type, &ava->ava_value )
54             == LBER_ERROR ) {
55                 Debug( LDAP_DEBUG_ANY, "  get_ava ber_scanf\n", 0, 0, 0 );
56                 return SLAPD_DISCONNECT;
57         }
58
59         attr_normalize( ava->ava_type );
60         value_normalize( ava->ava_value.bv_val, attr_syntax( ava->ava_type ) );
61
62         return LDAP_SUCCESS;
63 }
64
65 #endif