The branch, master has been updated
       via  fc97c60... s4-lsa: fixed the lsa server to cope with the new tests 
from gd
       via  a109ee7... s4-ldb: added a TODO about checking the indexlist
       via  f2988f5... s4-ldb: fixed some memory leaks in new indexing code
       via  0fb6e2a... s4-ldb: don't try to index non-indexed attributes
       via  a5712ff... s4-selftest: removed raw.unlink from quicktest
       via  1b48764... s4-ldb: ensure new dn_list elements are not owned by 
caller
       via  129298c... s4-ldb: over-allocate index records to save on realloc 
costs
       via  d483c3b... s4-ldb: fixed tdb error handling in ldb_index.c
       via  fcd16ea... s4-ldb: delete empty index records
       via  936c8f3... s4-ldb: do more validation of idxptr lists
       via  74ae8b9... s4-ldb: expose ltdb_err_map and ltdb_delete_noindex
       via  c4cb0c5... s4-ldb: fast path for equal pointers
       via  606ff46... selftest: make python run unbuffered
       via  dfa0b74... util: fixed place where we could look one byte past end 
of string
       via  3f5d535... idl-drsblobs: mark some more reserved values as value(0)
       via  5f3cbb5... s4-ldb: when taking a list intersection, the result can 
be as long as the first list
       via  859cf72... s4-ldb: ldb indexing rewrite - part1
       via  c5de880... s4-ldb: ldb_oom() for modules
      from  c9838f0... s4:torture Silence const warning by use of 
data_blob_const()

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit fc97c60c56c0492c923743b7e3190fa06cad6e90
Author: Andrew Tridgell <tri...@samba.org>
Date:   Thu Oct 22 14:44:47 2009 +1100

    s4-lsa: fixed the lsa server to cope with the new tests from gd

commit a109ee71fb9b8fa25f9ca739caaba5a1399b7864
Author: Andrew Tridgell <tri...@samba.org>
Date:   Thu Oct 22 12:45:48 2009 +1100

    s4-ldb: added a TODO about checking the indexlist

commit f2988f5cad156da54e7ad41c2c2d8bd7a0ee29b8
Author: Andrew Tridgell <tri...@samba.org>
Date:   Thu Oct 22 12:45:26 2009 +1100

    s4-ldb: fixed some memory leaks in new indexing code

commit 0fb6e2a52cb681cfdd73c4be16487d1d9d7d8318
Author: Andrew Tridgell <tri...@samba.org>
Date:   Thu Oct 22 12:29:35 2009 +1100

    s4-ldb: don't try to index non-indexed attributes

commit a5712ff673226e0259a7f6fcca4377feb0eabf8f
Author: Andrew Tridgell <tri...@samba.org>
Date:   Thu Oct 22 11:19:19 2009 +1100

    s4-selftest: removed raw.unlink from quicktest
    
    This test takes 40s, and quicktest already covers delete operations in
    base.delete

commit 1b48764f24cf2204fb12cc4fa1381fc6bc9e14f4
Author: Andrew Tridgell <tri...@samba.org>
Date:   Thu Oct 22 11:16:30 2009 +1100

    s4-ldb: ensure new dn_list elements are not owned by caller

commit 129298c9b9793794125558b8334fd5b578ca1112
Author: Andrew Tridgell <tri...@samba.org>
Date:   Thu Oct 22 11:16:00 2009 +1100

    s4-ldb: over-allocate index records to save on realloc costs

commit d483c3bb960823cbf9a812872d6040bc390c48ca
Author: Andrew Tridgell <tri...@samba.org>
Date:   Thu Oct 22 11:15:18 2009 +1100

    s4-ldb: fixed tdb error handling in ldb_index.c

commit fcd16eab6c9cbba05f3e2719527ed217d816d75c
Author: Andrew Tridgell <tri...@samba.org>
Date:   Thu Oct 22 11:14:36 2009 +1100

    s4-ldb: delete empty index records

commit 936c8f311ac435a7d6cf2643c3dc4a9cbc9a79da
Author: Andrew Tridgell <tri...@samba.org>
Date:   Thu Oct 22 11:13:28 2009 +1100

    s4-ldb: do more validation of idxptr lists

commit 74ae8b90ae71446ccafab3a324087f2edf928b13
Author: Andrew Tridgell <tri...@samba.org>
Date:   Thu Oct 22 11:06:33 2009 +1100

    s4-ldb: expose ltdb_err_map and ltdb_delete_noindex
    
    These will be used by ldb_index.c

