int inout )
{
char buf[132];
+ ber_len_t len;
assert( ber != NULL );
assert( BER_VALID( ber ) );
- sprintf( buf, "ber_dump: buf 0x%lx, ptr 0x%lx, end 0x%lx\n",
+ if ( inout == 1 ) {
+ len = ber_pvt_ber_remaining(ber);
+ } else {
+ len = ber_pvt_ber_write(ber);
+ }
+
+ sprintf( buf, "ber_dump: buf=0x%08lx ptr=0x%08lx end=0x%08lx len=%ld\n",
(long) ber->ber_buf,
(long) ber->ber_ptr,
- (long) ber->ber_end );
+ (long) ber->ber_end,
+ (long) len );
(*ber_pvt_log_print)( buf );
- if ( inout == 1 ) {
- sprintf( buf, " current len %ld, contents:\n",
- (long) (ber->ber_end - ber->ber_ptr) );
- ber_bprint( ber->ber_ptr, ber->ber_end - ber->ber_ptr );
-
- } else {
- sprintf( buf, " current len %ld, contents:\n",
- (long) (ber->ber_ptr - ber->ber_buf) );
-
- ber_bprint( ber->ber_buf, ber->ber_ptr - ber->ber_buf );
- }
+ ber_bprint( ber->ber_ptr, len );
}
int
};
#define BER_VALID(ber) ((ber)->ber_valid==LBER_VALID_BERELEMENT)
-#define ber_pvt_ber_bytes(ber) ((ber)->ber_ptr - (ber)->ber_buf)
#define ber_pvt_ber_remaining(ber) ((ber)->ber_end - (ber)->ber_ptr)
+#define ber_pvt_ber_total(ber) ((ber)->ber_end - (ber)->ber_buf)
+#define ber_pvt_ber_write(ber) ((ber)->ber_ptr - (ber)->ber_buf)
struct sockbuf {
struct lber_options sb_opts;
return LBER_OPT_SUCCESS;
case LBER_OPT_BER_REMAINING_BYTES:
- *((ber_len_t *) outvalue) = ber->ber_end - ber->ber_ptr;
+ *((ber_len_t *) outvalue) = ber_pvt_ber_remaining(ber);
return LBER_OPT_SUCCESS;
case LBER_OPT_BER_TOTAL_BYTES:
- *((ber_len_t *) outvalue) = ber->ber_end - ber->ber_buf;
+ *((ber_len_t *) outvalue) = ber_pvt_ber_total(ber);
return LBER_OPT_SUCCESS;
case LBER_OPT_BER_BYTES_TO_WRITE:
- *((ber_len_t *) outvalue) = ber->ber_ptr - ber->ber_buf;
+ *((ber_len_t *) outvalue) = ber_pvt_ber_write(ber);
return LBER_OPT_SUCCESS;
default:
}
*ctrls = NULL;
- len = ber_pvt_ber_remaining(ber);
+ len = ber_pvt_ber_remaining( ber );
if( len == 0) {
/* no controls */
return LDAP_SUCCESS;
}
-
if(( tag = ber_peek_tag( ber, &len )) != LDAP_TAG_CONTROLS ) {
if( tag == LBER_ERROR ) {
/* decoding error */
{
ber_tag_t rc;
char *attr;
-#if 0
- ber_len_t len;
-#endif
Debug( LDAP_DEBUG_TRACE, "ldap_next_attribute\n", 0, 0, 0 );
assert( ber != NULL );
#if 0
- rc = ber_get_option( ber, LBER_OPT_REMAINING_BYTES, &len );
- if( rc != LDAP_OPT_SUCCESS ) {
- ld->ld_errno = LDAP_LOCAL_ERROR;
+ if ( ber_pvt_ber_remaining( ber ) == 0 ) {
return NULL;
}
-
- /* we're done */
- if( len == 0 ) return NULL;
#endif
/* skip sequence, snarf attribute type, skip values */