]> git.sur5r.net Git - openldap/commitdiff
Round 2
authorKurt Zeilenga <kurt@openldap.org>
Fri, 21 Feb 2003 19:27:54 +0000 (19:27 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 21 Feb 2003 19:27:54 +0000 (19:27 +0000)
libraries/libldap/cyrus.c
libraries/liblutil/sasl.c

index 15540ef322f3c0f051e6560c54e5cf854f0f07cc..368755d08f4090766f92de1131b4a066c54aa608 100644 (file)
@@ -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;
 }
 
index c3e8154f1e9616b1d86bfed039974722c6978b2e..c920eec66e30d8c5fb271407d87917c0fd0ecec2 100644 (file)
@@ -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 );