commit c4cb0c520c4599d3d480a24b33473e304e172baf
Author: Andrew Tridgell <tri...@samba.org>
Date:   Thu Oct 22 11:05:15 2009 +1100

    s4-ldb: fast path for equal pointers
    
    We compare identical ldb_val values surprisingly often

commit 606ff46447f9b1f8708270a69a248c3439408aab
Author: Andrew Tridgell <tri...@samba.org>
Date:   Thu Oct 22 11:04:40 2009 +1100

    selftest: make python run unbuffered
    
    This makes some output in make test easier to follow

commit dfa0b74516349f892b77f384d0c59ae2008199c2
Author: Andrew Tridgell <tri...@samba.org>
Date:   Thu Oct 22 11:03:27 2009 +1100

    util: fixed place where we could look one byte past end of string
    
    We need to check the length before the value

commit 3f5d5359726f30b7bdbc2b46da67a0df7e830f33
Author: Andrew Tridgell <tri...@samba.org>
Date:   Thu Oct 22 10:36:58 2009 +1100

    idl-drsblobs: mark some more reserved values as value(0)
    
    This prevents valgrind errors when we store these blobs in a database

commit 5f3cbb5f0b19a3db2657659709e3a8377b6dd26a
Author: Andrew Tridgell <tri...@samba.org>
Date:   Wed Oct 21 22:33:58 2009 +1100

    s4-ldb: when taking a list intersection, the result can be as long as the 
first list
    
    Intuitively you would think it couldn't be longer than the minimum of
    the two lists, but we are deliberately allowing for duplicates at this
    level of the indexing code, which means the result can be longer

commit 859cf72692f7daecbecb80559ebccc0d44087365
Author: Andrew Tridgell <tri...@samba.org>
Date:   Wed Oct 21 22:21:26 2009 +1100

    s4-ldb: ldb indexing rewrite - part1
    
    This gets rid of the @IDXPTR approach to in-transaction indexing,
    instead using an in-memory tdb to hold index values during a
    transaction. This also cleans up a lot of the internal indexing logic,
    hopefully making it easier to understand.
    
    One of the big changes is in memory management, with a lot more use
    made of talloc tricks to avoid copying dn lists, and shortcuts used to
    avoid high intersection and union calculation costs.
    
    The overall result is that a re-provision on my laptop goes from 48s
    to a bit over 10s.

commit c5de880c409224889c30837b76fb2fdaf31c02e0
Author: Andrew Tridgell <tri...@samba.org>
Date:   Wed Oct 21 22:18:32 2009 +1100

    s4-ldb: ldb_oom() for modules

-----------------------------------------------------------------------

Summary of changes:
 lib/util/charset/util_unistr.c       |    2 +-
 librpc/gen_ndr/drsblobs.h            |   20 +-
 librpc/gen_ndr/ndr_drsblobs.c        |   40 +-
 librpc/idl/drsblobs.idl              |   20 +-
 selftest/selftest.pl                 |    3 +
 source4/lib/ldb/common/ldb_msg.c     |    2 +-
 source4/lib/ldb/include/ldb_module.h |    1 +
 source4/lib/ldb/ldb_tdb/ldb_cache.c  |    9 +
 source4/lib/ldb/ldb_tdb/ldb_index.c  | 1529 +++++++++++++++-------------------
 source4/lib/ldb/ldb_tdb/ldb_tdb.c    |  131 ++--
 source4/lib/ldb/ldb_tdb/ldb_tdb.h    |   20 +-
 source4/rpc_server/lsa/lsa_lookup.c  |   45 +-
 source4/selftest/quick               |    1 -
 13 files changed, 862 insertions(+), 961 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/util/charset/util_unistr.c b/lib/util/charset/util_unistr.c
index 024dc70..045aa4a 100644
--- a/lib/util/charset/util_unistr.c
+++ b/lib/util/charset/util_unistr.c
@@ -483,7 +483,7 @@ _PUBLIC_ char *strupper_talloc_n(TALLOC_CTX *ctx, const 
char *src, size_t n)
                return NULL;
        }
 
