From 4daeff0ef452c9abe8ed552413642c948afbb9bc Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Fri, 21 Feb 2003 19:39:09 +0000 Subject: [PATCH] Add a few comments to the ITS#2325 fix --- libraries/libldap/cyrus.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libraries/libldap/cyrus.c b/libraries/libldap/cyrus.c index 368755d08f..b984f13305 100644 --- a/libraries/libldap/cyrus.c +++ b/libraries/libldap/cyrus.c @@ -590,6 +590,7 @@ ldap_int_sasl_bind( &credlen, &mech ); + /* Cyrus SASL library doesn't initialize the prompt result pointer */ if( promptresult == NULL && prompts != NULL ) prompts->result = NULL; if( pmech == NULL && mech != NULL ) { @@ -606,7 +607,12 @@ ldap_int_sasl_bind( int res; if( !interact ) break; res = (interact)( ld, flags, defaults, prompts ); + + /* keep a pointer to the prompt result so we can free it + * after Cyrus SASL has consumed the prompts. + */ promptresult = prompts->result; + if( res != LDAP_SUCCESS ) break; } } while ( saslrc == SASL_INTERACT ); @@ -682,6 +688,7 @@ ldap_int_sasl_bind( (SASL_CONST char **)&ccred.bv_val, &credlen ); + /* SASL library doesn't initialize the prompt result pointer */ if( promptresult == NULL && prompts != NULL ) prompts->result = NULL; #ifdef NEW_LOGGING @@ -696,7 +703,12 @@ ldap_int_sasl_bind( int res; if( !interact ) break; res = (interact)( ld, flags, defaults, prompts ); + + /* keep a pointer to the prompt result so we can free it + * after Cyrus SASL has consumed the prompts. + */ promptresult = prompts->result; + if( res != LDAP_SUCCESS ) break; } } while ( saslrc == SASL_INTERACT ); @@ -756,6 +768,7 @@ ldap_int_sasl_bind( } done: + /* free the last prompt result */ LDAP_FREE((void*)promptresult); return rc; } -- 2.39.5