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_first_attribute( LDAP *ld, LDAPMessage *entry, BerElement **ber )
29 Debug( LDAP_DEBUG_TRACE, "ldap_first_attribute\n", 0, 0, 0 );
31 if ( (*ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
36 **ber = *entry->lm_ber;
39 * Skip past the sequence, dn, sequence of sequence, snarf the
40 * attribute type, and skip the set of values, leaving us
41 * positioned right before the next attribute type/value sequence.
44 len = LDAP_MAX_ATTR_LEN;
45 if ( ber_scanf( *ber, "{x{{sx}", ld->ld_attrbuffer, &len )
47 ld->ld_errno = LDAP_DECODING_ERROR;
53 return( ld->ld_attrbuffer );
58 ldap_next_attribute( LDAP *ld, LDAPMessage *entry, BerElement *ber )
62 Debug( LDAP_DEBUG_TRACE, "ldap_next_attribute\n", 0, 0, 0 );
64 /* skip sequence, snarf attribute type, skip values */
65 len = LDAP_MAX_ATTR_LEN;
66 if ( ber_scanf( ber, "{sx}", ld->ld_attrbuffer, &len )
68 ld->ld_errno = LDAP_DECODING_ERROR;
69 /* ber_free( ber, 0 ); *//* don't free the BerElement */
73 return( ld->ld_attrbuffer );