s4-ldb: don't try to index non-indexed attributes
authorAndrew Tridgell <tridge@samba.org>
Thu, 22 Oct 2009 01:29:35 +0000 (12:29 +1100)
committerAndrew Tridgell <tridge@samba.org>
Thu, 22 Oct 2009 01:47:55 +0000 (12:47 +1100)
source4/lib/ldb/ldb_tdb/ldb_index.c

index a04fb1a8bd2416f1ebbee435a5b70111d0a0ea96..a28e97256fcdc2979f22a3d94da10b4770f7791b 100644 (file)
@@ -1223,9 +1223,13 @@ static int ltdb_index_onelevel(struct ldb_module *module, const struct ldb_messa
 int ltdb_index_add_element(struct ldb_module *module, struct ldb_dn *dn, 
                           struct ldb_message_element *el)
 {
+       struct ltdb_private *ltdb = talloc_get_type(ldb_module_get_private(module), struct ltdb_private);
        if (ldb_dn_is_special(dn)) {
                return LDB_SUCCESS;
        }
+       if (!ltdb_is_indexed(ltdb->cache->indexlist, el->name)) {
+               return LDB_SUCCESS;
+       }
        return ltdb_index_add_el(module, ldb_dn_get_linearized(dn), el);
 }