#define LBER_SB_OPT_DRAIN 10
#define LBER_SB_OPT_NEEDS_READ 11
#define LBER_SB_OPT_NEEDS_WRITE 12
+#define LBER_SB_OPT_GET_MAX_INCOMING 13
+#define LBER_SB_OPT_SET_MAX_INCOMING 14
/* Largest option used by the library */
-#define LBER_SB_OPT_OPT_MAX 12
+#define LBER_SB_OPT_OPT_MAX 14
/* LBER IO operations stacking levels */
#define LBER_SBIOD_LEVEL_PROVIDER 10
/* sasl methods */
#define LDAP_SASL_SIMPLE ((char*)0)
+#define LDAP_SASL_NULL ("")
/* authentication methods available */
fill_buffer:
/* now fill the buffer. */
- if (ber->ber_len==0) {
+
+ /* make sure length is reasonable */
+ if ( ber->ber_len == 0 ||
+ ( sb->sb_max_incoming && ber->ber_len > sb->sb_max_incoming ))
+ {
errno = ERANGE;
return LBER_DEFAULT;
}
+
if (ber->ber_buf==NULL) {
ber->ber_buf = (char *) LBER_MALLOC( ber->ber_len );
if (ber->ber_buf==NULL) {
ber_socket_t sb_fd;
unsigned int sb_trans_needs_read:1;
unsigned int sb_trans_needs_write:1;
+ ber_len_t sb_max_incoming;
};
#define SOCKBUF_VALID( sb ) ( (sb)->sb_valid == LBER_VALID_SOCKBUF )
int ret = 0;
assert( sb != NULL );
+ assert( SOCKBUF_VALID( sb ) );
switch ( opt ) {
case LBER_SB_OPT_HAS_IO:
ret = ( sb->sb_trans_needs_write ? 1 : 0 );
break;
+ case LBER_SB_OPT_GET_MAX_INCOMING:
+ if ( arg != NULL ) {
+ *((ber_len_t *)arg) = sb->sb_max_incoming;
+ }
+ ret = 1;
+ break;
+
+ case LBER_SB_OPT_SET_MAX_INCOMING:
+ sb->sb_max_incoming = *((ber_len_t *)arg);
+ ret = 1;
+ break;
+
default:
ret = sb->sb_iod->sbiod_io->sbi_ctrl( sb->sb_iod,
opt, arg );