]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-bdb/bind.c
Remove broken MSVC build from REL_ENG branch.
[openldap] / servers / slapd / back-bdb / bind.c
index 3e8fd537b5a4a201be7674387ac2c93d7751fff2..e3b68357183d4fbd7919bcdf77b0ab904c65030b 100644 (file)
@@ -1,8 +1,17 @@
 /* bind.c - bdb backend bind routine */
 /* $OpenLDAP$ */
-/*
- * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 2000-2003 The OpenLDAP Foundation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in the file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
  */
 
 #include "portable.h"
@@ -21,7 +30,7 @@ bdb_bind( Operation *op, SlapReply *rs )
        struct bdb_info *bdb = (struct bdb_info *) op->o_bd->be_private;
        Entry           *e;
        Attribute       *a;
-       Entry           *matched;
+       EntryInfo       *ei;
 #ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND
        char            krbname[MAX_K_NAME_SZ + 1];
        AttributeDescription *krbattr = slap_schema.si_ad_krbName;
@@ -59,7 +68,8 @@ bdb_bind( Operation *op, SlapReply *rs )
 
 dn2entry_retry:
        /* get entry with reader lock */
-       rs->sr_err = bdb_dn2entry_r( op->o_bd, NULL, &op->o_req_ndn, &e, &matched, 0, locker, &lock );
+       rs->sr_err = bdb_dn2entry( op, NULL, &op->o_req_ndn, &ei, 1,
+               locker, &lock );
 
        switch(rs->sr_err) {
        case DB_NOTFOUND:
@@ -78,17 +88,17 @@ dn2entry_retry:
                return rs->sr_err;
        }
 
-       if ( e == NULL ) {
-               if( matched != NULL ) {
-                       rs->sr_ref = is_entry_referral( matched )
-                               ? get_entry_referrals( op, matched )
+       e = ei->bei_e;
+       if ( rs->sr_err == DB_NOTFOUND ) {
+               if( e != NULL ) {
+                       rs->sr_ref = is_entry_referral( e )
+                               ? get_entry_referrals( op, e )
                                : NULL;
                        if (rs->sr_ref)
-                               rs->sr_matched = ch_strdup( matched->e_name.bv_val );
-
-                       bdb_cache_return_entry_r( bdb->bi_dbenv, &bdb->bi_cache, matched, &lock );
-                       matched = NULL;
+                               rs->sr_matched = ch_strdup( e->e_name.bv_val );
 
+                       bdb_cache_return_entry_r( bdb->bi_dbenv, &bdb->bi_cache, e, &lock );
+                       e = NULL;
                } else {
                        rs->sr_ref = referral_rewrite( default_referral,
                                NULL, &op->o_req_dn, LDAP_SCOPE_DEFAULT );
@@ -126,7 +136,7 @@ dn2entry_retry:
 #endif
 
                rs->sr_err = LDAP_INVALID_CREDENTIALS;
-               send_ldap_result( op );
+               send_ldap_result( op, rs );
 
                goto done;
        }
@@ -142,7 +152,7 @@ dn2entry_retry:
                        0, 0 );
 #endif
 
-               send_ldap_error( op, LDAP_ALIAS_PROBLEM, "entry is alias");
+               send_ldap_error( op, rs, LDAP_ALIAS_PROBLEM, "entry is alias");
 
                goto done;
        }
@@ -191,7 +201,7 @@ dn2entry_retry:
                        goto done;
                }
 
-               if ( slap_passwd_check( op->o_conn, a, &op->oq_bind.rb_cred ) != 0 ) {
+               if ( slap_passwd_check( op->o_conn, a, &op->oq_bind.rb_cred, &rs->sr_text ) != 0 ) {
                        rs->sr_err = LDAP_INVALID_CREDENTIALS;
                        send_ldap_result( op, rs );
                        goto done;