]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-ldbm/key.c
use slab memory for proxyauthz
[openldap] / servers / slapd / back-ldbm / key.c
index c8dc26e6903e189a28a956f2a14dc97604403fad..32c2df8cfd33b6b6db4572f8e7afcf09770db331 100644 (file)
@@ -1,8 +1,17 @@
 /* index.c - routines for dealing with attribute indexes */
 /* $OpenLDAP$ */
-/*
- * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 1998-2006 The OpenLDAP Foundation.
+ * 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>.
  */
 
 #include "portable.h"
@@ -24,11 +33,12 @@ key_read(
        ID_BLOCK **idout
 )
 {
-       Datum           key;
+       Datum           key;
        ID_BLOCK                *idl;
 
        Debug( LDAP_DEBUG_TRACE, "=> key_read\n", 0, 0, 0 );
 
+
        ldbm_datum_init( key );
        key.dptr = k->bv_val;
        key.dsize = k->bv_len;
@@ -38,6 +48,7 @@ key_read(
        Debug( LDAP_DEBUG_TRACE, "<= index_read %ld candidates\n",
               idl ? ID_BLOCK_NIDS(idl) : 0, 0, 0 );
 
+
        *idout = idl;
        return LDAP_SUCCESS;
 }
@@ -53,15 +64,17 @@ key_change(
 )
 {
        int     rc;
-       Datum   key;
+       Datum   key;
 
        Debug( LDAP_DEBUG_TRACE, "=> key_change(%s,%lx)\n",
                op == SLAP_INDEX_ADD_OP ? "ADD":"DELETE", (long) id, 0 );
 
+
        ldbm_datum_init( key );
        key.dptr = k->bv_val;
        key.dsize = k->bv_len;
 
+       ldap_pvt_thread_mutex_lock( &db->dbc_write_mutex );
        if (op == SLAP_INDEX_ADD_OP) {
            /* Add values */
            rc = idl_insert_key( be, db, key, id );
@@ -70,10 +83,12 @@ key_change(
            /* Delete values */
            rc = idl_delete_key( be, db, key, id );
        }
+       ldap_pvt_thread_mutex_unlock( &db->dbc_write_mutex );
 
 
        Debug( LDAP_DEBUG_TRACE, "<= key_change %d\n", rc, 0, 0 );
 
+
        ldap_pvt_thread_yield();
 
        return rc;