]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-ldbm/id2entry.c
add referral check to functions elaborated by overlays
[openldap] / servers / slapd / back-ldbm / id2entry.c
index 39507284a2382578ec11814ed13bc22b4cfd7cdf..0c3ae59f50af76c06129333da6adcd2f5e3c2a5b 100644 (file)
@@ -1,8 +1,17 @@
 /* id2entry.c - routines to deal with the id2entry index */
 /* $OpenLDAP$ */
-/*
- * Copyright 1998-2002 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-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"
@@ -33,8 +42,7 @@ id2entry_add( Backend *be, Entry *e )
        ldbm_datum_init( data );
 
 #ifdef NEW_LOGGING
-       LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
-                  "id2entry_add: (%s)%ld\n", e->e_dn, e->e_id ));
+       LDAP_LOG( INDEX, ENTRY, "id2entry_add: (%s)%ld\n", e->e_dn, e->e_id, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "=> id2entry_add( %ld, \"%s\" )\n", e->e_id,
            e->e_dn, 0 );
@@ -44,9 +52,9 @@ id2entry_add( Backend *be, Entry *e )
        if ( (db = ldbm_cache_open( be, "id2entry", LDBM_SUFFIX, LDBM_WRCREAT ))
            == NULL ) {
 #ifdef NEW_LOGGING
-               LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
-                          "id2entry_add: could not open/create id2entry%s\n",
-                          LDBM_SUFFIX ));
+               LDAP_LOG( INDEX, ERR, 
+                  "id2entry_add: could not open/create id2entry%s\n", 
+                  LDBM_SUFFIX, 0,0 );
 #else
                Debug( LDAP_DEBUG_ANY, "Could not open/create id2entry%s\n",
                    LDBM_SUFFIX, 0, 0 );
@@ -76,8 +84,7 @@ id2entry_add( Backend *be, Entry *e )
        ldbm_cache_close( be, db );
 
 #ifdef NEW_LOGGING
-       LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
-                  "id2entry_add: return %d\n", rc ));
+       LDAP_LOG( INDEX, ENTRY, "id2entry_add: return %d\n", rc, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "<= id2entry_add %d\n", rc, 0, 0 );
 #endif
@@ -98,8 +105,7 @@ id2entry_delete( Backend *be, Entry *e )
 #endif
 
 #ifdef NEW_LOGGING
-       LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
-                  "id2entry_delete: (%s)%ld\n", e->e_dn, e->e_id ));
+       LDAP_LOG( INDEX, ENTRY, "id2entry_delete: (%s)%ld\n", e->e_dn, e->e_id, 0 );
 #else
        Debug(LDAP_DEBUG_TRACE, "=> id2entry_delete( %ld, \"%s\" )\n", e->e_id,
            e->e_dn, 0 );
@@ -118,9 +124,9 @@ id2entry_delete( Backend *be, Entry *e )
        if ( (db = ldbm_cache_open( be, "id2entry", LDBM_SUFFIX, LDBM_WRCREAT ))
                == NULL ) {
 #ifdef NEW_LOGGING
-               LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
+               LDAP_LOG( INDEX, ERR, 
                           "id2entry_delete: could not open/create id2entry%s\n",
-                          LDBM_SUFFIX ));
+                          LDBM_SUFFIX, 0, 0 );
 #else
                Debug( LDAP_DEBUG_ANY, "Could not open/create id2entry%s\n",
                    LDBM_SUFFIX, 0, 0 );
@@ -131,9 +137,9 @@ id2entry_delete( Backend *be, Entry *e )
 
        if ( cache_delete_entry( &li->li_cache, e ) != 0 ) {
 #ifdef NEW_LOGGING
-               LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
+               LDAP_LOG( INDEX, ERR, 
                           "id2entry_delete: Could not delete (%s)%ld from cache\n",
-                          e->e_dn, e->e_id ));
+                          e->e_dn, e->e_id, 0 );
 #else
                Debug(LDAP_DEBUG_ANY, "could not delete %ld (%s) from cache\n",
                    e->e_id, e->e_dn, 0 );
@@ -154,8 +160,7 @@ id2entry_delete( Backend *be, Entry *e )
        ldbm_cache_close( be, db );
 
 #ifdef NEW_LOGGING
-       LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
-                  "id2entry_delete: return %d\n", rc ));
+       LDAP_LOG( INDEX, ENTRY, "id2entry_delete: return %d\n", rc, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "<= id2entry_delete %d\n", rc, 0, 0 );
 #endif
@@ -179,9 +184,8 @@ id2entry_rw( Backend *be, ID id, int rw )
        ldbm_datum_init( data );
 
 #ifdef NEW_LOGGING
-       LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
-                  "id2entry_rw: %s (%ld)\n",
-                  rw ? "write" : "read", id ));
+       LDAP_LOG( INDEX, ENTRY, 
+                  "id2entry_rw: %s (%ld)\n", rw ? "write" : "read", id, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "=> id2entry_%s( %ld )\n",
                rw ? "w" : "r", id, 0 );
@@ -190,9 +194,9 @@ id2entry_rw( Backend *be, ID id, int rw )
 
        if ( (e = cache_find_entry_id( &li->li_cache, id, rw )) != NULL ) {
 #ifdef NEW_LOGGING
-               LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
+               LDAP_LOG( INDEX, DETAIL1, 
                           "id2entry_rw: %s (%ld) 0x%lx (cache).\n",
-                          rw ? "write" : "read", id, (unsigned long)e ));
+                          rw ? "write" : "read", id, (unsigned long)e  );
 #else
                Debug( LDAP_DEBUG_TRACE, "<= id2entry_%s( %ld ) 0x%lx (cache)\n",
                        rw ? "w" : "r", id, (unsigned long) e );
@@ -204,8 +208,8 @@ id2entry_rw( Backend *be, ID id, int rw )
        if ( (db = ldbm_cache_open( be, "id2entry", LDBM_SUFFIX, LDBM_WRCREAT ))
                == NULL ) {
 #ifdef NEW_LOGGING
-               LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
-                          "id2entry_rw: could not open id2entry%s\n", LDBM_SUFFIX ));
+               LDAP_LOG( INDEX, ERR, 
+                          "id2entry_rw: could not open id2entry%s\n", LDBM_SUFFIX, 0, 0 );
 #else
                Debug( LDAP_DEBUG_ANY, "Could not open id2entry%s\n",
                    LDBM_SUFFIX, 0, 0 );
@@ -226,8 +230,8 @@ id2entry_rw( Backend *be, ID id, int rw )
 
        if ( data.dptr == NULL ) {
 #ifdef NEW_LOGGING
-               LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
-                          "id2entry_rw: (%ld) not found\n", id ));
+               LDAP_LOG( INDEX, ERR, 
+                          "id2entry_rw: (%ld) not found\n", id, 0, 0 );
 #else
                Debug( LDAP_DEBUG_TRACE, "<= id2entry_%s( %ld ) not found\n",
                        rw ? "w" : "r", id, 0 );
@@ -243,9 +247,8 @@ id2entry_rw( Backend *be, ID id, int rw )
 
        if ( e == NULL ) {
 #ifdef NEW_LOGGING
-               LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
-                          "id2entry_rw: %s of %ld failed\n",
-                          rw ? "write" : "read", id ));
+               LDAP_LOG( INDEX, ERR, 
+                          "id2entry_rw: %s of %ld failed\n", rw ? "write" : "read", id, 0);
 #else
                Debug( LDAP_DEBUG_TRACE, "<= id2entry_%s( %ld ) (failed)\n",
                        rw ? "w" : "r", id, 0 );
@@ -265,9 +268,9 @@ id2entry_rw( Backend *be, ID id, int rw )
                 */
                if ( (e = cache_find_entry_id( &li->li_cache, id, rw )) != NULL ) {
 #ifdef NEW_LOGGING
-                       LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
+                       LDAP_LOG( INDEX, DETAIL1, 
                                   "id2entry_rw: %s of %ld 0x%lx (cache)\n",
-                                  rw ? "write" : "read", id, (unsigned long)e ));
+                                  rw ? "write" : "read", id, (unsigned long)e  );
 #else
                        Debug( LDAP_DEBUG_TRACE, "<= id2entry_%s( %ld ) 0x%lx (cache)\n",
                                rw ? "w" : "r", id, (unsigned long) e );
@@ -277,9 +280,9 @@ id2entry_rw( Backend *be, ID id, int rw )
                }
 
 #ifdef NEW_LOGGING
-               LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
+               LDAP_LOG( INDEX, ERR, 
                           "id2entry_rw: %s of %ld (cache add failed)\n",
-                          rw ? "write" : "read", id ));
+                          rw ? "write" : "read", id, 0 );
 #else
                Debug( LDAP_DEBUG_TRACE, "<= id2entry_%s( %ld ) (cache add failed)\n",
                        rw ? "w" : "r", id, 0 );
@@ -289,9 +292,9 @@ id2entry_rw( Backend *be, ID id, int rw )
        }
 
 #ifdef NEW_LOGGING
-       LDAP_LOG(( "backend", LDAP_LEVEL_ENTRY,
+       LDAP_LOG( INDEX, ENTRY, 
                   "id2entry_rw: %s of %ld 0x%lx (disk)\n",
-                  rw ? "write" : "read", id, (unsigned long)e ));
+                  rw ? "write" : "read", id, (unsigned long)e  );
 #else
        Debug( LDAP_DEBUG_TRACE, "<= id2entry_%s( %ld ) 0x%lx (disk)\n",
                rw ? "w" : "r", id, (unsigned long) e );