X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fback-sql%2Fbind.c;h=71b0f9509e122d286122806cd0b04047141cab1a;hb=d377f353b7053bbe17afa8d97e2eacf810ec3086;hp=f87ebdd972cc2d2b48ac938c5d9c4c754e742e2b;hpb=acbb5cf689a4336af05c9f259d909d8141055bac;p=openldap diff --git a/servers/slapd/back-sql/bind.c b/servers/slapd/back-sql/bind.c index f87ebdd972..71b0f9509e 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-2006 The OpenLDAP Foundation. + * Copyright 1999-2012 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 ); @@ -101,7 +94,7 @@ 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 ) ) {