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;
goto done;
}
- ctx = ld->ld_defconn->lconn_sasl_authctx;
mech = *rmech;
+ if ( rc == LDAP_SUCCESS && mech == NULL )
+ goto success;
+
do {
if( ! scred ) {
/* no data! */
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 ) {
goto done;
}
+success:
/* Conversation was completed successfully by now */
if( flags != LDAP_SASL_QUIET ) {
char *data;