-       while (*src && n--) {
+       while (n-- && *src) {
                size_t c_size;
                codepoint_t c = next_codepoint_convenience(iconv_convenience, 
src, &c_size);
                src += c_size;
diff --git a/librpc/gen_ndr/drsblobs.h b/librpc/gen_ndr/drsblobs.h
index 64f6ce8..57712a4 100644
--- a/librpc/gen_ndr/drsblobs.h
+++ b/librpc/gen_ndr/drsblobs.h
@@ -23,7 +23,7 @@ struct replPropertyMetaData1 {
 
 struct replPropertyMetaDataCtr1 {
        uint32_t count;
-       uint32_t reserved;
+       uint32_t reserved;/* [value(0)] */
        struct replPropertyMetaData1 *array;
 };
 
@@ -33,19 +33,19 @@ union replPropertyMetaDataCtr {
 
 struct replPropertyMetaDataBlob {
        uint32_t version;
-       uint32_t reserved;
+       uint32_t reserved;/* [value(0)] */
        union replPropertyMetaDataCtr ctr;/* [switch_is(version)] */
 }/* [public] */;
 
 struct replUpToDateVectorCtr1 {
        uint32_t count;
-       uint32_t reserved;
+       uint32_t reserved;/* [value(0)] */
        struct drsuapi_DsReplicaCursor *cursors;
 };
 
 struct replUpToDateVectorCtr2 {
        uint32_t count;
-       uint32_t reserved;
+       uint32_t reserved;/* [value(0)] */
        struct drsuapi_DsReplicaCursor2 *cursors;
 };
 
@@ -56,7 +56,7 @@ union replUpToDateVectorCtr {
 
 struct replUpToDateVectorBlob {
        uint32_t version;
-       uint32_t reserved;
+       uint32_t reserved;/* [value(0)] */
        union replUpToDateVectorCtr ctr;/* [switch_is(version)] */
 }/* [public] */;
 
@@ -75,7 +75,7 @@ struct repsFromTo1 {
        uint32_t other_info_length;/* 
[value(ndr_size_repsFromTo1OtherInfo(other_info,ndr->iconv_convenience,ndr->flags))]
 */
        uint32_t replica_flags;
        uint8_t schedule[84];
-       uint32_t reserved;
+       uint32_t reserved;/* [value(0)] */
        struct drsuapi_DsReplicaHighWaterMark highwatermark;
        struct GUID source_dsa_obj_guid;
        struct GUID source_dsa_invocation_id;
@@ -100,7 +100,7 @@ struct repsFromTo2 {
        uint32_t other_info_length;/* 
[value(ndr_size_repsFromTo2OtherInfo(other_info,ndr->iconv_convenience,ndr->flags))]
 */
        uint32_t replica_flags;
        uint8_t schedule[84];
-       uint32_t reserved;
+       uint32_t reserved;/* [value(0)] */
        struct drsuapi_DsReplicaHighWaterMark highwatermark;
        struct GUID source_dsa_obj_guid;
        struct GUID source_dsa_invocation_id;
@@ -115,7 +115,7 @@ union repsFromTo {
 
 struct repsFromToBlob {
        uint32_t version;
-       uint32_t reserved;
+       uint32_t reserved;/* [value(0)] */
        union repsFromTo ctr;/* [switch_is(version)] */
 }/* [public] */;
 
@@ -130,7 +130,7 @@ union partialAttributeSetCtr {
 
 struct partialAttributeSetBlob {
        uint32_t version;
-       uint32_t reserved;
+       uint32_t reserved;/* [value(0)] */
        union partialAttributeSetCtr ctr;/* [switch_is(version)] */
 }/* [public] */;
 
@@ -151,7 +151,7 @@ union prefixMapCtr {
 
 struct prefixMapBlob {
        enum prefixMapVersion version;
-       uint32_t reserved;
+       uint32_t reserved;/* [value(0)] */
        union prefixMapCtr ctr;/* [switch_is(version)] */
 }/* [public] */;
 
diff --git a/librpc/gen_ndr/ndr_drsblobs.c b/librpc/gen_ndr/ndr_drsblobs.c
index 8a0842b..39c3057 100644
--- a/librpc/gen_ndr/ndr_drsblobs.c
+++ b/librpc/gen_ndr/ndr_drsblobs.c
@@ -60,7 +60,7 @@ static enum ndr_err_code 
ndr_push_replPropertyMetaDataCtr1(struct ndr_push *ndr,
        if (ndr_flags & NDR_SCALARS) {
                NDR_CHECK(ndr_push_align(ndr, 8));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->reserved));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
                for (cntr_array_0 = 0; cntr_array_0 < r->count; cntr_array_0++) 
{
                        NDR_CHECK(ndr_push_replPropertyMetaData1(ndr, 
NDR_SCALARS, &r->array[cntr_array_0]));
                }
@@ -99,7 +99,7 @@ _PUBLIC_ void ndr_print_replPropertyMetaDataCtr1(struct 
ndr_print *ndr, const ch
        ndr_print_struct(ndr, name, "replPropertyMetaDataCtr1");
        ndr->depth++;
        ndr_print_uint32(ndr, "count", r->count);
-       ndr_print_uint32(ndr, "reserved", r->reserved);
+       ndr_print_uint32(ndr, "reserved", (ndr->flags & 
LIBNDR_PRINT_SET_VALUES)?0:r->reserved);
        ndr->print(ndr, "%s: ARRAY(%d)", "array", (int)r->count);
        ndr->depth++;
        for (cntr_array_0=0;cntr_array_0<r->count;cntr_array_0++) {
@@ -187,7 +187,7 @@ _PUBLIC_ enum ndr_err_code 
ndr_push_replPropertyMetaDataBlob(struct ndr_push *nd
        if (ndr_flags & NDR_SCALARS) {
                NDR_CHECK(ndr_push_align(ndr, 8));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->version));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->reserved));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
                NDR_CHECK(ndr_push_set_switch_value(ndr, &r->ctr, r->version));
                NDR_CHECK(ndr_push_replPropertyMetaDataCtr(ndr, NDR_SCALARS, 
&r->ctr));
                NDR_CHECK(ndr_push_trailer_align(ndr, 8));
@@ -217,7 +217,7 @@ _PUBLIC_ void ndr_print_replPropertyMetaDataBlob(struct 
ndr_print *ndr, const ch
        ndr_print_struct(ndr, name, "replPropertyMetaDataBlob");
        ndr->depth++;
        ndr_print_uint32(ndr, "version", r->version);
-       ndr_print_uint32(ndr, "reserved", r->reserved);
+       ndr_print_uint32(ndr, "reserved", (ndr->flags & 
LIBNDR_PRINT_SET_VALUES)?0:r->reserved);
        ndr_print_set_switch_value(ndr, &r->ctr, r->version);
        ndr_print_replPropertyMetaDataCtr(ndr, "ctr", &r->ctr);
        ndr->depth--;
@@ -229,7 +229,7 @@ static enum ndr_err_code 
ndr_push_replUpToDateVectorCtr1(struct ndr_push *ndr, i
        if (ndr_flags & NDR_SCALARS) {
                NDR_CHECK(ndr_push_align(ndr, 8));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->reserved));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
                for (cntr_cursors_0 = 0; cntr_cursors_0 < r->count; 
cntr_cursors_0++) {
                        NDR_CHECK(ndr_push_drsuapi_DsReplicaCursor(ndr, 
NDR_SCALARS, &r->cursors[cntr_cursors_0]));
                }
@@ -268,7 +268,7 @@ _PUBLIC_ void ndr_print_replUpToDateVectorCtr1(struct 
ndr_print *ndr, const char
        ndr_print_struct(ndr, name, "replUpToDateVectorCtr1");
        ndr->depth++;
        ndr_print_uint32(ndr, "count", r->count);
-       ndr_print_uint32(ndr, "reserved", r->reserved);
+       ndr_print_uint32(ndr, "reserved", (ndr->flags & 
LIBNDR_PRINT_SET_VALUES)?0:r->reserved);
        ndr->print(ndr, "%s: ARRAY(%d)", "cursors", (int)r->count);
        ndr->depth++;
        for (cntr_cursors_0=0;cntr_cursors_0<r->count;cntr_cursors_0++) {
@@ -288,7 +288,7 @@ static enum ndr_err_code 
ndr_push_replUpToDateVectorCtr2(struct ndr_push *ndr, i
        if (ndr_flags & NDR_SCALARS) {
                NDR_CHECK(ndr_push_align(ndr, 8));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->reserved));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
                for (cntr_cursors_0 = 0; cntr_cursors_0 < r->count; 
cntr_cursors_0++) {
                        NDR_CHECK(ndr_push_drsuapi_DsReplicaCursor2(ndr, 
NDR_SCALARS, &r->cursors[cntr_cursors_0]));
                }
@@ -327,7 +327,7 @@ _PUBLIC_ void ndr_print_replUpToDateVectorCtr2(struct 
ndr_print *ndr, const char
        ndr_print_struct(ndr, name, "replUpToDateVectorCtr2");
        ndr->depth++;
        ndr_print_uint32(ndr, "count", r->count);
-       ndr_print_uint32(ndr, "reserved", r->reserved);
+       ndr_print_uint32(ndr, "reserved", (ndr->flags & 
LIBNDR_PRINT_SET_VALUES)?0:r->reserved);
        ndr->print(ndr, "%s: ARRAY(%d)", "cursors", (int)r->count);
        ndr->depth++;
        for (cntr_cursors_0=0;cntr_cursors_0<r->count;cntr_cursors_0++) {
@@ -433,7 +433,7 @@ _PUBLIC_ enum ndr_err_code 
ndr_push_replUpToDateVectorBlob(struct ndr_push *ndr,
        if (ndr_flags & NDR_SCALARS) {
                NDR_CHECK(ndr_push_align(ndr, 8));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->version));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->reserved));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
                NDR_CHECK(ndr_push_set_switch_value(ndr, &r->ctr, r->version));
                NDR_CHECK(ndr_push_replUpToDateVectorCtr(ndr, NDR_SCALARS, 
&r->ctr));
                NDR_CHECK(ndr_push_trailer_align(ndr, 8));
@@ -463,7 +463,7 @@ _PUBLIC_ void ndr_print_replUpToDateVectorBlob(struct 
ndr_print *ndr, const char
        ndr_print_struct(ndr, name, "replUpToDateVectorBlob");
        ndr->depth++;
        ndr_print_uint32(ndr, "version", r->version);
-       ndr_print_uint32(ndr, "reserved", r->reserved);
+       ndr_print_uint32(ndr, "reserved", (ndr->flags & 
LIBNDR_PRINT_SET_VALUES)?0:r->reserved);
        ndr_print_set_switch_value(ndr, &r->ctr, r->version);
        ndr_print_replUpToDateVectorCtr(ndr, "ctr", &r->ctr);
        ndr->depth--;
@@ -525,7 +525,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_repsFromTo1(struct 
ndr_push *ndr, int ndr_fl
                        NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 
ndr_size_repsFromTo1OtherInfo(r->other_info, ndr->iconv_convenience, 
ndr->flags)));
                        NDR_CHECK(ndr_push_drsuapi_DsReplicaNeighbourFlags(ndr, 
NDR_SCALARS, r->replica_flags));
                        NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, 
r->schedule, 84));
-                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 
r->reserved));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
                        NDR_CHECK(ndr_push_drsuapi_DsReplicaHighWaterMark(ndr, 
NDR_SCALARS, &r->highwatermark));
                        NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, 
&r->source_dsa_obj_guid));
                        NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, 
&r->source_dsa_invocation_id));
@@ -612,7 +612,7 @@ _PUBLIC_ void ndr_print_repsFromTo1(struct ndr_print *ndr, 
const char *name, con
                ndr_print_uint32(ndr, "other_info_length", (ndr->flags & 
LIBNDR_PRINT_SET_VALUES)?ndr_size_repsFromTo1OtherInfo(r->other_info, 
ndr->iconv_convenience, ndr->flags):r->other_info_length);
                ndr_print_drsuapi_DsReplicaNeighbourFlags(ndr, "replica_flags", 
r->replica_flags);
                ndr_print_array_uint8(ndr, "schedule", r->schedule, 84);
-               ndr_print_uint32(ndr, "reserved", r->reserved);
+               ndr_print_uint32(ndr, "reserved", (ndr->flags & 
LIBNDR_PRINT_SET_VALUES)?0:r->reserved);
                ndr_print_drsuapi_DsReplicaHighWaterMark(ndr, "highwatermark", 
&r->highwatermark);
                ndr_print_GUID(ndr, "source_dsa_obj_guid", 
&r->source_dsa_obj_guid);
                ndr_print_GUID(ndr, "source_dsa_invocation_id", 
&r->source_dsa_invocation_id);
@@ -795,7 +795,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_repsFromTo2(struct 
ndr_push *ndr, int ndr_fl
                        NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 
ndr_size_repsFromTo2OtherInfo(r->other_info, ndr->iconv_convenience, 
ndr->flags)));
                        NDR_CHECK(ndr_push_drsuapi_DsReplicaNeighbourFlags(ndr, 
NDR_SCALARS, r->replica_flags));
                        NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, 
r->schedule, 84));
-                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 
r->reserved));
+                       NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
                        NDR_CHECK(ndr_push_drsuapi_DsReplicaHighWaterMark(ndr, 
NDR_SCALARS, &r->highwatermark));
                        NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, 
&r->source_dsa_obj_guid));
                        NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, 
