From 2ca4b0ebfcb4db7309362c342e06f73c253f875b Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 6 May 2002 23:56:35 +0000 Subject: [PATCH] ITS#1806, Cyrus 1 doesn't give back our callbacks pointer, must stash it ourselves. --- libraries/libldap/cyrus.c | 10 ++++++---- libraries/libldap/ldap-int.h | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/libraries/libldap/cyrus.c b/libraries/libldap/cyrus.c index 079ffef4ee..c35eb0d5a9 100644 --- a/libraries/libldap/cyrus.c +++ b/libraries/libldap/cyrus.c @@ -308,10 +308,11 @@ sb_sasl_write( Sockbuf_IO_Desc *sbiod, void *buf, ber_len_t len) /* now encode the next packet. */ #if SASL_VERSION_MAJOR >= 2 ber_pvt_sb_buf_init( &p->buf_out ); + sasl_getprop( p->sasl_context, SASL_MAXOUTBUF, (const void **)&max ); #else ber_pvt_sb_buf_destroy( &p->buf_out ); + sasl_getprop( p->sasl_context, SASL_MAXOUTBUF, (void **)&max ); #endif - sasl_getprop( p->sasl_context, SASL_MAXOUTBUF, (const void **)&max ); if ( len > *max - 100 ) len = *max - 100; /* For safety margin */ ret = sasl_encode( p->sasl_context, buf, len, @@ -462,6 +463,7 @@ ldap_int_sasl_open( #endif if ( rc != SASL_OK ) { + LDAP_FREE( session_callbacks ); ld->ld_errno = sasl_err2ldap( rc ); return ld->ld_errno; } @@ -475,6 +477,7 @@ ldap_int_sasl_open( #endif lc->lconn_sasl_ctx = ctx; + lc->lconn_sasl_cbs = session_callbacks; if( ssf ) { #if SASL_VERSION_MAJOR >= 2 @@ -505,11 +508,10 @@ int ldap_int_sasl_close( LDAP *ld, LDAPConn *lc ) sasl_conn_t *ctx = lc->lconn_sasl_ctx; if( ctx != NULL ) { - const void *callbacks; - sasl_getprop( ctx, SASL_CALLBACK, &callbacks ); sasl_dispose( &ctx ); lc->lconn_sasl_ctx = NULL; - LDAP_FREE( (void *)callbacks ); + LDAP_FREE( lc->lconn_sasl_cbs ); + lc->lconn_sasl_cbs = NULL; } return LDAP_SUCCESS; diff --git a/libraries/libldap/ldap-int.h b/libraries/libldap/ldap-int.h index 4ad20dd9f4..cd10cde790 100644 --- a/libraries/libldap/ldap-int.h +++ b/libraries/libldap/ldap-int.h @@ -189,6 +189,7 @@ typedef struct ldap_conn { #endif #ifdef HAVE_CYRUS_SASL void *lconn_sasl_ctx; + void *lconn_sasl_cbs; #endif int lconn_refcnt; time_t lconn_lastused; /* time */ -- 2.39.5