diff options
author | Matthias Dieter Wallnöfer <mdw@samba.org> | 2011-04-04 10:43:39 +0200 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mdw@samba.org> | 2011-04-07 15:53:20 +0200 |
commit | 3cd11b5b755795c253a8214b4d1066b0589e3a7b (patch) | |
tree | 0c69af5143daec89edc95742bc7f3e8bbe63a8ef /source4/lib | |
parent | 32cad7601a55b2c232c4914ab382714f331ae218 (diff) | |
download | samba-3cd11b5b755795c253a8214b4d1066b0589e3a7b.tar.gz samba-3cd11b5b755795c253a8214b4d1066b0589e3a7b.tar.bz2 samba-3cd11b5b755795c253a8214b4d1066b0589e3a7b.zip |
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
Diffstat (limited to 'source4/lib')
-rw-r--r-- | source4/lib/ldb/common/ldb_modules.c | 13 |
1 files changed, 7 insertions, 6 deletions
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) { |