]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-ldbm/index.c
When recreating a database from an ldif file created by ldbmcat,
[openldap] / servers / slapd / back-ldbm / index.c
index 5f8b7cec646450c7ff35bb7a1cea0a03d651ee14..1a3a468fc20f606bf17ee4f04f688da72248cf8e 100644 (file)
 #include "back-ldbm.h"
 
 static int     change_value(Backend *be,
-                         struct dbcache *db,
+                         DBCache *db,
                          char *type,
                          int indextype,
                          char *val,
                          ID id,
                          int
-                         (*idl_func)(Backend *, struct dbcache *, Datum, ID));
+                         (*idl_func)(Backend *, DBCache *, Datum, ID));
 static int     index2prefix(int indextype);
 
 int
@@ -116,7 +116,7 @@ index_read(
     char       *val
 )
 {
-       struct dbcache  *db;
+       DBCache *db;
        Datum           key;
        ID_BLOCK                *idl;
        int             indexmask, syntax;
@@ -188,12 +188,12 @@ index_read(
 static int
 change_value(
     Backend            *be,
-    struct dbcache     *db,
+    DBCache    *db,
     char               *type,
     int                        indextype,
     char               *val,
     ID                 id,
-    int                        (*idl_func)(Backend *, struct dbcache *, Datum, ID)
+    int                        (*idl_func)(Backend *, DBCache *, Datum, ID)
 )
 {
        int     rc;
@@ -257,14 +257,21 @@ index_change_values(
        char            buf[SUBLEN + 1];
        char            vbuf[BUFSIZ];
        char            *bigbuf;
-       struct dbcache  *db;
+       DBCache *db;
 
        int             (*idl_funct)(Backend *,
-                                   struct dbcache *,
+                                   DBCache *,
                                    Datum, ID);
        char            *at_cn; /* Attribute canonical name */
        int             mode;
 
+       if( vals == NULL ) {
+               Debug( LDAP_DEBUG_TRACE,
+                       "=> index_change_values( %s, NULL, %ld, op=%s )\n", 
+                       type, id, ((op == __INDEX_ADD_OP) ? "ADD" : "DELETE" ) );
+               return 0;
+       }
+
        Debug( LDAP_DEBUG_TRACE,
               "=> index_change_values( \"%s\", %ld, op=%s )\n", 
               type, id, ((op == __INDEX_ADD_OP) ? "ADD" : "DELETE" ) );
@@ -417,6 +424,7 @@ index_change_values(
                        free( bigbuf );
                }
        }
+
        ldbm_cache_close( be, db );
 
        return( 0 );