]> git.sur5r.net Git - openldap/commitdiff
ITS#1806, Cyrus 1 doesn't give back our callbacks pointer, must stash it
authorHoward Chu <hyc@openldap.org>
Mon, 6 May 2002 23:56:35 +0000 (23:56 +0000)
committerHoward Chu <hyc@openldap.org>
Mon, 6 May 2002 23:56:35 +0000 (23:56 +0000)
ourselves.

libraries/libldap/cyrus.c
libraries/libldap/ldap-int.h

index 079ffef4ee80454cb84dd16d3a5f7f40cf71e90d..c35eb0d5a996c2a90d84c205bc67f2973f1dc02b 100644 (file)
@@ -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;
index 4ad20dd9f4c813a6172fbc9e940e42b441803d9d..cd10cde790ab87aaf485cf9b3ddcde46f3469ca7 100644 (file)
@@ -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 */