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.
16 #include <ac/stdlib.h>
19 #include <ac/socket.h>
20 #include <ac/string.h>
26 ldap_get_values( LDAP *ld, LDAPMessage *entry, LDAP_CONST char *target )
33 Debug( LDAP_DEBUG_TRACE, "ldap_get_values\n", 0, 0, 0 );
37 /* skip sequence, dn, sequence of, and snag the first attr */
38 if ( ber_scanf( &ber, "{x{{a", &attr ) == LBER_ERROR ) {
39 ld->ld_errno = LDAP_DECODING_ERROR;
43 if ( strcasecmp( target, attr ) == 0 )
46 /* break out on success, return out on error */
51 if ( ber_scanf( &ber, "x}{a", &attr ) == LBER_ERROR ) {
52 ld->ld_errno = LDAP_DECODING_ERROR;
56 if ( strcasecmp( target, attr ) == 0 )
65 * if we get this far, we've found the attribute and are sitting
66 * just before the set of values.
69 if ( ber_scanf( &ber, "[v]", &vals ) == LBER_ERROR ) {
70 ld->ld_errno = LDAP_DECODING_ERROR;
78 ldap_get_values_len( LDAP *ld, LDAPMessage *entry, LDAP_CONST char *target )
85 Debug( LDAP_DEBUG_TRACE, "ldap_get_values_len\n", 0, 0, 0 );
89 /* skip sequence, dn, sequence of, and snag the first attr */
90 if ( ber_scanf( &ber, "{x{{a", &attr ) == LBER_ERROR ) {
91 ld->ld_errno = LDAP_DECODING_ERROR;
95 if ( strcasecmp( target, attr ) == 0 )
98 /* break out on success, return out on error */
103 if ( ber_scanf( &ber, "x}{a", &attr ) == LBER_ERROR ) {
104 ld->ld_errno = LDAP_DECODING_ERROR;
108 if ( strcasecmp( target, attr ) == 0 )
116 * if we get this far, we've found the attribute and are sitting
117 * just before the set of values.
120 if ( ber_scanf( &ber, "[V]", &vals ) == LBER_ERROR ) {
121 ld->ld_errno = LDAP_DECODING_ERROR;
129 ldap_count_values( char **vals )
136 for ( i = 0; vals[i] != NULL; i++ )
143 ldap_count_values_len( struct berval **vals )
145 return( ldap_count_values( (char **) vals ) );
149 ldap_value_free( char **vals )
155 ldap_value_free_len( struct berval **vals )
157 ber_bvecfree( vals );