]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-sql/bind.c
cleanup
[openldap] / servers / slapd / back-sql / bind.c
index b768d40dc7fe4ac494e6e68e814198a9924cfe25..ed73fea3e3d7150618605324f7f4bcb9542df263 100644 (file)
@@ -1,10 +1,21 @@
-/*
- *      Copyright 1999, Dmitry Kovalev <mit@openldap.org>, All rights reserved.
+/* $OpenLDAP$ */
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- *      Redistribution and use in source and binary forms are permitted only
- *      as authorized by the OpenLDAP Public License.  A copy of this
- *      license is available at http://www.OpenLDAP.org/license.html or
- *      in file LICENSE in the top-level directory of the distribution.
+ * Copyright 1999-2004 The OpenLDAP Foundation.
+ * Portions Copyright 1999 Dmitry Kovalev.
+ * 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>.
+ */
+/* ACKNOWLEDGEMENTS:
+ * This work was initially developed by Dmitry Kovalev for inclusion
+ * by OpenLDAP Software.
  */
 
 #include "portable.h"
@@ -29,6 +40,7 @@ backsql_bind( Operation *op, SlapReply *rs )
        Entry                   *e, user_entry;
        Attribute               *a;
        backsql_srch_info       bsi;
+       AttributeName           anlist[2];
        int                     rc;
  
        Debug( LDAP_DEBUG_TRACE, "==>backsql_bind()\n", 0, 0, 0 );
@@ -52,7 +64,7 @@ backsql_bind( Operation *op, SlapReply *rs )
        /*
         * method = LDAP_AUTH_SIMPLE
         */
-       rs->sr_err = backsql_get_db_conn( op->o_bd, op->o_conn, &dbh );
+       rs->sr_err = backsql_get_db_conn( op, &dbh );
        if (!dbh) {
                Debug( LDAP_DEBUG_TRACE, "backsql_bind(): "
                        "could not get connection handle - exiting\n",
@@ -74,8 +86,11 @@ backsql_bind( Operation *op, SlapReply *rs )
                return 1;
        }
 
-       backsql_init_search( &bsi, bi, &op->o_req_ndn, LDAP_SCOPE_BASE, 
-                       -1, -1, -1, NULL, dbh, op->o_bd, op->o_conn, op, NULL );
+       anlist[0].an_name = password->ad_cname;
+       anlist[0].an_desc = password;
+       anlist[1].an_name.bv_val = NULL;
+       backsql_init_search( &bsi, &op->o_req_ndn, LDAP_SCOPE_BASE, 
+                       -1, -1, -1, NULL, dbh, op, anlist );
        e = backsql_id2entry( &bsi, &user_entry, &user_id );
        if ( e == NULL ) {
                Debug( LDAP_DEBUG_TRACE, "backsql_bind(): "
@@ -98,7 +113,7 @@ backsql_bind( Operation *op, SlapReply *rs )
                return 1;
        }
 
-       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 );
                return 1;