]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-sql/bind.c
cleanup error messages
[openldap] / servers / slapd / back-sql / bind.c
index 10f871be40b086f86de1a20b0f28909679680287..82da5b9be208e52e3ff1a95ec401d32e4e247566 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"
 
 #include <stdio.h>
 #include <sys/types.h>
+
 #include "slap.h"
-#include "back-sql.h"
-#include "sql-wrap.h"
-#include "util.h"
-#include "entry-id.h"
+#include "proto-sql.h"
 
 int 
 backsql_bind( Operation *op, SlapReply *rs )
@@ -29,6 +38,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 );
@@ -74,8 +84,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 +111,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;