]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-bdb/idl.c
ITS#3226: Clear attribute flags after schema_check failed
[openldap] / servers / slapd / back-bdb / idl.c
index e69d8a7eb6084e8c27425bceadbdfb7307f0f6b0..a7980a3f7abc67aec04a6d97e5f95a47b2c3c8e4 100644 (file)
@@ -1,8 +1,17 @@
 /* idl.c - ldap id list handling routines */
 /* $OpenLDAP$ */
-/*
- * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 2000-2004 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"
@@ -18,7 +27,6 @@
 
 #define IDL_CMP(x,y)   ( x < y ? -1 : ( x > y ? 1 : 0 ) )
 
-#ifdef SLAP_IDL_CACHE
 #define IDL_LRU_DELETE( bdb, e ) do {                                  \
        if ( e->idl_lru_prev != NULL ) {                                \
                e->idl_lru_prev->idl_lru_next = e->idl_lru_next;        \
@@ -50,11 +58,10 @@ bdb_idl_entry_cmp( const void *v_idl1, const void *v_idl2 )
        const bdb_idl_cache_entry_t *idl1 = v_idl1, *idl2 = v_idl2;
        int rc;
 
-       if ((rc = idl1->db - idl2->db )) return rc;
+       if ((rc = SLAP_PTRCMP( idl1->db, idl2->db ))) return rc;
        if ((rc = idl1->kstr.bv_len - idl2->kstr.bv_len )) return rc;
        return ( memcmp ( idl1->kstr.bv_val, idl2->kstr.bv_val , idl1->kstr.bv_len ) );
 }
-#endif
 
 #if IDL_DEBUG > 0
 static void idl_check( ID *ids )
@@ -295,8 +302,6 @@ bdb_show_key(
        }
 }
 
-#ifdef SLAP_IDL_CACHE
-
 /* Find a db/key pair in the IDL cache. If ids is non-NULL,
  * copy the cached IDL into it, otherwise just return the status.
  */
@@ -435,7 +440,6 @@ bdb_idl_cache_del(
        }
        ldap_pvt_thread_rdwr_wunlock( &bdb->bi_idl_tree_rwlock );
 }
-#endif
 
 int
 bdb_idl_fetch_key(
@@ -486,12 +490,10 @@ bdb_idl_fetch_key(
 
        assert( ids != NULL );
 
-#ifdef SLAP_IDL_CACHE
        if ( bdb->bi_idl_cache_size ) {
                rc = bdb_idl_cache_get( bdb, db, key, ids );
                if ( rc != LDAP_NO_SUCH_OBJECT ) return rc;
        }
-#endif
 
        DBTzero( &data );
 
@@ -567,9 +569,7 @@ bdb_idl_fetch_key(
        }
 
        if( rc == DB_NOTFOUND ) {
-#ifndef SLAP_IDL_CACHE
                return rc;
-#endif
 
        } else if( rc != 0 ) {
 #ifdef NEW_LOGGING
@@ -610,11 +610,9 @@ bdb_idl_fetch_key(
                return -1;
        }
 
-#ifdef SLAP_IDL_CACHE
        if ( bdb->bi_idl_cache_max_size ) {
                bdb_idl_cache_put( bdb, db, key, ids, rc );
        }
-#endif
 
        return rc;
 }
@@ -650,11 +648,9 @@ bdb_idl_insert_key(
 
        assert( id != NOID );
 
-#ifdef SLAP_IDL_CACHE
        if ( bdb->bi_idl_cache_size ) {
                bdb_idl_cache_del( bdb, db, key );
        }
-#endif
 
        DBTzero( &data );
        data.size = sizeof( ID );
@@ -847,11 +843,9 @@ bdb_idl_delete_key(
        }
        assert( id != NOID );
 
-#ifdef SLAP_IDL_CACHE
        if ( bdb->bi_idl_cache_max_size ) {
                bdb_idl_cache_del( bdb, db, key );
        }
-#endif
 
        DBTzero( &data );
        data.data = &tmp;