From c3a43e2c4f4eb9f6b95ed01346b0a4277d4e2884 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Fri, 21 Feb 2003 19:27:54 +0000 Subject: [PATCH] Round 2 --- libraries/libldap/cyrus.c | 13 ++++++++----- libraries/liblutil/sasl.c | 8 +++----- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/libraries/libldap/cyrus.c b/libraries/libldap/cyrus.c index 15540ef322..368755d08f 100644 --- a/libraries/libldap/cyrus.c +++ b/libraries/libldap/cyrus.c @@ -529,6 +529,7 @@ ldap_int_sasl_bind( sasl_ssf_t *ssf = NULL; sasl_conn_t *ctx; sasl_interact_t *prompts = NULL; + const void *promptresult = NULL; unsigned credlen; struct berval ccred; ber_socket_t sd; @@ -589,6 +590,8 @@ ldap_int_sasl_bind( &credlen, &mech ); + if( promptresult == NULL && prompts != NULL ) prompts->result = NULL; + if( pmech == NULL && mech != NULL ) { pmech = mech; @@ -603,6 +606,7 @@ ldap_int_sasl_bind( int res; if( !interact ) break; res = (interact)( ld, flags, defaults, prompts ); + promptresult = prompts->result; if( res != LDAP_SUCCESS ) break; } } while ( saslrc == SASL_INTERACT ); @@ -678,6 +682,8 @@ ldap_int_sasl_bind( (SASL_CONST char **)&ccred.bv_val, &credlen ); + if( promptresult == NULL && prompts != NULL ) prompts->result = NULL; + #ifdef NEW_LOGGING LDAP_LOG ( TRANSPORT, DETAIL1, "ldap_int_sasl_bind: sasl_client_step: %d\n", saslrc,0,0 ); @@ -690,6 +696,7 @@ ldap_int_sasl_bind( int res; if( !interact ) break; res = (interact)( ld, flags, defaults, prompts ); + promptresult = prompts->result; if( res != LDAP_SUCCESS ) break; } } while ( saslrc == SASL_INTERACT ); @@ -749,11 +756,7 @@ ldap_int_sasl_bind( } done: - if( interact ) { - /* cleanup */ - (void) (interact)( NULL, 0, NULL, prompts ); - } - + LDAP_FREE((void*)promptresult); return rc; } diff --git a/libraries/liblutil/sasl.c b/libraries/liblutil/sasl.c index c3e8154f1e..c920eec66e 100644 --- a/libraries/liblutil/sasl.c +++ b/libraries/liblutil/sasl.c @@ -190,15 +190,13 @@ int lutil_sasl_interact( { sasl_interact_t *interact = in; - if( interact && interact->result ) { + if( interact->result ) { /* we have results from a previous interaction */ - free( interact->result ); + free( (void *)interact->result ); interact->result = NULL; } - if( ld == NULL ) { - return LDAP_SUCCESS; - } + if( ld == NULL ) return LDAP_PARAM_ERROR; if( flags == LDAP_SASL_INTERACTIVE ) { fputs( "SASL Interaction\n", stderr ); -- 2.39.5