&r->source_dsa_invocation_id));
@@ -884,7 +884,7 @@ _PUBLIC_ void ndr_print_repsFromTo2(struct ndr_print *ndr, 
const char *name, con
                ndr_print_uint32(ndr, "other_info_length", (ndr->flags & 
LIBNDR_PRINT_SET_VALUES)?ndr_size_repsFromTo2OtherInfo(r->other_info, 
ndr->iconv_convenience, ndr->flags):r->other_info_length);
                ndr_print_drsuapi_DsReplicaNeighbourFlags(ndr, "replica_flags", 
r->replica_flags);
                ndr_print_array_uint8(ndr, "schedule", r->schedule, 84);
-               ndr_print_uint32(ndr, "reserved", r->reserved);
+               ndr_print_uint32(ndr, "reserved", (ndr->flags & 
LIBNDR_PRINT_SET_VALUES)?0:r->reserved);
                ndr_print_drsuapi_DsReplicaHighWaterMark(ndr, "highwatermark", 
&r->highwatermark);
                ndr_print_GUID(ndr, "source_dsa_obj_guid", 
&r->source_dsa_obj_guid);
                ndr_print_GUID(ndr, "source_dsa_invocation_id", 
&r->source_dsa_invocation_id);
@@ -997,7 +997,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_repsFromToBlob(struct 
ndr_push *ndr, int ndr
        if (ndr_flags & NDR_SCALARS) {
                NDR_CHECK(ndr_push_align(ndr, 8));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->version));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->reserved));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
                NDR_CHECK(ndr_push_set_switch_value(ndr, &r->ctr, r->version));
                NDR_CHECK(ndr_push_repsFromTo(ndr, NDR_SCALARS, &r->ctr));
                NDR_CHECK(ndr_push_trailer_align(ndr, 8));
