]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/bind.c
Fix previous commit
[openldap] / servers / slapd / bind.c
index cafc4d286ae290fdbd72fcf02934151c647187c4..11b9d0724792df2bf91c944ad5ef09ae0049da19 100644 (file)
@@ -92,7 +92,7 @@ do_bind(
         *      }
         */
 
-       tag = ber_scanf( ber, "{iot" /*}*/, &version, &dn, &method );
+       tag = ber_scanf( ber, "{imt" /*}*/, &version, &dn, &method );
 
        if ( tag == LBER_ERROR ) {
 #ifdef NEW_LOGGING
@@ -110,7 +110,7 @@ do_bind(
        op->o_protocol = version;
 
        if( method != LDAP_AUTH_SASL ) {
-               tag = ber_scanf( ber, /*{*/ "o}", &cred );
+               tag = ber_scanf( ber, /*{*/ "m}", &cred );
 
        } else {
                tag = ber_scanf( ber, "{a" /*}*/, &mech );
@@ -120,7 +120,7 @@ do_bind(
                        tag = ber_peek_tag( ber, &len );
 
                        if ( tag == LDAP_TAG_LDAPCRED ) { 
-                               tag = ber_scanf( ber, "o", &cred );
+                               tag = ber_scanf( ber, "m", &cred );
                        } else {
                                tag = LDAP_TAG_LDAPCRED;
                                cred.bv_val = NULL;
@@ -249,7 +249,7 @@ do_bind(
                        goto cleanup;
                }
 
-               if( mech == NULL || *mech == '\0' ) {
+               if( mech == NULL || mech[0] == '\0' ) {
 #ifdef NEW_LOGGING
                        LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
                                   "do_bind: conn %d  no SASL mechanism provided\n",
@@ -449,13 +449,13 @@ do_bind(
 
        if ( (be = select_backend( &ndn, 0, 0 )) == NULL ) {
                if ( default_referral ) {
-                       BVarray ref = referral_rewrite( default_referral,
+                       BerVarray ref = referral_rewrite( default_referral,
                                NULL, &pdn, LDAP_SCOPE_DEFAULT );
 
                        send_ldap_result( conn, op, rc = LDAP_REFERRAL,
                                NULL, NULL, ref ? ref : default_referral, NULL );
 
-                       bvarray_free( ref );
+                       ber_bvarray_free( ref );
 
                } else {
                        /* noSuchObject is not allowed to be returned by bind */
@@ -495,7 +495,7 @@ do_bind(
                        } else {
                                ber_dupbv( &conn->c_dn, &pdn );
                        }
-                       conn->c_cdn = pdn.bv_val;
+                       conn->c_cdn = pdn;
                        pdn.bv_val = NULL;
                        pdn.bv_len = 0;
 
@@ -512,11 +512,11 @@ do_bind(
 #ifdef NEW_LOGGING
                        LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
                                "do_bind: conn %d  v%d bind: \"%s\" to \"%s\" \n",
-                               conn->c_connid, version, conn->c_cdn, conn->c_dn.bv_val ));
+                               conn->c_connid, version, conn->c_cdn.bv_val, conn->c_dn.bv_val ));
 #else
                        Debug( LDAP_DEBUG_TRACE,
                                "do_bind: v%d bind: \"%s\" to \"%s\"\n",
-                               version, conn->c_cdn, conn->c_dn.bv_val );
+                               version, conn->c_cdn.bv_val, conn->c_dn.bv_val );
 #endif
 
                        ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
@@ -536,7 +536,6 @@ do_bind(
        }
 
 cleanup:
-       free( dn.bv_val );
        if( pdn.bv_val != NULL ) {
                free( pdn.bv_val );
        }
@@ -546,9 +545,6 @@ cleanup:
        if ( mech != NULL ) {
                free( mech );
        }
-       if ( cred.bv_val != NULL ) {
-               free( cred.bv_val );
-       }
 
        return rc;
 }