From 1ded030427dddf858b354a47794f4083c8c268bb Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Tue, 29 Jun 2004 17:48:19 +0000 Subject: [PATCH] fix last commit --- libraries/libldap/cyrus.c | 9 +++++++-- libraries/libldap/groupings.c | 3 +-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/libraries/libldap/cyrus.c b/libraries/libldap/cyrus.c index d3d1b87839..2c55ce0d21 100644 --- a/libraries/libldap/cyrus.c +++ b/libraries/libldap/cyrus.c @@ -362,13 +362,18 @@ sb_sasl_write( Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len) #else ber_pvt_sb_buf_destroy( &p->buf_out ); #endif - if ( len > *p->sasl_maxbuf - 100 ) - unsigned tmpsize = p->buf_out.buf_size; + if ( len > *p->sasl_maxbuf - 100 ) { len = *p->sasl_maxbuf - 100; /* For safety margin */ + } + + { + unsigned tmpsize = p->buf_out.buf_size; ret = sasl_encode( p->sasl_context, buf, len, (SASL_CONST char **)&p->buf_out.buf_base, &tmpsize ); p->buf_out.buf_size = tmpsize; + } + if ( ret != SASL_OK ) { ber_log_printf( LDAP_DEBUG_ANY, sbiod->sbiod_sb->sb_debug, "sb_sasl_write: failed to encode packet: %s\n", diff --git a/libraries/libldap/groupings.c b/libraries/libldap/groupings.c index 001b30c6b4..cada361ccb 100644 --- a/libraries/libldap/groupings.c +++ b/libraries/libldap/groupings.c @@ -38,7 +38,7 @@ int ldap_grouping_create( { int rc; BerElement *ber = NULL; - struct berval bv = {0, NULL}; + struct berval bv = BER_BVNULL; #ifdef NEW_LOGGING LDAP_LOG ( OPERATION, ENTRY, "ldap_grouping_create\n", 0,0,0 ); @@ -65,7 +65,6 @@ int ldap_grouping_create( } rc = ber_flatten2( ber, &bv, 0 ); - if( rc < 0 ) { ld->ld_errno = LDAP_ENCODING_ERROR; return( ld->ld_errno ); -- 2.39.5