]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-mdb/tools.c
ITS#7906 better fix
[openldap] / servers / slapd / back-mdb / tools.c
index 66af3b2781019446df6156e2b2451c6f6a188fd3..0839d56784ed1571c669a3d58f0ccaaf2f795971 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2011-2013 The OpenLDAP Foundation.
+ * Copyright 2011-2014 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -145,6 +145,7 @@ int mdb_tool_entry_open(
 int mdb_tool_entry_close(
        BackendDB *be )
 {
+#ifdef MDB_TOOL_IDL_CACHING
        if ( mdb_tool_info ) {
                int i;
                slapd_shutdown = 1;
@@ -185,6 +186,7 @@ int mdb_tool_entry_close(
                        }
                }
        }
+#endif
 
        if( idcursor ) {
                mdb_cursor_close( idcursor );
@@ -394,7 +396,7 @@ mdb_tool_entry_get_int( BackendDB *be, ID id, Entry **ep )
                        }
                }
        }
-       rc = mdb_entry_decode( &op, &data, &e );
+       rc = mdb_entry_decode( &op, txn, &data, &e );
        e->e_id = id;
        if ( !BER_BVISNULL( &dn )) {
                e->e_name = dn;
@@ -704,7 +706,9 @@ ID mdb_tool_entry_put(
                goto done;
        }
 
-       LDAP_SLIST_INSERT_HEAD( &op.o_extra, &mdb_tool_axinfo[0]->ai_oe, oe_next );
+       if ( mdb_tool_threads > 1 ) {
+               LDAP_SLIST_INSERT_HEAD( &op.o_extra, &mdb_tool_axinfo[0]->ai_oe, oe_next );
+       }
        rc = mdb_tool_index_add( &op, txn, e );
        if( rc != 0 ) {
                snprintf( text->bv_val, text->bv_len,
@@ -1417,7 +1421,7 @@ mdb_dn2id_upgrade( BackendDB *be ) {
                if (dkids > 1) {
                        rc = mdb_cursor_get(mc, &key, &data, MDB_NEXT_DUP);
 down:
-                       ptr = data.mv_data + data.mv_size - sizeof(ID);
+                       ptr = (unsigned char *)data.mv_data + data.mv_size - sizeof(ID);
                        memcpy(&id, ptr, sizeof(ID));
                        depth++;
                        memcpy(stack[depth].rdn, data.mv_data, data.mv_size);
@@ -1443,7 +1447,7 @@ pop:
                        goto leave;
                }
                data.mv_data = stack[depth].rdn;
-               ptr = data.mv_data + data.mv_size;
+               ptr = (unsigned char *)data.mv_data + data.mv_size;
                memcpy(ptr, &num[depth], sizeof(ID));
                data.mv_size += sizeof(ID);
                rc = mdb_cursor_del(mc, 0);