diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-04-23 13:05:27 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:51:33 -0500 |
commit | 07882b5460121c4ed100f9655935501f7cf23856 (patch) | |
tree | f9ecc0c89adc7fbab7d295ee456cfade117f6448 /source4/lib/ldb/ldb_tdb/ldb_tdb.c | |
parent | b394a4c2ff4502a0bf2bf05a6c7036f708fdb090 (diff) | |
download | samba-07882b5460121c4ed100f9655935501f7cf23856.tar.gz samba-07882b5460121c4ed100f9655935501f7cf23856.tar.bz2 samba-07882b5460121c4ed100f9655935501f7cf23856.zip |
r343: added automatic reindexing of the database when the index list changes
(This used to be commit a811640ce408373a5c2c0ee2c125bd735d96d5e1)
Diffstat (limited to 'source4/lib/ldb/ldb_tdb/ldb_tdb.c')
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_tdb.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c index b28d73cbea..34cff41794 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c @@ -148,6 +148,10 @@ static int ltdb_add(struct ldb_context *ldb, const struct ldb_message *msg) ret = ltdb_store(ldb, msg, TDB_INSERT); + if (strcmp(msg->dn, "@INDEXLIST") == 0) { + ltdb_reindex(ldb); + } + ltdb_unlock(ldb); return ret; @@ -206,6 +210,10 @@ static int ltdb_delete(struct ldb_context *ldb, const char *dn) ltdb_search_dn1_free(ldb, &msg); + if (strcmp(dn, "@INDEXLIST") == 0) { + ltdb_reindex(ldb); + } + ltdb_unlock(ldb); return ret; @@ -430,6 +438,10 @@ static int ltdb_modify(struct ldb_context *ldb, const struct ldb_message *msg) /* we've made all the mods - save the modified record back into the database */ ret = ltdb_store(ldb, &msg2, TDB_MODIFY); + if (strcmp(msg2.dn, "@INDEXLIST") == 0) { + ltdb_reindex(ldb); + } + free(tdb_key.dptr); free(tdb_data.dptr); ltdb_unpack_data_free(&msg2); |