X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=servers%2Fslapd%2Fback-sql%2Fbind.c;h=0359b94fe44bbf8f5bb67480fc4c8a9eb24d5d6d;hb=9df3bd087a2dc53bcd4c887c648dd5e01a9808e3;hp=5817d06af60eaaa9b1fc0dea4fd214ef3385a267;hpb=eb0421c471342edfe4900fbd9d5b9fd9a7c650d8;p=openldap diff --git a/servers/slapd/back-sql/bind.c b/servers/slapd/back-sql/bind.c index 5817d06af6..0359b94fe4 100644 --- a/servers/slapd/back-sql/bind.c +++ b/servers/slapd/back-sql/bind.c @@ -1,7 +1,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 1999-2005 The OpenLDAP Foundation. + * Copyright 1999-2013 The OpenLDAP Foundation. * Portions Copyright 1999 Dmitry Kovalev. * Portions Copyright 2002 Pierangelo Masarati. * All rights reserved. @@ -40,27 +40,20 @@ backsql_bind( Operation *op, SlapReply *rs ) Debug( LDAP_DEBUG_TRACE, "==>backsql_bind()\n", 0, 0, 0 ); - if ( be_isroot_pw( op ) ) { - ber_dupbv( &op->oq_bind.rb_edn, be_root_dn( op->o_bd ) ); - Debug( LDAP_DEBUG_TRACE, "<==backsql_bind() root bind\n", - 0, 0, 0 ); - return LDAP_SUCCESS; - } - - ber_dupbv( &op->oq_bind.rb_edn, &op->o_req_ndn ); + switch ( be_rootdn_bind( op, rs ) ) { + case SLAP_CB_CONTINUE: + break; - if ( op->oq_bind.rb_method != LDAP_AUTH_SIMPLE ) { - rs->sr_err = LDAP_STRONG_AUTH_NOT_SUPPORTED; - rs->sr_text = "authentication method not supported"; - send_ldap_result( op, rs ); + default: + /* in case of success, front end will send result; + * otherwise, be_rootdn_bind() did */ + Debug( LDAP_DEBUG_TRACE, "<==backsql_bind(%d)\n", + rs->sr_err, 0, 0 ); return rs->sr_err; } - /* - * method = LDAP_AUTH_SIMPLE - */ rs->sr_err = backsql_get_db_conn( op, &dbh ); - if ( !dbh ) { + if ( rs->sr_err != LDAP_SUCCESS ) { Debug( LDAP_DEBUG_TRACE, "backsql_bind(): " "could not get connection handle - exiting\n", 0, 0, 0 ); @@ -76,7 +69,6 @@ backsql_bind( Operation *op, SlapReply *rs ) bsi.bsi_e = &e; rc = backsql_init_search( &bsi, &op->o_req_ndn, LDAP_SCOPE_BASE, - SLAP_NO_LIMIT, SLAP_NO_LIMIT, (time_t)(-1), NULL, dbh, op, rs, anlist, BACKSQL_ISF_GET_ENTRY ); if ( rc != LDAP_SUCCESS ) { @@ -102,11 +94,11 @@ backsql_bind( Operation *op, SlapReply *rs ) error_return:; if ( !BER_BVISNULL( &bsi.bsi_base_id.eid_ndn ) ) { - (void)backsql_free_entryID( op, &bsi.bsi_base_id, 0 ); + (void)backsql_free_entryID( &bsi.bsi_base_id, 0, op->o_tmpmemctx ); } if ( !BER_BVISNULL( &e.e_nname ) ) { - entry_clean( &e ); + backsql_entry_clean( op, &e ); } if ( bsi.bsi_attrs != NULL ) {