@@ -1029,7 +1029,7 @@ _PUBLIC_ void ndr_print_repsFromToBlob(struct ndr_print 
*ndr, const char *name,
        ndr_print_struct(ndr, name, "repsFromToBlob");
        ndr->depth++;
        ndr_print_uint32(ndr, "version", r->version);
-       ndr_print_uint32(ndr, "reserved", r->reserved);
+       ndr_print_uint32(ndr, "reserved", (ndr->flags & 
LIBNDR_PRINT_SET_VALUES)?0:r->reserved);
        ndr_print_set_switch_value(ndr, &r->ctr, r->version);
        ndr_print_repsFromTo(ndr, "ctr", &r->ctr);
        ndr->depth--;
@@ -1165,7 +1165,7 @@ _PUBLIC_ enum ndr_err_code 
ndr_push_partialAttributeSetBlob(struct ndr_push *ndr
        if (ndr_flags & NDR_SCALARS) {
                NDR_CHECK(ndr_push_align(ndr, 4));
                NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->version));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->reserved));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
                NDR_CHECK(ndr_push_set_switch_value(ndr, &r->ctr, r->version));
                NDR_CHECK(ndr_push_partialAttributeSetCtr(ndr, NDR_SCALARS, 
&r->ctr));
                NDR_CHECK(ndr_push_trailer_align(ndr, 4));
