3 * Copyright 1998-1999 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 );
39 Debug( LDAP_DEBUG_TRACE, "ldap_get_values\n", 0, 0, 0 );
43 /* skip sequence, dn, sequence of, and snag the first attr */
44 if ( ber_scanf( &ber, "{x{{a" /*}}}*/, &attr ) == LBER_ERROR ) {
45 ld->ld_errno = LDAP_DECODING_ERROR;
49 if ( strcasecmp( target, attr ) == 0 )
52 /* break out on success, return out on error */
57 if ( ber_scanf( &ber, /*{*/ "x}{a" /*}*/, &attr ) == LBER_ERROR ) {
58 ld->ld_errno = LDAP_DECODING_ERROR;
62 if ( strcasecmp( target, attr ) == 0 )
71 * if we get this far, we've found the attribute and are sitting
72 * just before the set of values.
75 if ( ber_scanf( &ber, "[v]", &vals ) == LBER_ERROR ) {
76 ld->ld_errno = LDAP_DECODING_ERROR;
84 ldap_get_values_len( LDAP *ld, LDAPMessage *entry, LDAP_CONST char *target )
92 assert( LDAP_VALID( ld ) );
93 assert( entry != NULL );
94 assert( target != NULL );
96 Debug( LDAP_DEBUG_TRACE, "ldap_get_values_len\n", 0, 0, 0 );
100 /* skip sequence, dn, sequence of, and snag the first attr */
101 if ( ber_scanf( &ber, "{x{{a" /* }}} */, &attr ) == LBER_ERROR ) {
102 ld->ld_errno = LDAP_DECODING_ERROR;
106 if ( strcasecmp( target, attr ) == 0 )
109 /* break out on success, return out on error */
114 if ( ber_scanf( &ber, /*{*/ "x}{a" /*}*/, &attr ) == LBER_ERROR ) {
115 ld->ld_errno = LDAP_DECODING_ERROR;
119 if ( strcasecmp( target, attr ) == 0 )
127 * if we get this far, we've found the attribute and are sitting
128 * just before the set of values.
131 if ( ber_scanf( &ber, "[V]", &vals ) == LBER_ERROR ) {
132 ld->ld_errno = LDAP_DECODING_ERROR;
140 ldap_count_values( char **vals )
147 for ( i = 0; vals[i] != NULL; i++ )
154 ldap_count_values_len( struct berval **vals )
156 return( ldap_count_values( (char **) vals ) );
160 ldap_value_free( char **vals )
166 ldap_value_free_len( struct berval **vals )
168 ber_bvecfree( vals );