]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-sql/sql-wrap.c
now I remember why I introduced the 'has_ldapinfo_dn_ru' flag
[openldap] / servers / slapd / back-sql / sql-wrap.c
index 7e174bacf888c6bad5a3ad0e9e7a2bd98ecb98f4..414aeafc54e47ea95c1abfc6593afd196c8ed46a 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1999-2003 The OpenLDAP Foundation.
+ * Copyright 1999-2004 The OpenLDAP Foundation.
  * Portions Copyright 1999 Dmitry Kovalev.
  * All rights reserved.
  *
@@ -396,13 +396,18 @@ backsql_open_db_conn( backsql_info *si, int ldap_cid, backsql_db_conn **pdbc )
                Debug( LDAP_DEBUG_TRACE, "backsql_open_db_conn: "
                        "SQLGetInfo() failed:\n", 0, 0, 0 );
                backsql_PrintErrors( si->db_env, dbc->dbh, SQL_NULL_HENV, rc );
+               return rc;
        }
        /* end TimesTen */
 
        Debug( LDAP_DEBUG_TRACE, "backsql_open_db_conn(): "
                "connected, adding to tree\n", 0, 0, 0 );
        ldap_pvt_thread_mutex_lock( &si->dbconn_mutex );
-       avl_insert( &si->db_conns, dbc, backsql_cmp_connid, NULL );
+       if ( avl_insert( &si->db_conns, dbc, backsql_cmp_connid, avl_dup_error ) ) {
+               Debug( LDAP_DEBUG_TRACE, "backsql_open_db_conn: "
+                       "duplicate connection ID\n", 0, 0, 0 );
+               return LDAP_OTHER;
+       }
        ldap_pvt_thread_mutex_unlock( &si->dbconn_mutex );
        Debug( LDAP_DEBUG_TRACE, "<==backsql_open_db_conn()\n", 0, 0, 0 );