From 845bf30c5baa067abd019e80a9e9d29afed16d77 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 15 Oct 2010 13:53:12 +0000 Subject: [PATCH] Fix prev commit --- libraries/libldap/cyrus.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/libraries/libldap/cyrus.c b/libraries/libldap/cyrus.c index 4420bd03c1..015eec0b17 100644 --- a/libraries/libldap/cyrus.c +++ b/libraries/libldap/cyrus.c @@ -536,12 +536,14 @@ ldap_int_sasl_bind( if( res != LDAP_SUCCESS ) break; } } while ( saslrc == SASL_INTERACT ); + rc = LDAP_SASL_BIND_IN_PROGRESS; } else { /* continuing an in-progress Bind */ struct berval *scred = NULL; - scred = NULL; + ctx = ld->ld_defconn->lconn_sasl_authctx; + rc = ldap_parse_sasl_bind_result( ld, result, &scred, 0 ); if ( rc != LDAP_SUCCESS ) goto done; @@ -559,8 +561,10 @@ ldap_int_sasl_bind( goto done; } - ctx = ld->ld_defconn->lconn_sasl_authctx; mech = *rmech; + if ( rc == LDAP_SUCCESS && mech == NULL ) + goto success; + do { if( ! scred ) { /* no data! */ @@ -601,12 +605,12 @@ ldap_int_sasl_bind( goto done; } + if ( saslrc == SASL_OK ) + *rmech = NULL; + ccred.bv_len = credlen; - /* Always send a request on first Bind; only send subsequent if - * saslrc == SASL_CONTINUE - */ - if ( !result || saslrc == SASL_CONTINUE ) { + if ( rc == LDAP_SASL_BIND_IN_PROGRESS ) { rc = ldap_sasl_bind( ld, dn, mech, &ccred, sctrls, cctrls, msgid ); if ( ccred.bv_val != NULL ) { @@ -620,6 +624,7 @@ ldap_int_sasl_bind( goto done; } +success: /* Conversation was completed successfully by now */ if( flags != LDAP_SASL_QUIET ) { char *data; -- 2.39.5