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 ) {
35 **ber = *entry->lm_ber;
38 * Skip past the sequence, dn, sequence of sequence, snarf the
39 * attribute type, and skip the set of values, leaving us
40 * positioned right before the next attribute type/value sequence.
43 len = LDAP_MAX_ATTR_LEN;
44 if ( ber_scanf( *ber, "{x{{sx}", ld->ld_attrbuffer, &len )
46 ld->ld_errno = LDAP_DECODING_ERROR;
51 return( ld->ld_attrbuffer );
56 ldap_next_attribute( LDAP *ld, LDAPMessage *entry, BerElement *ber )
60 Debug( LDAP_DEBUG_TRACE, "ldap_next_attribute\n", 0, 0, 0 );
62 /* skip sequence, snarf attribute type, skip values */
63 len = LDAP_MAX_ATTR_LEN;
64 if ( ber_scanf( ber, "{sx}", ld->ld_attrbuffer, &len )
66 ld->ld_errno = LDAP_DECODING_ERROR;
71 return( ld->ld_attrbuffer );