2 * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
3 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
6 * Copyright (c) 1990 Regents of the University of Michigan.
18 #include <ac/socket.h>
19 #include <ac/string.h>
25 ldap_get_values( LDAP *ld, LDAPMessage *entry, LDAP_CONST char *target )
32 Debug( LDAP_DEBUG_TRACE, "ldap_get_values\n", 0, 0, 0 );
36 /* skip sequence, dn, sequence of, and snag the first attr */
37 if ( ber_scanf( &ber, "{x{{a", &attr ) == LBER_ERROR ) {
38 ld->ld_errno = LDAP_DECODING_ERROR;
42 if ( strcasecmp( target, attr ) == 0 )
45 /* break out on success, return out on error */
50 if ( ber_scanf( &ber, "x}{a", &attr ) == LBER_ERROR ) {
51 ld->ld_errno = LDAP_DECODING_ERROR;
55 if ( strcasecmp( target, attr ) == 0 )
64 * if we get this far, we've found the attribute and are sitting
65 * just before the set of values.
68 if ( ber_scanf( &ber, "[v]", &vals ) == LBER_ERROR ) {
69 ld->ld_errno = LDAP_DECODING_ERROR;
77 ldap_get_values_len( LDAP *ld, LDAPMessage *entry, LDAP_CONST char *target )
84 Debug( LDAP_DEBUG_TRACE, "ldap_get_values_len\n", 0, 0, 0 );
88 /* skip sequence, dn, sequence of, and snag the first attr */
89 if ( ber_scanf( &ber, "{x{{a", &attr ) == LBER_ERROR ) {
90 ld->ld_errno = LDAP_DECODING_ERROR;
94 if ( strcasecmp( target, attr ) == 0 )
97 /* break out on success, return out on error */
102 if ( ber_scanf( &ber, "x}{a", &attr ) == LBER_ERROR ) {
103 ld->ld_errno = LDAP_DECODING_ERROR;
107 if ( strcasecmp( target, attr ) == 0 )
115 * if we get this far, we've found the attribute and are sitting
116 * just before the set of values.
119 if ( ber_scanf( &ber, "[V]", &vals ) == LBER_ERROR ) {
120 ld->ld_errno = LDAP_DECODING_ERROR;
128 ldap_count_values( char **vals )
135 for ( i = 0; vals[i] != NULL; i++ )
142 ldap_count_values_len( struct berval **vals )
144 return( ldap_count_values( (char **) vals ) );
148 ldap_value_free( char **vals )
154 for ( i = 0; vals[i] != NULL; i++ )
156 free( (char *) vals );
160 ldap_value_free_len( struct berval **vals )
166 for ( i = 0; vals[i] != NULL; i++ ) {
167 free( vals[i]->bv_val );
170 free( (char *) vals );