From: Kurt Zeilenga Date: Tue, 14 Mar 2000 02:59:53 +0000 (+0000) Subject: correct callback numbering X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~3151 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5701fec1b52ccfa678e7940b7d5ae975e6936d46;p=openldap correct callback numbering --- diff --git a/libraries/libldap/sasl.c b/libraries/libldap/sasl.c index c0d649b913..00079c52b8 100644 --- a/libraries/libldap/sasl.c +++ b/libraries/libldap/sasl.c @@ -825,21 +825,27 @@ ldap_negotiated_sasl_bind_s( LDAPControl **serverControls, LDAPControl **clientControls) { + int n; sasl_callback_t callbacks[4]; int rc; - callbacks[0].id = SASL_CB_USER; - callbacks[0].proc = ldap_pvt_sasl_getsimple; - callbacks[1].context = (void *)authenticationId; - callbacks[1].id = SASL_CB_AUTHNAME; - callbacks[1].proc = ldap_pvt_sasl_getsimple; - callbacks[0].context = (void *)authorizationId; - callbacks[2].id = SASL_CB_PASS; - callbacks[2].proc = ldap_pvt_sasl_getsecret; - callbacks[2].context = (void *)passPhrase; - callbacks[3].id = SASL_CB_LIST_END; - callbacks[3].proc = NULL; - callbacks[3].context = NULL; + callbacks[n=0].id = SASL_CB_USER; + callbacks[n].proc = ldap_pvt_sasl_getsimple; + callbacks[n].context = (void *)authenticationId; + + if( authorizationId != NULL ) { + callbacks[++n].id = SASL_CB_AUTHNAME; + callbacks[n].proc = ldap_pvt_sasl_getsimple; + callbacks[n].context = (void *)authorizationId; + } + + callbacks[++n].id = SASL_CB_PASS; + callbacks[n].proc = ldap_pvt_sasl_getsecret; + callbacks[n].context = (void *)passPhrase; + + callbacks[++n].id = SASL_CB_LIST_END; + callbacks[n].proc = NULL; + callbacks[n].context = NULL; rc = ldap_pvt_sasl_bind(ld, dn, saslMechanism, callbacks, serverControls, clientControls);