From: Howard Chu Date: Fri, 3 May 2002 13:04:55 +0000 (+0000) Subject: Break up large SASL writes into units of SASL maxoutbuf size. X-Git-Tag: OPENLDAP_REL_ENG_2_MP~108 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ed871b997c63b6a4bfaf50929d84a8db7dd98408;p=openldap Break up large SASL writes into units of SASL maxoutbuf size. --- diff --git a/libraries/libldap/cyrus.c b/libraries/libldap/cyrus.c index 89492c6fff..a65771cada 100644 --- a/libraries/libldap/cyrus.c +++ b/libraries/libldap/cyrus.c @@ -291,6 +291,7 @@ sb_sasl_write( Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len) { struct sb_sasl_data *p; int ret; + unsigned *max; assert( sbiod != NULL ); assert( SOCKBUF_VALID( sbiod->sbiod_sb ) ); @@ -310,6 +311,9 @@ sb_sasl_write( Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len) #else ber_pvt_sb_buf_destroy( &p->buf_out ); #endif + sasl_getprop( p->sasl_context, SASL_MAXOUTBUF, (const void **)&max ); + if ( len > *max ) + len = *max - 100; /* For safety margin */ ret = sasl_encode( p->sasl_context, buf, len, (SASL_CONST char **)&p->buf_out.buf_base, (unsigned *)&p->buf_out.buf_size );