From 3cd11b5b755795c253a8214b4d1066b0589e3a7b Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Mon, 4 Apr 2011 10:43:39 +0200 Subject: ldb:ldb/common/ldb_modules.c - always use LDB error codes if possible The callers do compare against LDB error codes - hence don't give back "-1". Reviewed-by: Tridge + abartlet --- source4/lib/ldb/common/ldb_modules.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'source4/lib/ldb/common') diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c index d07666a674..2e1aeb616b 100644 --- a/source4/lib/ldb/common/ldb_modules.c +++ b/source4/lib/ldb/common/ldb_modules.c @@ -281,14 +281,15 @@ int ldb_register_module(const struct ldb_module_ops *ops) return LDB_ERR_ENTRY_ALREADY_EXISTS; entry = talloc(talloc_autofree_context(), struct ops_list_entry); - if (entry == NULL) - return -1; + if (entry == NULL) { + return LDB_ERR_OPERATIONS_ERROR; + } entry->ops = ops; entry->next = registered_modules; registered_modules = entry; - return 0; + return LDB_SUCCESS; } /* @@ -363,7 +364,7 @@ int ldb_load_modules(struct ldb_context *ldb, const char *options[]) int ret; TALLOC_CTX *mem_ctx = talloc_new(ldb); if (!mem_ctx) { - return LDB_ERR_OPERATIONS_ERROR; + return ldb_oom(ldb); } /* find out which modules we are requested to activate */ @@ -385,7 +386,7 @@ int ldb_load_modules(struct ldb_context *ldb, const char *options[]) mods_dn = ldb_dn_new(mem_ctx, ldb, "@MODULES"); if (mods_dn == NULL) { talloc_free(mem_ctx); - return -1; + return ldb_oom(ldb); } ret = ldb_search(ldb, mods_dn, &res, mods_dn, LDB_SCOPE_BASE, attrs, "@LIST=*"); @@ -403,7 +404,7 @@ int ldb_load_modules(struct ldb_context *ldb, const char *options[]) } else if (res->count > 1) { ldb_debug(ldb, LDB_DEBUG_FATAL, "Too many records found (%d), bailing out", res->count); talloc_free(mem_ctx); - return -1; + return LDB_ERR_OPERATIONS_ERROR; } else { module_list = ldb_msg_find_attr_as_string(res->msgs[0], "@LIST", NULL); if (!module_list) { -- cgit