3 * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
4 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
7 * Copyright (c) 1990 Regents of the University of Michigan.
17 #include <ac/stdlib.h>
20 #include <ac/socket.h>
21 #include <ac/string.h>
27 ldap_get_values( LDAP *ld, LDAPMessage *entry, LDAP_CONST char *target )
35 assert( LDAP_VALID( ld ) );
36 assert( entry != NULL );
37 assert( target != NULL );
40 LDAP_LOG (( "getvalues", LDAP_LEVEL_ENTRY, "ldap_get_values\n" ));
42 Debug( LDAP_DEBUG_TRACE, "ldap_get_values\n", 0, 0, 0 );
47 /* skip sequence, dn, sequence of, and snag the first attr */
48 if ( ber_scanf( &ber, "{x{{a" /*}}}*/, &attr ) == LBER_ERROR ) {
49 ld->ld_errno = LDAP_DECODING_ERROR;
53 if ( strcasecmp( target, attr ) == 0 )
56 /* break out on success, return out on error */
61 if ( ber_scanf( &ber, /*{*/ "x}{a" /*}*/, &attr ) == LBER_ERROR ) {
62 ld->ld_errno = LDAP_DECODING_ERROR;
66 if ( strcasecmp( target, attr ) == 0 )
75 * if we get this far, we've found the attribute and are sitting
76 * just before the set of values.
79 if ( ber_scanf( &ber, "[v]", &vals ) == LBER_ERROR ) {
80 ld->ld_errno = LDAP_DECODING_ERROR;
88 ldap_get_values_len( LDAP *ld, LDAPMessage *entry, LDAP_CONST char *target )
96 assert( LDAP_VALID( ld ) );
97 assert( entry != NULL );
98 assert( target != NULL );
101 LDAP_LOG (( "getvalues", LDAP_LEVEL_ENTRY, "ldap_get_values_len\n" ));
103 Debug( LDAP_DEBUG_TRACE, "ldap_get_values_len\n", 0, 0, 0 );
106 ber = *entry->lm_ber;
108 /* skip sequence, dn, sequence of, and snag the first attr */
109 if ( ber_scanf( &ber, "{x{{a" /* }}} */, &attr ) == LBER_ERROR ) {
110 ld->ld_errno = LDAP_DECODING_ERROR;
114 if ( strcasecmp( target, attr ) == 0 )
117 /* break out on success, return out on error */
122 if ( ber_scanf( &ber, /*{*/ "x}{a" /*}*/, &attr ) == LBER_ERROR ) {
123 ld->ld_errno = LDAP_DECODING_ERROR;
127 if ( strcasecmp( target, attr ) == 0 )
135 * if we get this far, we've found the attribute and are sitting
136 * just before the set of values.
139 if ( ber_scanf( &ber, "[V]", &vals ) == LBER_ERROR ) {
140 ld->ld_errno = LDAP_DECODING_ERROR;
148 ldap_count_values( char **vals )
155 for ( i = 0; vals[i] != NULL; i++ )
162 ldap_count_values_len( struct berval **vals )
164 return( ldap_count_values( (char **) vals ) );
168 ldap_value_free( char **vals )
174 ldap_value_free_len( struct berval **vals )
176 ber_bvecfree( vals );