summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/ldb_tdb
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2008-09-09 17:36:14 +0200
committerJelmer Vernooij <jelmer@samba.org>2008-09-24 19:40:03 +0200
commit9261fa997ccda8f89556b644ddd45cd86919ec2e (patch)
tree7a1d0176a2c339b202d544314575b70d136e6ec8 /source4/lib/ldb/ldb_tdb
parentcf1935817fce0d6c7f4d2797c18f8c116220abd4 (diff)
downloadsamba-9261fa997ccda8f89556b644ddd45cd86919ec2e.tar.gz
samba-9261fa997ccda8f89556b644ddd45cd86919ec2e.tar.bz2
samba-9261fa997ccda8f89556b644ddd45cd86919ec2e.zip
Cosmetic corrections for the LDB backend modules
This commit applies some cosmetic corrections for the LDB backend modules.
Diffstat (limited to 'source4/lib/ldb/ldb_tdb')
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_cache.c22
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_pack.c12
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_search.c42
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_tdb.c20
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c2
5 files changed, 49 insertions, 49 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_cache.c b/source4/lib/ldb/ldb_tdb/ldb_cache.c
index 2576e2c7bd..e502f1e642 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_cache.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_cache.c
@@ -92,11 +92,11 @@ static int ltdb_attributes_flags(struct ldb_message_element *el, unsigned *v)
}
}
if (ltdb_valid_attr_flags[j].name == NULL) {
- return -1;
+ return LDB_ERR_OPERATIONS_ERROR;
}
}
*v = value;
- return 0;
+ return LDB_SUCCESS;
}
/*
@@ -118,7 +118,7 @@ static int ltdb_attributes_load(struct ldb_module *module)
goto failed;
}
if (r == LDB_ERR_NO_SUCH_OBJECT) {
- return 0;
+ return LDB_SUCCESS;
}
/* mapping these flags onto ldap 'syntaxes' isn't strictly correct,
but its close enough for now */
@@ -162,9 +162,9 @@ static int ltdb_attributes_load(struct ldb_module *module)
}
}
- return 0;
+ return LDB_SUCCESS;
failed:
- return -1;
+ return LDB_ERR_OPERATIONS_ERROR;
}
@@ -258,7 +258,7 @@ int ltdb_cache_load(struct ldb_module *module)
/* a very fast check to avoid extra database reads */
if (ltdb->cache != NULL &&
tdb_get_seqnum(ltdb->tdb) == ltdb->tdb_seqnum) {
- return 0;
+ return LDB_SUCCESS;
}
if (ltdb->cache == NULL) {
@@ -344,7 +344,7 @@ int ltdb_cache_load(struct ldb_module *module)
goto failed;
}
- if (ltdb_attributes_load(module) == -1) {
+ if (ltdb_attributes_load(module) != LDB_SUCCESS) {
goto failed;
}
@@ -353,14 +353,14 @@ done:
talloc_free(baseinfo);
talloc_free(baseinfo_dn);
talloc_free(indexlist_dn);
- return 0;
+ return LDB_SUCCESS;
failed:
talloc_free(options);
talloc_free(baseinfo);
talloc_free(baseinfo_dn);
talloc_free(indexlist_dn);
- return -1;
+ return LDB_ERR_OPERATIONS_ERROR;
}
@@ -449,10 +449,10 @@ int ltdb_check_at_attributes_values(const struct ldb_val *value)
for (i = 0; ltdb_valid_attr_flags[i].name != NULL; i++) {
if ((strcmp(ltdb_valid_attr_flags[i].name, (char *)value->data) == 0)) {
- return 0;
+ return LDB_SUCCESS;
}
}
- return -1;
+ return LDB_ERR_OPERATIONS_ERROR;
}
diff --git a/source4/lib/ldb/ldb_tdb/ldb_pack.c b/source4/lib/ldb/ldb_tdb/ldb_pack.c
index afb07dcbca..d96e7590e7 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_pack.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_pack.c
@@ -89,7 +89,7 @@ int ltdb_pack_data(struct ldb_module *module,
dn = ldb_dn_get_linearized(message->dn);
if (dn == NULL) {
errno = ENOMEM;
- return -1;
+ return LDB_ERR_OPERATIONS_ERROR;
}
/* work out how big it needs to be */
@@ -114,7 +114,7 @@ int ltdb_pack_data(struct ldb_module *module,
data->dptr = talloc_array(ldb, uint8_t, size);
if (!data->dptr) {
errno = ENOMEM;
- return -1;
+ return LDB_ERR_OPERATIONS_ERROR;
}
data->dsize = size;
@@ -147,7 +147,7 @@ int ltdb_pack_data(struct ldb_module *module,
}
}
- return 0;
+ return LDB_SUCCESS;
}
/*
@@ -207,7 +207,7 @@ int ltdb_unpack_data(struct ldb_module *module,
if (message->num_elements == 0) {
message->elements = NULL;
- return 0;
+ return LDB_SUCCESS;
}
if (message->num_elements > remaining / 6) {
@@ -281,9 +281,9 @@ int ltdb_unpack_data(struct ldb_module *module,
"Error: %d bytes unread in ltdb_unpack_data\n", remaining);
}
- return 0;
+ return LDB_SUCCESS;
failed:
talloc_free(message->elements);
- return -1;
+ return LDB_ERR_OPERATIONS_ERROR;
}
diff --git a/source4/lib/ldb/ldb_tdb/ldb_search.c b/source4/lib/ldb/ldb_tdb/ldb_search.c
index da899c361e..ce7a90e3d5 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_search.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_search.c
@@ -262,7 +262,7 @@ int ltdb_search_dn1(struct ldb_module *module, struct ldb_dn *dn, struct ldb_mes
ret = ltdb_unpack_data(module, &tdb_data, msg);
free(tdb_data.dptr);
- if (ret == -1) {
+ if (ret != LDB_SUCCESS) {
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -285,7 +285,7 @@ static int ltdb_lock_read(struct ldb_module *module)
if (ltdb->in_transaction == 0) {
return tdb_lockall_read(ltdb->tdb);
}
- return 0;
+ return LDB_SUCCESS;
}
/*
@@ -297,7 +297,7 @@ static int ltdb_unlock_read(struct ldb_module *module)
if (ltdb->in_transaction == 0) {
return tdb_unlockall_read(ltdb->tdb);
}
- return 0;
+ return LDB_SUCCESS;
}
/*
@@ -317,14 +317,14 @@ int ltdb_add_attr_results(struct ldb_module *module,
/* pull the attributes that the user wants */
msg2 = ltdb_pull_attrs(module, mem_ctx, msg, attrs);
if (!msg2) {
- return -1;
+ return LDB_ERR_OPERATIONS_ERROR;
}
/* add to the results list */
res2 = talloc_realloc(mem_ctx, *res, struct ldb_message *, (*count)+2);
if (!res2) {
talloc_free(msg2);
- return -1;
+ return LDB_ERR_OPERATIONS_ERROR;
}
(*res) = res2;
@@ -333,7 +333,7 @@ int ltdb_add_attr_results(struct ldb_module *module,
(*res)[(*count)+1] = NULL;
(*count)++;
- return 0;
+ return LDB_SUCCESS;
}
@@ -356,7 +356,7 @@ int ltdb_filter_attrs(struct ldb_message *msg, const char * const *attrs)
if (ldb_attr_cmp(attrs[i], "distinguishedName") == 0) {
if (msg_add_distinguished_name(msg) != 0) {
- return -1;
+ return LDB_ERR_OPERATIONS_ERROR;
}
}
}
@@ -366,9 +366,9 @@ int ltdb_filter_attrs(struct ldb_message *msg, const char * const *attrs)
if (keep_all) {
if (msg_add_distinguished_name(msg) != 0) {
- return -1;
+ return LDB_ERR_OPERATIONS_ERROR;
}
- return 0;
+ return LDB_SUCCESS;
}
for (i = 0; i < msg->num_elements; i++) {
@@ -387,7 +387,7 @@ int ltdb_filter_attrs(struct ldb_message *msg, const char * const *attrs)
}
}
- return 0;
+ return LDB_SUCCESS;
}
/*
@@ -402,14 +402,14 @@ static int search_func(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, voi
if (key.dsize < 4 ||
strncmp((char *)key.dptr, "DN=", 3) != 0) {
- return 0;
+ return LDB_SUCCESS;
}
ares = talloc_zero(ac, struct ldb_reply);
if (!ares) {
handle->status = LDB_ERR_OPERATIONS_ERROR;
handle->state = LDB_ASYNC_DONE;
- return -1;
+ return LDB_ERR_OPERATIONS_ERROR;
}
ares->message = ldb_msg_new(ares);
@@ -417,14 +417,14 @@ static int search_func(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, voi
handle->status = LDB_ERR_OPERATIONS_ERROR;
handle->state = LDB_ASYNC_DONE;
talloc_free(ares);
- return -1;
+ return LDB_ERR_OPERATIONS_ERROR;
}
/* unpack the record */
ret = ltdb_unpack_data(ac->module, &data, ares->message);
- if (ret == -1) {
+ if (ret) {
talloc_free(ares);
- return -1;
+ return LDB_ERR_OPERATIONS_ERROR;
}
if (!ares->message->dn) {
@@ -433,7 +433,7 @@ static int search_func(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, voi
handle->status = LDB_ERR_OPERATIONS_ERROR;
handle->state = LDB_ASYNC_DONE;
talloc_free(ares);
- return -1;
+ return LDB_ERR_OPERATIONS_ERROR;
}
}
@@ -441,17 +441,17 @@ static int search_func(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, voi
if (!ldb_match_msg(ac->module->ldb, ares->message, ac->tree,
ac->base, ac->scope)) {
talloc_free(ares);
- return 0;
+ return LDB_SUCCESS;
}
/* filter the attributes that the user wants */
ret = ltdb_filter_attrs(ares->message, ac->attrs);
- if (ret == -1) {
+ if (ret != LDB_SUCCESS) {
handle->status = LDB_ERR_OPERATIONS_ERROR;
handle->state = LDB_ASYNC_DONE;
talloc_free(ares);
- return -1;
+ return LDB_ERR_OPERATIONS_ERROR;
}
ares->type = LDB_REPLY_ENTRY;
@@ -460,10 +460,10 @@ static int search_func(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, voi
if (handle->status != LDB_SUCCESS) {
/* don't try to free ares here, the callback is in charge of that */
- return -1;
+ return LDB_ERR_OPERATIONS_ERROR;
}
- return 0;
+ return LDB_SUCCESS;
}
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
index 01d570c89a..b711efd1fa 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -174,7 +174,7 @@ int ltdb_check_special_dn(struct ldb_module *module,
if (! ldb_dn_is_special(msg->dn) ||
! ldb_dn_check_special(msg->dn, LTDB_ATTRIBUTES)) {
- return 0;
+ return LDB_SUCCESS;
}
/* we have @ATTRIBUTES, let's check attributes are fine */
@@ -188,7 +188,7 @@ int ltdb_check_special_dn(struct ldb_module *module,
}
}
- return 0;
+ return LDB_SUCCESS;
}
@@ -231,7 +231,7 @@ int ltdb_store(struct ldb_module *module, const struct ldb_message *msg, int flg
}
ret = ltdb_pack_data(module, msg, &tdb_data);
- if (ret == -1) {
+ if (ret != LDB_SUCCESS) {
talloc_free(tdb_key.dptr);
return LDB_ERR_OTHER;
}
@@ -626,7 +626,7 @@ int ltdb_modify_internal(struct ldb_module *module,
}
ret = ltdb_unpack_data(module, &tdb_data, msg2);
- if (ret == -1) {
+ if (ret != LDB_SUCCESS) {
ret = LDB_ERR_OTHER;
goto failed;
}
@@ -1069,7 +1069,7 @@ static int ltdb_connect(struct ldb_context *ldb, const char *url,
if (strncmp(url, "tdb://", 6) != 0) {
ldb_debug(ldb, LDB_DEBUG_ERROR,
"Invalid tdb URL '%s'", url);
- return -1;
+ return LDB_ERR_OPERATIONS_ERROR;
}
path = url+6;
} else {
@@ -1097,7 +1097,7 @@ static int ltdb_connect(struct ldb_context *ldb, const char *url,
ltdb = talloc_zero(ldb, struct ltdb_private);
if (!ltdb) {
ldb_oom(ldb);
- return -1;
+ return LDB_ERR_OPERATIONS_ERROR;
}
/* note that we use quite a large default hash size */
@@ -1108,7 +1108,7 @@ static int ltdb_connect(struct ldb_context *ldb, const char *url,
ldb_debug(ldb, LDB_DEBUG_ERROR,
"Unable to open tdb '%s'\n", path);
talloc_free(ltdb);
- return -1;
+ return LDB_ERR_OPERATIONS_ERROR;
}
ltdb->sequence_number = 0;
@@ -1117,7 +1117,7 @@ static int ltdb_connect(struct ldb_context *ldb, const char *url,
if (!module) {
ldb_oom(ldb);
talloc_free(ltdb);
- return -1;
+ return LDB_ERR_OPERATIONS_ERROR;
}
talloc_set_name_const(*module, "ldb_tdb backend");
(*module)->ldb = ldb;
@@ -1128,10 +1128,10 @@ static int ltdb_connect(struct ldb_context *ldb, const char *url,
if (ltdb_cache_load(*module) != 0) {
talloc_free(*module);
talloc_free(ltdb);
- return -1;
+ return LDB_ERR_OPERATIONS_ERROR;
}
- return 0;
+ return LDB_SUCCESS;
}
const struct ldb_backend_ops ldb_tdb_backend_ops = {
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c b/source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c
index 4fea43c8c8..9d856355be 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c
@@ -53,7 +53,7 @@ static int ltdb_wrap_destructor(struct ltdb_wrap *w)
if (w == tdb_list) {
tdb_list = w->next;
}
- return 0;
+ return LDB_SUCCESS;
}
static void ltdb_log_fn(struct tdb_context *tdb, enum tdb_debug_level level, const char *fmt, ...) PRINTF_ATTRIBUTE(3, 4);