diff options
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/ldb/common/ldb.c | 12 | ||||
-rw-r--r-- | source4/lib/ldb/common/ldb_modules.c | 8 | ||||
-rw-r--r-- | source4/lib/ldb/include/ldb.h | 8 | ||||
-rw-r--r-- | source4/lib/ldb/include/ldb_private.h | 2 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_ldap/ldb_ldap.c | 13 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_search.c | 14 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_tdb.c | 1 | ||||
-rw-r--r-- | source4/lib/ldb/ldb_tdb/ldb_tdb.h | 1 | ||||
-rw-r--r-- | source4/lib/ldb/man/man3/ldb.yo | 2 | ||||
-rw-r--r-- | source4/lib/ldb/modules/schema.c | 9 | ||||
-rw-r--r-- | source4/lib/ldb/modules/skel.c | 7 | ||||
-rw-r--r-- | source4/lib/ldb/modules/timestamps.c | 7 | ||||
-rw-r--r-- | source4/lib/ldb/tools/ldbdel.c | 2 | ||||
-rw-r--r-- | source4/lib/ldb/tools/ldbedit.c | 4 | ||||
-rw-r--r-- | source4/lib/ldb/tools/ldbsearch.c | 4 | ||||
-rw-r--r-- | source4/lib/ldb/tools/ldbtest.c | 2 | ||||
-rw-r--r-- | source4/lib/registry/reg_backend_ldb.c | 6 |
17 files changed, 16 insertions, 86 deletions
diff --git a/source4/lib/ldb/common/ldb.c b/source4/lib/ldb/common/ldb.c index 40616c5963..600c7063f0 100644 --- a/source4/lib/ldb/common/ldb.c +++ b/source4/lib/ldb/common/ldb.c @@ -81,6 +81,9 @@ struct ldb_context *ldb_connect(const char *url, unsigned int flags, search the database given a LDAP-like search expression return the number of records found, or -1 on error + + Use talloc_free to free the ldb_message returned in 'res' + */ int ldb_search(struct ldb_context *ldb, const char *base, @@ -91,15 +94,6 @@ int ldb_search(struct ldb_context *ldb, return ldb->modules->ops->search(ldb->modules, base, scope, expression, attrs, res); } -/* - free a set of messages returned by ldb_search -*/ -int ldb_search_free(struct ldb_context *ldb, struct ldb_message **msgs) -{ - return ldb->modules->ops->search_free(ldb->modules, msgs); -} - - /* add a record to the database. Will fail if a record with the given class and key already exists diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c index ffa150d773..644154d645 100644 --- a/source4/lib/ldb/common/ldb_modules.c +++ b/source4/lib/ldb/common/ldb_modules.c @@ -224,14 +224,6 @@ int ldb_next_search(struct ldb_module *module, return module->next->ops->search(module->next, base, scope, expression, attrs, res); } -int ldb_next_search_free(struct ldb_module *module, struct ldb_message **msg) -{ - if (!module->next) { - return -1; - } - return module->next->ops->search_free(module->next, msg); -} - int ldb_next_add_record(struct ldb_module *module, const struct ldb_message *message) { if (!module->next) { diff --git a/source4/lib/ldb/include/ldb.h b/source4/lib/ldb/include/ldb.h index 0eb661d7ce..f748bb6b42 100644 --- a/source4/lib/ldb/include/ldb.h +++ b/source4/lib/ldb/include/ldb.h @@ -162,6 +162,8 @@ struct ldb_context *ldb_connect(const char *url, unsigned int flags, search the database given a LDAP-like search expression return the number of records found, or -1 on error + + use talloc_free to free the ldb_message returned */ int ldb_search(struct ldb_context *ldb, const char *base, @@ -169,12 +171,6 @@ int ldb_search(struct ldb_context *ldb, const char *expression, const char * const *attrs, struct ldb_message ***res); -/* - free a set of messages returned by ldb_search -*/ -int ldb_search_free(struct ldb_context *ldb, struct ldb_message **msgs); - - /* add a record to the database. Will fail if a record with the given class and key already exists diff --git a/source4/lib/ldb/include/ldb_private.h b/source4/lib/ldb/include/ldb_private.h index a370a80299..7a0b2fef75 100644 --- a/source4/lib/ldb/include/ldb_private.h +++ b/source4/lib/ldb/include/ldb_private.h @@ -57,7 +57,6 @@ struct ldb_module_ops { const char *name; int (*search)(struct ldb_module *, const char *, enum ldb_scope, const char *, const char * const [], struct ldb_message ***); - int (*search_free)(struct ldb_module *, struct ldb_message **); int (*add_record)(struct ldb_module *, const struct ldb_message *); int (*modify_record)(struct ldb_module *, const struct ldb_message *); int (*delete_record)(struct ldb_module *, const char *); @@ -89,7 +88,6 @@ int ldb_next_search(struct ldb_module *module, enum ldb_scope scope, const char *expression, const char * const *attrs, struct ldb_message ***res); -int ldb_next_search_free(struct ldb_module *module, struct ldb_message **msg); int ldb_next_add_record(struct ldb_module *module, const struct ldb_message *message); int ldb_next_modify_record(struct ldb_module *module, const struct ldb_message *message); int ldb_next_delete_record(struct ldb_module *module, const char *dn); diff --git a/source4/lib/ldb/ldb_ldap/ldb_ldap.c b/source4/lib/ldb/ldb_ldap/ldb_ldap.c index dc392dd56b..c62c1b9e56 100644 --- a/source4/lib/ldb/ldb_ldap/ldb_ldap.c +++ b/source4/lib/ldb/ldb_ldap/ldb_ldap.c @@ -126,16 +126,6 @@ static int lldb_delete(struct ldb_module *module, const char *dn) } /* - free a search result -*/ -static int lldb_search_free(struct ldb_module *module, struct ldb_message **res) -{ - talloc_free(res); - return 0; -} - - -/* add a single set of ldap message values to a ldb_message */ static int lldb_add_msg_attr(struct ldb_context *ldb, @@ -290,7 +280,7 @@ static int lldb_search(struct ldb_module *module, const char *base, return msg_count; failed: - if (*res) lldb_search_free(module, *res); + if (*res) talloc_free(*res); return -1; } @@ -459,7 +449,6 @@ static const char *lldb_errstring(struct ldb_module *module) static const struct ldb_module_ops lldb_ops = { "ldap", lldb_search, - lldb_search_free, lldb_add, lldb_modify, lldb_delete, diff --git a/source4/lib/ldb/ldb_tdb/ldb_search.c b/source4/lib/ldb/ldb_tdb/ldb_search.c index f813841edb..4f45fdf376 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_search.c +++ b/source4/lib/ldb/ldb_tdb/ldb_search.c @@ -416,20 +416,6 @@ static int search_func(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, voi /* - free a set of search results -*/ -int ltdb_search_free(struct ldb_module *module, struct ldb_message **msgs) -{ - struct ltdb_private *ltdb = module->private_data; - - ltdb->last_err_string = NULL; - - talloc_free(msgs); - - return 0; -} - -/* search the database with a LDAP-like expression. this is the "full search" non-indexed variant */ diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c index 204eaf9d3c..87582cf4eb 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c @@ -797,7 +797,6 @@ static const char *ltdb_errstring(struct ldb_module *module) static const struct ldb_module_ops ltdb_ops = { "tdb", ltdb_search, - ltdb_search_free, ltdb_add, ltdb_modify, ltdb_delete, diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.h b/source4/lib/ldb/ldb_tdb/ldb_tdb.h index 4c2fc52f7c..9fb60b6359 100644 --- a/source4/lib/ldb/ldb_tdb/ldb_tdb.h +++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.h @@ -95,7 +95,6 @@ int ltdb_add_attr_results(struct ldb_module *module, struct ldb_message *msg, const char * const attrs[], int *count, struct ldb_message ***res); -int ltdb_search_free(struct ldb_module *module, struct ldb_message **msgs); int ltdb_search(struct ldb_module *module, const char *base, enum ldb_scope scope, const char *expression, const char * const attrs[], struct ldb_message ***res); diff --git a/source4/lib/ldb/man/man3/ldb.yo b/source4/lib/ldb/man/man3/ldb.yo index 8d7a60ccf2..c2c7e1b872 100644 --- a/source4/lib/ldb/man/man3/ldb.yo +++ b/source4/lib/ldb/man/man3/ldb.yo @@ -66,8 +66,6 @@ dit(bf(ldb_connect(3))) connect to a ldb backend dit(bf(ldb_search(3))) perform a database search -dit(bf(ldb_search_free(3))) free the results of a ldb_search - dit(bf(ldb_add(3))) add a record to the database dit(bf(ldb_delete(3))) delete a record from the database diff --git a/source4/lib/ldb/modules/schema.c b/source4/lib/ldb/modules/schema.c index 4502bba9ed..29e5194416 100644 --- a/source4/lib/ldb/modules/schema.c +++ b/source4/lib/ldb/modules/schema.c @@ -166,7 +166,7 @@ static int get_entry_attributes(struct ldb_context *ldb, const char *dn, struct /* set flags to 0 as flags on search have undefined values */ ret = get_msg_attributes(ss, *srch, 0); if (ret != 0) { - ldb_search_free(ldb, srch); + talloc_free(srch); return ret; } @@ -306,12 +306,6 @@ static int schema_search(struct ldb_module *module, const char *base, return ldb_next_search(module, base, scope, expression, attrs, res); } -/* search_free */ -static int schema_search_free(struct ldb_module *module, struct ldb_message **res) -{ - return ldb_next_search_free(module, res); -} - /* add_record */ static int schema_add_record(struct ldb_module *module, const struct ldb_message *msg) { @@ -549,7 +543,6 @@ static int schema_destructor(void *module_ctx) static const struct ldb_module_ops schema_ops = { "schema", schema_search, - schema_search_free, schema_add_record, schema_modify_record, schema_delete_record, diff --git a/source4/lib/ldb/modules/skel.c b/source4/lib/ldb/modules/skel.c index 882a776819..09f2452365 100644 --- a/source4/lib/ldb/modules/skel.c +++ b/source4/lib/ldb/modules/skel.c @@ -44,12 +44,6 @@ static int skel_search(struct ldb_module *module, const char *base, return ldb_next_search(module, base, scope, expression, attrs, res); } -/* search_free */ -static int skel_search_free(struct ldb_module *module, struct ldb_message **res) -{ - return ldb_next_search_free(module, res); -} - /* add_record */ static int skel_add_record(struct ldb_module *module, const struct ldb_message *msg) { @@ -102,7 +96,6 @@ static int skel_destructor(void *module_ctx) static const struct ldb_module_ops skel_ops = { "skel", skel_search, - skel_search_free, skel_add_record, skel_modify_record, skel_delete_record, diff --git a/source4/lib/ldb/modules/timestamps.c b/source4/lib/ldb/modules/timestamps.c index c472fc3c55..1c01bd14fd 100644 --- a/source4/lib/ldb/modules/timestamps.c +++ b/source4/lib/ldb/modules/timestamps.c @@ -49,12 +49,6 @@ static int timestamps_search(struct ldb_module *module, const char *base, return ldb_next_search(module, base, scope, expression, attrs, res); } -static int timestamps_search_free(struct ldb_module *module, struct ldb_message **res) -{ - ldb_debug(module->ldb, LDB_DEBUG_TRACE, "timestamps_search_free\n"); - return ldb_next_search_free(module, res); -} - static int add_time_element(struct ldb_module *module, struct ldb_message *msg, const char *attr_name, const char *time_string, unsigned int flags) { @@ -255,7 +249,6 @@ static int timestamps_destructor(void *module_ctx) static const struct ldb_module_ops timestamps_ops = { "timestamps", timestamps_search, - timestamps_search_free, timestamps_add_record, timestamps_modify_record, timestamps_delete_record, diff --git a/source4/lib/ldb/tools/ldbdel.c b/source4/lib/ldb/tools/ldbdel.c index 72540db07a..ec2e302b20 100644 --- a/source4/lib/ldb/tools/ldbdel.c +++ b/source4/lib/ldb/tools/ldbdel.c @@ -55,7 +55,7 @@ static int ldb_delete_recursive(struct ldb_context *ldb, const char *dn) } } - ldb_search_free(ldb, res); + talloc_free(res); if (total == 0) { return -1; diff --git a/source4/lib/ldb/tools/ldbedit.c b/source4/lib/ldb/tools/ldbedit.c index b9f82c282a..4c41b6b19a 100644 --- a/source4/lib/ldb/tools/ldbedit.c +++ b/source4/lib/ldb/tools/ldbedit.c @@ -427,9 +427,9 @@ static void usage(void) do_edit(ldb, msgs, ret, editor); if (ret > 0) { - ret = ldb_search_free(ldb, msgs); + ret = talloc_free(msgs); if (ret == -1) { - fprintf(stderr, "search_free failed - %s\n", ldb_errstring(ldb)); + fprintf(stderr, "talloc_free failed\n"); exit(1); } } diff --git a/source4/lib/ldb/tools/ldbsearch.c b/source4/lib/ldb/tools/ldbsearch.c index 8d435e7661..3e6e7d7feb 100644 --- a/source4/lib/ldb/tools/ldbsearch.c +++ b/source4/lib/ldb/tools/ldbsearch.c @@ -81,9 +81,9 @@ static int do_search(struct ldb_context *ldb, } if (ret > 0) { - ret = ldb_search_free(ldb, msgs); + ret = talloc_free(msgs); if (ret == -1) { - fprintf(stderr, "search_free failed\n"); + fprintf(stderr, "talloc_free failed\n"); exit(1); } } diff --git a/source4/lib/ldb/tools/ldbtest.c b/source4/lib/ldb/tools/ldbtest.c index 86f39d4606..fc1f3e3098 100644 --- a/source4/lib/ldb/tools/ldbtest.c +++ b/source4/lib/ldb/tools/ldbtest.c @@ -248,7 +248,7 @@ static void search_uid(struct ldb_context *ldb, int nrecords, int nsearches) } if (ret > 0) { - ldb_search_free(ldb, res); + talloc_free(res); } printf("testing uid %d/%d - %d \r", i, uid, ret); diff --git a/source4/lib/registry/reg_backend_ldb.c b/source4/lib/registry/reg_backend_ldb.c index 7e63b14245..fc01de61a5 100644 --- a/source4/lib/registry/reg_backend_ldb.c +++ b/source4/lib/registry/reg_backend_ldb.c @@ -102,12 +102,12 @@ static int reg_close_ldb_key (void *data) struct ldb_context *c = key->hive->backend_data; if (kd->subkeys) { - ldb_search_free(c, kd->subkeys); + talloc_free(kd->subkeys); kd->subkeys = NULL; } if (kd->values) { - ldb_search_free(c, kd->values); + talloc_free(kd->values); kd->values = NULL; } return 0; @@ -224,7 +224,7 @@ static WERROR ldb_open_key(TALLOC_CTX *mem_ctx, struct registry_key *h, const ch (*key)->backend_data = newkd = talloc_zero(*key, struct ldb_key_data); newkd->dn = talloc_strdup(mem_ctx, msg[0]->dn); - ldb_search_free(c, msg); + talloc_free(msg); return WERR_OK; } |