]> git.sur5r.net Git - openldap/commitdiff
Add a few comments to the ITS#2325 fix
authorKurt Zeilenga <kurt@openldap.org>
Fri, 21 Feb 2003 19:39:09 +0000 (19:39 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 21 Feb 2003 19:39:09 +0000 (19:39 +0000)
libraries/libldap/cyrus.c

index 368755d08f4090766f92de1131b4a066c54aa608..b984f133055db6be50b0dd6ff377e0c3ce2b975a 100644 (file)
@@ -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;
 }