diff options
author | Andrew Tridgell <tridge@samba.org> | 2009-09-15 10:00:24 -0700 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2009-09-15 18:45:42 -0700 |
commit | 12f689eef4394e8c2cf8efdded06d5b398d6e0a7 (patch) | |
tree | c22532523c885e74042c46d596d5dcdf3bb7e6cf /source4/lib/ldb/ldb_tdb/ldb_pack.c | |
parent | 00fb6705ffc937617e11c6da33b39bad7dda2ac3 (diff) | |
download | samba-12f689eef4394e8c2cf8efdded06d5b398d6e0a7.tar.gz samba-12f689eef4394e8c2cf8efdded06d5b398d6e0a7.tar.bz2 samba-12f689eef4394e8c2cf8efdded06d5b398d6e0a7.zip |
s4-ldb: cope better with corruption of tdb records
When doing an indexed search if we hit a corrupt record we abandoned
the indexed search and did a full search. The problem was that we
might have sent some records to the caller already, which means the
caller ended up with duplicate records. Fix this by returning a search
error if indexing returns an error and we have given any records to
the caller.
Diffstat (limited to 'source4/lib/ldb/ldb_tdb/ldb_pack.c')
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_pack.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_pack.c b/source4/lib/ldb/ldb_tdb/ldb_pack.c index 5640e7053c..e7aeb47e72 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_pack.c +++ b/source4/lib/ldb/ldb_tdb/ldb_pack.c @@ -236,6 +236,10 @@ int ltdb_unpack_data(struct ldb_module *module, errno = EIO; goto failed; } + if (len == 0) { + errno = EIO; + goto failed; + } message->elements[i].flags = 0; message->elements[i].name = talloc_strndup(message->elements, (char *)p, len); if (message->elements[i].name == NULL) { |