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 )
34 assert( LDAP_VALID( ld ) );
35 assert( entry != NULL );
36 assert( target != NULL );
38 Debug( LDAP_DEBUG_TRACE, "ldap_get_values\n", 0, 0, 0 );
42 /* skip sequence, dn, sequence of, and snag the first attr */
43 if ( ber_scanf( &ber, "{x{{a" /*}}}*/, &attr ) == LBER_ERROR ) {
44 ld->ld_errno = LDAP_DECODING_ERROR;
48 if ( strcasecmp( target, attr ) == 0 )
51 /* break out on success, return out on error */
56 if ( ber_scanf( &ber, /*{*/ "x}{a" /*}*/, &attr ) == LBER_ERROR ) {
57 ld->ld_errno = LDAP_DECODING_ERROR;
61 if ( strcasecmp( target, attr ) == 0 )
70 * if we get this far, we've found the attribute and are sitting
71 * just before the set of values.
74 if ( ber_scanf( &ber, "[v]", &vals ) == LBER_ERROR ) {
75 ld->ld_errno = LDAP_DECODING_ERROR;
83 ldap_get_values_len( LDAP *ld, LDAPMessage *entry, LDAP_CONST char *target )
91 assert( LDAP_VALID( ld ) );
92 assert( entry != NULL );
93 assert( target != NULL );
95 Debug( LDAP_DEBUG_TRACE, "ldap_get_values_len\n", 0, 0, 0 );
99 /* skip sequence, dn, sequence of, and snag the first attr */
100 if ( ber_scanf( &ber, "{x{{a" /* }}} */, &attr ) == LBER_ERROR ) {
101 ld->ld_errno = LDAP_DECODING_ERROR;
105 if ( strcasecmp( target, attr ) == 0 )
108 /* break out on success, return out on error */
113 if ( ber_scanf( &ber, /*{*/ "x}{a" /*}*/, &attr ) == LBER_ERROR ) {
114 ld->ld_errno = LDAP_DECODING_ERROR;
118 if ( strcasecmp( target, attr ) == 0 )
126 * if we get this far, we've found the attribute and are sitting
127 * just before the set of values.
130 if ( ber_scanf( &ber, "[V]", &vals ) == LBER_ERROR ) {
131 ld->ld_errno = LDAP_DECODING_ERROR;
139 ldap_count_values( char **vals )
146 for ( i = 0; vals[i] != NULL; i++ )
153 ldap_count_values_len( struct berval **vals )
155 return( ldap_count_values( (char **) vals ) );
159 ldap_value_free( char **vals )
165 ldap_value_free_len( struct berval **vals )
167 ber_bvecfree( vals );