/* 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"
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;
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:
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 );
#endif
rs->sr_err = LDAP_INVALID_CREDENTIALS;
- send_ldap_result( op );
+ send_ldap_result( op, rs );
goto done;
}
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;
}
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;