@@ -1195,7 +1195,7 @@ _PUBLIC_ void ndr_print_partialAttributeSetBlob(struct 
ndr_print *ndr, const cha
        ndr_print_struct(ndr, name, "partialAttributeSetBlob");
        ndr->depth++;
        ndr_print_uint32(ndr, "version", r->version);
-       ndr_print_uint32(ndr, "reserved", r->reserved);
+       ndr_print_uint32(ndr, "reserved", (ndr->flags & 
LIBNDR_PRINT_SET_VALUES)?0:r->reserved);
        ndr_print_set_switch_value(ndr, &r->ctr, r->version);
        ndr_print_partialAttributeSetCtr(ndr, "ctr", &r->ctr);
        ndr->depth--;
@@ -1301,7 +1301,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_prefixMapBlob(struct 
ndr_push *ndr, int ndr_
        if (ndr_flags & NDR_SCALARS) {
                NDR_CHECK(ndr_push_align(ndr, 5));
                NDR_CHECK(ndr_push_prefixMapVersion(ndr, NDR_SCALARS, 
r->version));
-               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->reserved));
+               NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
                NDR_CHECK(ndr_push_set_switch_value(ndr, &r->ctr, r->version));
                NDR_CHECK(ndr_push_prefixMapCtr(ndr, NDR_SCALARS, &r->ctr));
                NDR_CHECK(ndr_push_trailer_align(ndr, 5));
@@ -1333,7 +1333,7 @@ _PUBLIC_ void ndr_print_prefixMapBlob(struct ndr_print 
*ndr, const char *name, c
        ndr_print_struct(ndr, name, "prefixMapBlob");
        ndr->depth++;
        ndr_print_prefixMapVersion(ndr, "version", r->version);
-       ndr_print_uint32(ndr, "reserved", r->reserved);
+       ndr_print_uint32(ndr, "reserved", (ndr->flags & 
LIBNDR_PRINT_SET_VALUES)?0:r->reserved);
        ndr_print_set_switch_value(ndr, &r->ctr, r->version);
        ndr_print_prefixMapCtr(ndr, "ctr", &r->ctr);
        ndr->depth--;
diff --git a/librpc/idl/drsblobs.idl b/librpc/idl/drsblobs.idl
index 68e9fd5..97f3b2d 100644
--- a/librpc/idl/drsblobs.idl
+++ b/librpc/idl/drsblobs.idl
@@ -30,7 +30,7 @@ interface drsblobs {
 
        typedef struct {
                uint32 count;
-               uint32 reserved;
+               [value(0)] uint32 reserved;
                replPropertyMetaData1 array[count];
        } replPropertyMetaDataCtr1;
 
@@ -40,7 +40,7 @@ interface drsblobs {
        
        typedef [public] struct {
                uint32 version;
-               uint32 reserved;
+               [value(0)] uint32 reserved;
                [switch_is(version)] replPropertyMetaDataCtr ctr;
        } replPropertyMetaDataBlob;
 
@@ -55,13 +55,13 @@ interface drsblobs {
         */
        typedef struct {
                uint32 count;
-               uint32 reserved;
+               [value(0)] uint32 reserved;
                drsuapi_DsReplicaCursor cursors[count];
        } replUpToDateVectorCtr1;
 
        typedef struct {
                uint32 count;
-               uint32 reserved;
+               [value(0)] uint32 reserved;
                drsuapi_DsReplicaCursor2 cursors[count];
        } replUpToDateVectorCtr2;
 
@@ -72,7 +72,7 @@ interface drsblobs {
 
        typedef [public] struct {
                uint32 version;
-               uint32 reserved;
+               [value(0)] uint32 reserved;
                [switch_is(version)] replUpToDateVectorCtr ctr;
        } replUpToDateVectorBlob;
 
@@ -102,7 +102,7 @@ interface drsblobs {
                [value(ndr_size_repsFromTo1OtherInfo(other_info, 
ndr->iconv_convenience, ndr->flags))] uint32 other_info_length;
                drsuapi_DsReplicaNeighbourFlags replica_flags;
                uint8 schedule[84];
-               uint32 reserved;
+               [value(0)] uint32 reserved;
                drsuapi_DsReplicaHighWaterMark highwatermark;
                GUID source_dsa_obj_guid; /* the 'objectGuid' field of the 
CN=NTDS Settings object */
                GUID source_dsa_invocation_id; /* the 'invocationId' field of 
the CN=NTDS Settings object */
@@ -129,7 +129,7 @@ interface drsblobs {
                [value(ndr_size_repsFromTo2OtherInfo(other_info, 
ndr->iconv_convenience, ndr->flags))] uint32 other_info_length;
                drsuapi_DsReplicaNeighbourFlags replica_flags;
                uint8 schedule[84];
-               uint32 reserved;
+               [value(0)] uint32 reserved;
                drsuapi_DsReplicaHighWaterMark highwatermark;
                GUID source_dsa_obj_guid; /* the 'objectGuid' field of the 
CN=NTDS Settings object */
                GUID source_dsa_invocation_id; /* the 'invocationId' field of 
the CN=NTDS Settings object */
@@ -144,7 +144,7 @@ interface drsblobs {
 
        typedef [public] struct {
                uint32 version;
-               uint32 reserved;
+               [value(0)] uint32 reserved;
                [switch_is(version)] repsFromTo ctr;
        } repsFromToBlob;
 
@@ -168,7 +168,7 @@ interface drsblobs {
 
        typedef [public] struct {
                uint32 version;
-               uint32 reserved;
+               [value(0)] uint32 reserved;
                [switch_is(version)] partialAttributeSetCtr ctr;
        } partialAttributeSetBlob;
 
@@ -196,7 +196,7 @@ interface drsblobs {
 
        typedef [public] struct {
                prefixMapVersion version;
-               uint32 reserved;
+               [value(0)] uint32 reserved;
                [switch_is(version)] prefixMapCtr ctr;
        } prefixMapBlob;
 
diff --git a/selftest/selftest.pl b/selftest/selftest.pl
index 2aae050..b301778 100755
--- a/selftest/selftest.pl
+++ b/selftest/selftest.pl
@@ -356,6 +356,9 @@ unless (defined($ENV{VALGRIND})) {
        $ENV{MALLOC_CHECK_} = 2;
 }
 
+# make all our python scripts unbuffered
+$ENV{PYTHONUNBUFFERED} = 1;
+
 my $bindir = ($opt_bindir or "$builddir/bin");
 my $bindir_abs = abs_path($bindir);
 
diff --git a/source4/lib/ldb/common/ldb_msg.c b/source4/lib/ldb/common/ldb_msg.c
index a8ea52b..a040043 100644
--- a/source4/lib/ldb/common/ldb_msg.c
+++ b/source4/lib/ldb/common/ldb_msg.c
@@ -63,7 +63,7 @@ struct ldb_message_element *ldb_msg_find_element(const struct 
ldb_message *msg,
 int ldb_val_equal_exact(const struct ldb_val *v1, const struct ldb_val *v2)
 {
        if (v1->length != v2->length) return 0;
-
+       if (v1->data == v2->data) return 1;
        if (v1->length == 0) return 1;
 
        if (memcmp(v1->data, v2->data, v1->length) == 0) {
diff --git a/source4/lib/ldb/include/ldb_module.h 
b/source4/lib/ldb/include/ldb_module.h
index 6061c4d..977d485 100644
--- a/source4/lib/ldb/include/ldb_module.h
+++ b/source4/lib/ldb/include/ldb_module.h
@@ -68,6 +68,7 @@ void ldb_debug_add(struct ldb_context *ldb, const char *fmt, 
...) PRINTF_ATTRIBU
 void ldb_debug_end(struct ldb_context *ldb, enum ldb_debug_level level);
 
 #define ldb_oom(ldb) ldb_debug_set(ldb, LDB_DEBUG_FATAL, "ldb out of memory at 
%s:%d\n", __FILE__, __LINE__)
+#define ldb_module_oom(module) ldb_oom(ldb_module_get_ctx(module))
 
 /* The following definitions come from lib/ldb/common/ldb.c  */
 
diff --git a/source4/lib/ldb/ldb_tdb/ldb_cache.c 
b/source4/lib/ldb/ldb_tdb/ldb_cache.c
index 2c39968..cd2249d 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_cache.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_cache.c
@@ -357,6 +357,8 @@ int ltdb_cache_load(struct ldb_module *module)
            ltdb->cache->attributes == NULL) {
                goto failed;
        }
+       ltdb->cache->one_level_indexes = false;
+       ltdb->cache->attribute_indexes = false;
            
        indexlist_dn = ldb_dn_new(module, ldb, LTDB_INDEXLIST);
        if (indexlist_dn == NULL) goto failed;
@@ -366,6 +368,13 @@ int ltdb_cache_load(struct ldb_module *module)
                goto failed;
        }
 
+       if (ldb_msg_find_element(ltdb->cache->indexlist, LTDB_IDXONE) != NULL) {
+               ltdb->cache->one_level_indexes = true;
+       }
+       if (ldb_msg_find_element(ltdb->cache->indexlist, LTDB_IDXATTR) != NULL) 
{
+               ltdb->cache->attribute_indexes = true;
+       }
+
        if (ltdb_attributes_load(module) == -1) {
                goto failed;
        }
diff --git a/source4/lib/ldb/ldb_tdb/ldb_index.c 
b/source4/lib/ldb/ldb_tdb/ldb_index.c
index b959471..0d560fe 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_index.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_index.c
@@ -1,7 +1,7 @@
 /*
    ldb database library
 
-   Copyright (C) Andrew Tridgell  2004
+   Copyright (C) Andrew Tridgell  2004-2009
 
      ** NOTE! The following LGPL license applies to the ldb
      ** library. This does NOT imply that all of Samba is released
@@ -32,398 +32,342 @@
  */
 
 #include "ldb_tdb.h"
-#include "dlinklist.h"
 
-/*
-  the idxptr code is a bit unusual. The way it works is to replace
-  @IDX elements in records during a transaction with @IDXPTR
-  elements. The @IDXPTR elements don't contain the actual index entry
-  values, but contain a pointer to a linked list of values.
-
-  This means we are storing pointers in a database, which is normally
-  not allowed, but in this case we are storing them only for the
-  duration of a transaction, and re-writing them into the normal @IDX
-  format at the end of the transaction. That means no other processes
-  are ever exposed to the @IDXPTR values.
-
-  The advantage is that the linked list doesn't cause huge
-  fragmentation during a transaction. Without the @IDXPTR method we
-  often ended up with a ldb that was between 10x and 100x larger then
-  it needs to be due to massive fragmentation caused by re-writing
-  @INDEX records many times during indexing.
- */
-struct ldb_index_pointer {
-       struct ldb_index_pointer *next, *prev;
-       struct ldb_val value;
+struct dn_list {
+       unsigned int count;
+       struct ldb_val *dn;
 };
 
 struct ltdb_idxptr {
-       int num_dns;
-       const char **dn_list;
+       struct tdb_context *itdb;
        bool repack;
+       int error;
 };
 
+/* we put a @IDXVERSION attribute on index entries. This
+   allows us to tell if it was written by an older version


-- 
Samba Shared Repository

Reply via email to