Skip to content
Snippets Groups Projects
Commit 1890b720 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

cleanup getattr bailout code

parent fcc86b24
Branches
Tags
No related merge requests found
......@@ -60,13 +60,7 @@ ldap_first_attribute( LDAP *ld, LDAPMessage *entry, BerElement **berout )
return NULL;
}
#if LDAP_SEQORSET_BAILOUT
if( len == 0 ) {
return NULL;
}
#endif
#if LBER_SEQORSET_AVOID_OVERRUN
#ifdef LBER_SEQORSET_AVOID_OVERRUN
/* set the length to avoid overrun */
rc = ber_set_option( ber, LBER_OPT_REMAINING_BYTES, &len );
if( rc != LBER_OPT_SUCCESS ) {
......@@ -74,6 +68,14 @@ ldap_first_attribute( LDAP *ld, LDAPMessage *entry, BerElement **berout )
ber_free( ber, 0 );
return NULL;
}
#ifdef LDAP_SEQORSET_BAILOUT
if ( ber_pvt_ber_remaining( ber ) == 0 ) {
assert( len == 0 );
return NULL;
}
assert( len != 0 );
#endif
#endif
/* snatch the first attribute */
......@@ -102,10 +104,12 @@ ldap_next_attribute( LDAP *ld, LDAPMessage *entry, BerElement *ber )
assert( entry != NULL );
assert( ber != NULL );
#if LDAP_SEQORSET_BAILOUT
#ifdef LBER_SEQORSET_AVOID_OVERRUN
#ifdef LDAP_SEQORSET_BAILOUT
if ( ber_pvt_ber_remaining( ber ) == 0 ) {
return NULL;
}
#endif
#endif
/* skip sequence, snarf attribute type, skip values */
......
......@@ -953,9 +953,9 @@ ldap_append_referral( LDAP *ld, char **referralsp, char *s )
static BerElement *
re_encode_request( LDAP *ld, BerElement *origber, ber_int_t msgid, char **dnp, int *type )
{
/*
* XXX this routine knows way too much about how the lber library works!
*/
/*
* XXX this routine knows way too much about how the lber library works!
*/
ber_int_t along;
ber_tag_t tag;
ber_int_t ver;
......@@ -1050,7 +1050,7 @@ re_encode_request( LDAP *ld, BerElement *origber, ber_int_t msgid, char **dnp, i
LDAPRequest *
ldap_find_request_by_msgid( LDAP *ld, ber_int_t msgid )
{
LDAPRequest *lr;
LDAPRequest *lr;
for ( lr = ld->ld_requests; lr != NULL; lr = lr->lr_next ) {
if( lr->lr_status == LDAP_REQST_COMPLETED ) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment