summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/dsdb/samdb/ldb_modules/kludge_acl.c4
-rw-r--r--source4/dsdb/samdb/ldb_modules/proxy.c12
-rw-r--r--source4/dsdb/samdb/ldb_modules/repl_meta_data.c14
-rw-r--r--source4/dsdb/samdb/ldb_modules/schema_fsmo.c2
-rw-r--r--source4/lib/ldb-samba/ldif_handlers.c2
-rw-r--r--source4/lib/ldb/common/attrib_handlers.c22
-rw-r--r--source4/lib/ldb/common/ldb_attributes.c8
-rw-r--r--source4/lib/ldb/common/ldb_debug.c2
-rw-r--r--source4/lib/ldb/common/ldb_ldif.c18
-rw-r--r--source4/lib/ldb/common/ldb_modules.c6
-rw-r--r--source4/lib/ldb/ldb_ildap/ldb_ildap.c6
-rw-r--r--source4/lib/ldb/ldb_ldap/ldb_ldap.c18
-rw-r--r--source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c28
-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
-rw-r--r--source4/lib/ldb/modules/operational.c4
-rw-r--r--source4/lib/ldb/modules/paged_results.c2
-rw-r--r--source4/lib/ldb/modules/skel.c2
-rw-r--r--source4/lib/ldb_wrap.c2
22 files changed, 125 insertions, 125 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/kludge_acl.c b/source4/dsdb/samdb/ldb_modules/kludge_acl.c
index 11e2b7ade9..6836f95873 100644
--- a/source4/dsdb/samdb/ldb_modules/kludge_acl.c
+++ b/source4/dsdb/samdb/ldb_modules/kludge_acl.c
@@ -142,7 +142,7 @@ static int kludge_acl_allowedAttributes(struct ldb_context *ldb, struct ldb_mess
ldb_msg_add_string(msg, attrName, attr_list[i]);
}
talloc_free(mem_ctx);
- return LDB_SUCCESS;
+ return 0;
}
/* read all objectClasses */
@@ -201,7 +201,7 @@ static int kludge_acl_childClasses(struct ldb_context *ldb, struct ldb_message *
}
}
- return LDB_SUCCESS;
+ return 0;
}
diff --git a/source4/dsdb/samdb/ldb_modules/proxy.c b/source4/dsdb/samdb/ldb_modules/proxy.c
index 7aa78e98a9..d0a315e45a 100644
--- a/source4/dsdb/samdb/ldb_modules/proxy.c
+++ b/source4/dsdb/samdb/ldb_modules/proxy.c
@@ -66,7 +66,7 @@ static int load_proxy_info(struct ldb_module *module)
/* see if we have already loaded it */
if (proxy->upstream != NULL) {
- return LDB_SUCCESS;
+ return 0;
}
dn = ldb_dn_new(proxy, module->ldb, "@PROXYINFO");
@@ -145,7 +145,7 @@ static int load_proxy_info(struct ldb_module *module)
talloc_free(res);
- return LDB_SUCCESS;
+ return 0;
failed:
talloc_free(res);
@@ -153,7 +153,7 @@ failed:
talloc_free(proxy->newdn);
talloc_free(proxy->upstream);
proxy->upstream = NULL;
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
@@ -259,7 +259,7 @@ static int proxy_search_bytree(struct ldb_module *module, struct ldb_request *re
}
if (load_proxy_info(module) != 0) {
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
/* see if the dn is within olddn */
@@ -269,7 +269,7 @@ static int proxy_search_bytree(struct ldb_module *module, struct ldb_request *re
newreq = talloc(module, struct ldb_request);
if (newreq == NULL) {
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
newreq->op.search.tree = proxy_convert_tree(module, req->op.search.tree);
@@ -298,7 +298,7 @@ static int proxy_search_bytree(struct ldb_module *module, struct ldb_request *re
if (ret != LDB_SUCCESS) {
ldb_set_errstring(module->ldb, ldb_errstring(proxy->upstream));
talloc_free(newreq);
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
for (i = 0; i < newreq->op.search.res->count; i++) {
diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
index 34e235aec7..dd5faf837a 100644
--- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
+++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
@@ -124,16 +124,16 @@ static int add_time_element(struct ldb_message *msg, const char *attr, time_t t)
char *s;
if (ldb_msg_find_element(msg, attr) != NULL) {
- return LDB_SUCCESS;
+ return 0;
}
s = ldb_timestring(msg, t);
if (s == NULL) {
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
if (ldb_msg_add_string(msg, attr, s) != 0) {
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
el = ldb_msg_find_element(msg, attr);
@@ -141,7 +141,7 @@ static int add_time_element(struct ldb_message *msg, const char *attr, time_t t)
is ignored */
el->flags = LDB_FLAG_MOD_REPLACE;
- return LDB_SUCCESS;
+ return 0;
}
/*
@@ -152,11 +152,11 @@ static int add_uint64_element(struct ldb_message *msg, const char *attr, uint64_
struct ldb_message_element *el;
if (ldb_msg_find_element(msg, attr) != NULL) {
- return LDB_SUCCESS;
+ return 0;
}
if (ldb_msg_add_fmt(msg, attr, "%llu", (unsigned long long)v) != 0) {
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
el = ldb_msg_find_element(msg, attr);
@@ -164,7 +164,7 @@ static int add_uint64_element(struct ldb_message *msg, const char *attr, uint64_
is ignored */
el->flags = LDB_FLAG_MOD_REPLACE;
- return LDB_SUCCESS;
+ return 0;
}
static int replmd_replPropertyMetaData1_attid_sort(const struct replPropertyMetaData1 *m1,
diff --git a/source4/dsdb/samdb/ldb_modules/schema_fsmo.c b/source4/dsdb/samdb/ldb_modules/schema_fsmo.c
index 7c6a6dd26f..968b19c038 100644
--- a/source4/dsdb/samdb/ldb_modules/schema_fsmo.c
+++ b/source4/dsdb/samdb/ldb_modules/schema_fsmo.c
@@ -307,7 +307,7 @@ static int generate_dITContentRules(struct ldb_context *ldb, struct ldb_message
}
}
}
- return LDB_SUCCESS;
+ return 0;
}
diff --git a/source4/lib/ldb-samba/ldif_handlers.c b/source4/lib/ldb-samba/ldif_handlers.c
index 46ea09554d..a16582d294 100644
--- a/source4/lib/ldb-samba/ldif_handlers.c
+++ b/source4/lib/ldb-samba/ldif_handlers.c
@@ -134,7 +134,7 @@ static int ldb_canonicalise_objectSid(struct ldb_context *ldb, void *mem_ctx,
/* Perhaps not a string after all */
return ldb_handler_copy(ldb, mem_ctx, in, out);
}
- return LDB_SUCCESS;
+ return 0;
}
return ldb_handler_copy(ldb, mem_ctx, in, out);
}
diff --git a/source4/lib/ldb/common/attrib_handlers.c b/source4/lib/ldb/common/attrib_handlers.c
index 6f1b0815d7..fb57e2dadc 100644
--- a/source4/lib/ldb/common/attrib_handlers.c
+++ b/source4/lib/ldb/common/attrib_handlers.c
@@ -38,9 +38,9 @@ int ldb_handler_copy(struct ldb_context *ldb, void *mem_ctx,
*out = ldb_val_dup(mem_ctx, in);
if (in->length > 0 && out->data == NULL) {
ldb_oom(ldb);
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
- return LDB_SUCCESS;
+ return 0;
}
/*
@@ -57,13 +57,13 @@ int ldb_handler_fold(struct ldb_context *ldb, void *mem_ctx,
int l;
if (!in || !out || !(in->data)) {
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
out->data = (uint8_t *)ldb_casefold(ldb, mem_ctx, (const char *)(in->data), in->length);
if (out->data == NULL) {
ldb_debug(ldb, LDB_DEBUG_ERROR, "ldb_handler_fold: unable to casefold string [%s]", in->data);
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
s = (char *)(out->data);
@@ -96,7 +96,7 @@ int ldb_handler_fold(struct ldb_context *ldb, void *mem_ctx,
}
out->length = strlen((char *)out->data);
- return LDB_SUCCESS;
+ return 0;
}
@@ -111,14 +111,14 @@ int ldb_canonicalise_Integer(struct ldb_context *ldb, void *mem_ctx,
char *end;
long long i = strtoll((char *)in->data, &end, 0);
if (*end != 0) {
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
out->data = (uint8_t *)talloc_asprintf(mem_ctx, "%lld", i);
if (out->data == NULL) {
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
out->length = strlen((char *)out->data);
- return LDB_SUCCESS;
+ return 0;
}
/*
@@ -251,7 +251,7 @@ int ldb_canonicalise_dn(struct ldb_context *ldb, void *mem_ctx,
}
out->length = strlen((char *)out->data);
- ret = LDB_SUCCESS;
+ ret = 0;
done:
talloc_free(dn);
@@ -305,10 +305,10 @@ int ldb_canonicalise_utctime(struct ldb_context *ldb, void *mem_ctx,
time_t t = ldb_string_to_time((char *)in->data);
out->data = (uint8_t *)ldb_timestring(mem_ctx, t);
if (out->data == NULL) {
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
out->length = strlen((char *)out->data);
- return LDB_SUCCESS;
+ return 0;
}
/*
diff --git a/source4/lib/ldb/common/ldb_attributes.c b/source4/lib/ldb/common/ldb_attributes.c
index 0fbb5e2bfb..747f241781 100644
--- a/source4/lib/ldb/common/ldb_attributes.c
+++ b/source4/lib/ldb/common/ldb_attributes.c
@@ -61,7 +61,7 @@ int ldb_schema_attribute_add_with_syntax(struct ldb_context *ldb,
struct ldb_schema_attribute, n);
if (a == NULL) {
ldb_oom(ldb);
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
ldb->schema.attributes = a;
@@ -70,7 +70,7 @@ int ldb_schema_attribute_add_with_syntax(struct ldb_context *ldb,
if (cmp == 0) {
/* silently ignore attempts to overwrite fixed attributes */
if (a[i].flags & LDB_ATTR_FLAG_FIXED) {
- return LDB_SUCCESS;
+ return 0;
}
if (a[i].flags & LDB_ATTR_FLAG_ALLOCATED) {
talloc_free(discard_const_p(char, a[i].name));
@@ -93,11 +93,11 @@ int ldb_schema_attribute_add_with_syntax(struct ldb_context *ldb,
a[i].name = talloc_strdup(a, a[i].name);
if (a[i].name == NULL) {
ldb_oom(ldb);
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
}
- return LDB_SUCCESS;
+ return 0;
}
static const struct ldb_schema_syntax ldb_syntax_default = {
diff --git a/source4/lib/ldb/common/ldb_debug.c b/source4/lib/ldb/common/ldb_debug.c
index 8e1c491f12..0f78e37c1c 100644
--- a/source4/lib/ldb/common/ldb_debug.c
+++ b/source4/lib/ldb/common/ldb_debug.c
@@ -43,7 +43,7 @@ int ldb_set_debug(struct ldb_context *ldb,
{
ldb->debug_ops.debug = debug;
ldb->debug_ops.context = context;
- return LDB_SUCCESS;
+ return 0;
}
/*
diff --git a/source4/lib/ldb/common/ldb_ldif.c b/source4/lib/ldb/common/ldb_ldif.c
index 6cbd30f377..fb93e17c6c 100644
--- a/source4/lib/ldb/common/ldb_ldif.c
+++ b/source4/lib/ldb/common/ldb_ldif.c
@@ -191,19 +191,19 @@ int ldb_should_b64_encode(const struct ldb_val *val)
uint8_t *p = val->data;
if (val->length == 0) {
- return LDB_SUCCESS;
+ return 0;
}
if (p[0] == ' ' || p[0] == ':') {
- return LDB_ERR_OPERATIONS_ERROR;
+ return 1;
}
for (i=0; i<val->length; i++) {
if (!isprint(p[i]) || p[i] == '\n') {
- return LDB_ERR_OPERATIONS_ERROR;
+ return 1;
}
}
- return LDB_SUCCESS;
+ return 0;
}
/* this macro is used to handle the return checking on fprintf_fn() */
@@ -444,12 +444,12 @@ static int next_attr(void *mem_ctx, char **s, const char **attr, struct ldb_val
value->length = 0;
*attr = "-";
*s += 2;
- return LDB_SUCCESS;
+ return 0;
}
p = strchr(*s, ':');
if (!p) {
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
*p++ = 0;
@@ -487,7 +487,7 @@ static int next_attr(void *mem_ctx, char **s, const char **attr, struct ldb_val
int len = ldb_base64_decode((char *)value->data);
if (len == -1) {
/* it wasn't valid base64 data */
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
value->length = len;
}
@@ -496,11 +496,11 @@ static int next_attr(void *mem_ctx, char **s, const char **attr, struct ldb_val
int len = ldb_read_data_file(mem_ctx, value);
if (len == -1) {
/* an error occured hile trying to retrieve the file */
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
}
- return LDB_SUCCESS;
+ return 0;
}
diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c
index 046d36edf1..c0cd616a76 100644
--- a/source4/lib/ldb/common/ldb_modules.c
+++ b/source4/lib/ldb/common/ldb_modules.c
@@ -279,16 +279,16 @@ int ldb_register_module(const struct ldb_module_ops *ops)
struct ops_list_entry *entry = talloc(talloc_autofree_context(), struct ops_list_entry);
if (ldb_find_module_ops(ops->name) != NULL)
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
if (entry == NULL)
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
entry->ops = ops;
entry->next = registered_modules;
registered_modules = entry;
- return LDB_SUCCESS;
+ return 0;
}
void *ldb_dso_load_symbol(struct ldb_context *ldb, const char *name,
diff --git a/source4/lib/ldb/ldb_ildap/ldb_ildap.c b/source4/lib/ldb/ldb_ildap/ldb_ildap.c
index 3a5da89c41..5ad671ea2e 100644
--- a/source4/lib/ldb/ldb_ildap/ldb_ildap.c
+++ b/source4/lib/ldb/ldb_ildap/ldb_ildap.c
@@ -753,7 +753,7 @@ static int ildb_connect(struct ldb_context *ldb, const char *url,
module = talloc(ldb, struct ldb_module);
if (!module) {
ldb_oom(ldb);
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
talloc_set_name_const(module, "ldb_ildap backend");
module->ldb = ldb;
@@ -819,11 +819,11 @@ static int ildb_connect(struct ldb_context *ldb, const char *url,
}
*_module = module;
- return LDB_SUCCESS;
+ return 0;
failed:
talloc_free(module);
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
_PUBLIC_ const struct ldb_backend_ops ldb_ldap_backend_ops = {
diff --git a/source4/lib/ldb/ldb_ldap/ldb_ldap.c b/source4/lib/ldb/ldb_ldap/ldb_ldap.c
index 5026f9c006..a4534c549a 100644
--- a/source4/lib/ldb/ldb_ldap/ldb_ldap.c
+++ b/source4/lib/ldb/ldb_ldap/ldb_ldap.c
@@ -180,14 +180,14 @@ static int lldb_add_msg_attr(struct ldb_context *ldb,
count = ldap_count_values_len(bval);
if (count <= 0) {
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
el = talloc_realloc(msg, msg->elements, struct ldb_message_element,
msg->num_elements + 1);
if (!el) {
errno = ENOMEM;
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
msg->elements = el;
@@ -197,7 +197,7 @@ static int lldb_add_msg_attr(struct ldb_context *ldb,
el->name = talloc_strdup(msg->elements, attr);
if (!el->name) {
errno = ENOMEM;
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
el->flags = 0;
@@ -205,7 +205,7 @@ static int lldb_add_msg_attr(struct ldb_context *ldb,
el->values = talloc_array(msg->elements, struct ldb_val, count);
if (!el->values) {
errno = ENOMEM;
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
for (i=0;i<count;i++) {
@@ -214,7 +214,7 @@ static int lldb_add_msg_attr(struct ldb_context *ldb,
el->values[i].data = talloc_size(el->values, bval[i]->bv_len+1);
if (!el->values[i].data) {
errno = ENOMEM;
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
memcpy(el->values[i].data, bval[i]->bv_val, bval[i]->bv_len);
el->values[i].data[bval[i]->bv_len] = 0;
@@ -224,7 +224,7 @@ static int lldb_add_msg_attr(struct ldb_context *ldb,
msg->num_elements++;
- return LDB_SUCCESS;
+ return 0;
}
/*
@@ -785,7 +785,7 @@ static int lldb_connect(struct ldb_context *ldb,
if (module == NULL) {
ldb_oom(ldb);
talloc_free(lldb);
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
talloc_set_name_const(module, "ldb_ldap backend");
module->ldb = ldb;
@@ -819,11 +819,11 @@ static int lldb_connect(struct ldb_context *ldb,
}
*_module = module;
- return LDB_SUCCESS;
+ return 0;
failed:
talloc_free(module);
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
const struct ldb_backend_ops ldb_ldap_backend_ops = {
diff --git a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c
index 7e4fe1d08d..a0e63c8da1 100644
--- a/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c
+++ b/source4/lib/ldb/ldb_sqlite3/ldb_sqlite3.c
@@ -670,10 +670,10 @@ static int lsqlite3_safe_rollback(sqlite3 *sqlite)
printf("lsqlite3_safe_rollback: Error: %s\n", errmsg);
free(errmsg);
}
- return SQLITE_ERROR;
+ return -1;
}
- return SQLITE_OK;
+ return 0;
}
/* return an eid as result */
@@ -1440,13 +1440,13 @@ static int lsql_start_trans(struct ldb_module * module)
printf("lsqlite3_start_trans: error: %s\n", errmsg);
free(errmsg);
}
- return SQLITE_ERROR;
+ return -1;
}
};
lsqlite3->trans_count++;
- return SQLITE_OK;
+ return 0;
}
static int lsql_end_trans(struct ldb_module *module)
@@ -1457,7 +1457,7 @@ static int lsql_end_trans(struct ldb_module *module)
if (lsqlite3->trans_count > 0) {
lsqlite3->trans_count--;
- } else return SQLITE_ERROR;
+ } else return -1;
if (lsqlite3->trans_count == 0) {
ret = sqlite3_exec(lsqlite3->sqlite, "COMMIT;", NULL, NULL, &errmsg);
@@ -1466,11 +1466,11 @@ static int lsql_end_trans(struct ldb_module *module)
printf("lsqlite3_end_trans: error: %s\n", errmsg);
free(errmsg);
}
- return SQLITE_ERROR;
+ return -1;
}
}
- return SQLITE_OK;
+ return 0;
}
static int lsql_del_trans(struct ldb_module *module)
@@ -1479,13 +1479,13 @@ static int lsql_del_trans(struct ldb_module *module)
if (lsqlite3->trans_count > 0) {
lsqlite3->trans_count--;
- } else return SQLITE_ERROR;
+ } else return -1;
if (lsqlite3->trans_count == 0) {
return lsqlite3_safe_rollback(lsqlite3->sqlite);
}
- return SQLITE_ERROR;
+ return -1;
}
static int destructor(struct lsqlite3_private *lsqlite3)
@@ -1493,7 +1493,7 @@ static int destructor(struct lsqlite3_private *lsqlite3)
if (lsqlite3->sqlite) {
sqlite3_close(lsqlite3->sqlite);
}
- return SQLITE_OK;
+ return 0;
}
static int lsql_request(struct ldb_module *module, struct ldb_request *req)
@@ -1540,7 +1540,7 @@ static int initialize(struct lsqlite3_private *lsqlite3,
/* create a local ctx */
local_ctx = talloc_named(lsqlite3, 0, "lsqlite3_rename local context");
if (local_ctx == NULL) {
- return SQLITE_ERROR;
+ return -1;
}
schema = lsqlite3_tprintf(local_ctx,
@@ -1792,7 +1792,7 @@ static int initialize(struct lsqlite3_private *lsqlite3,
failed:
if (rollback) lsqlite3_safe_rollback(lsqlite3->sqlite);
sqlite3_close(lsqlite3->sqlite);
- return SQLITE_ERROR;
+ return -1;
}
/*
@@ -1860,14 +1860,14 @@ static int lsqlite3_connect(struct ldb_context *ldb,
}
}
- return LDB_SUCCESS;
+ return 0;
failed:
if (lsqlite3->sqlite != NULL) {
(void) sqlite3_close(lsqlite3->sqlite);
}
talloc_free(lsqlite3);
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
const struct ldb_backend_ops ldb_sqlite3_backend_ops = {
diff --git a/source4/lib/ldb/ldb_tdb/ldb_cache.c b/source4/lib/ldb/ldb_tdb/ldb_cache.c
index e502f1e642..2576e2c7bd 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 LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
}
*v = value;
- return LDB_SUCCESS;
+ return 0;
}
/*
@@ -118,7 +118,7 @@ static int ltdb_attributes_load(struct ldb_module *module)
goto failed;
}
if (r == LDB_ERR_NO_SUCH_OBJECT) {
- return LDB_SUCCESS;
+ return 0;
}
/* 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 LDB_SUCCESS;
+ return 0;
failed:
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
@@ -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 LDB_SUCCESS;
+ return 0;
}
if (ltdb->cache == NULL) {
@@ -344,7 +344,7 @@ int ltdb_cache_load(struct ldb_module *module)
goto failed;
}
- if (ltdb_attributes_load(module) != LDB_SUCCESS) {
+ if (ltdb_attributes_load(module) == -1) {
goto failed;
}
@@ -353,14 +353,14 @@ done:
talloc_free(baseinfo);
talloc_free(baseinfo_dn);
talloc_free(indexlist_dn);
- return LDB_SUCCESS;
+ return 0;
failed:
talloc_free(options);
talloc_free(baseinfo);
talloc_free(baseinfo_dn);
talloc_free(indexlist_dn);
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
@@ -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 LDB_SUCCESS;
+ return 0;
}
}
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
diff --git a/source4/lib/ldb/ldb_tdb/ldb_pack.c b/source4/lib/ldb/ldb_tdb/ldb_pack.c
index d96e7590e7..afb07dcbca 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 LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
/* 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 LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
data->dsize = size;
@@ -147,7 +147,7 @@ int ltdb_pack_data(struct ldb_module *module,
}
}
- return LDB_SUCCESS;
+ return 0;
}
/*
@@ -207,7 +207,7 @@ int ltdb_unpack_data(struct ldb_module *module,
if (message->num_elements == 0) {
message->elements = NULL;
- return LDB_SUCCESS;
+ return 0;
}
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 LDB_SUCCESS;
+ return 0;
failed:
talloc_free(message->elements);
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
diff --git a/source4/lib/ldb/ldb_tdb/ldb_search.c b/source4/lib/ldb/ldb_tdb/ldb_search.c
index ce7a90e3d5..da899c361e 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 != LDB_SUCCESS) {
+ if (ret == -1) {
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 LDB_SUCCESS;
+ return 0;
}
/*
@@ -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 LDB_SUCCESS;
+ return 0;
}
/*
@@ -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 LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
/* add to the results list */
res2 = talloc_realloc(mem_ctx, *res, struct ldb_message *, (*count)+2);
if (!res2) {
talloc_free(msg2);
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
(*res) = res2;
@@ -333,7 +333,7 @@ int ltdb_add_attr_results(struct ldb_module *module,
(*res)[(*count)+1] = NULL;
(*count)++;
- return LDB_SUCCESS;
+ return 0;
}
@@ -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 LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
}
}
@@ -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 LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
- return LDB_SUCCESS;
+ return 0;
}
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 LDB_SUCCESS;
+ return 0;
}
/*
@@ -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 LDB_SUCCESS;
+ return 0;
}
ares = talloc_zero(ac, struct ldb_reply);
if (!ares) {
handle->status = LDB_ERR_OPERATIONS_ERROR;
handle->state = LDB_ASYNC_DONE;
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
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 LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
/* unpack the record */
ret = ltdb_unpack_data(ac->module, &data, ares->message);
- if (ret) {
+ if (ret == -1) {
talloc_free(ares);
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
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 LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
}
@@ -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 LDB_SUCCESS;
+ return 0;
}
/* filter the attributes that the user wants */
ret = ltdb_filter_attrs(ares->message, ac->attrs);
- if (ret != LDB_SUCCESS) {
+ if (ret == -1) {
handle->status = LDB_ERR_OPERATIONS_ERROR;
handle->state = LDB_ASYNC_DONE;
talloc_free(ares);
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
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 LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
- return LDB_SUCCESS;
+ return 0;
}
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
index b711efd1fa..01d570c89a 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 LDB_SUCCESS;
+ return 0;
}
/* we have @ATTRIBUTES, let's check attributes are fine */
@@ -188,7 +188,7 @@ int ltdb_check_special_dn(struct ldb_module *module,
}
}
- return LDB_SUCCESS;
+ return 0;
}
@@ -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 != LDB_SUCCESS) {
+ if (ret == -1) {
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 != LDB_SUCCESS) {
+ if (ret == -1) {
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 LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
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 LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
/* 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 LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
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 LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
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 LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
- return LDB_SUCCESS;
+ return 0;
}
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 9d856355be..4fea43c8c8 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 LDB_SUCCESS;
+ return 0;
}
static void ltdb_log_fn(struct tdb_context *tdb, enum tdb_debug_level level, const char *fmt, ...) PRINTF_ATTRIBUTE(3, 4);
diff --git a/source4/lib/ldb/modules/operational.c b/source4/lib/ldb/modules/operational.c
index 716f34d660..a59e81becd 100644
--- a/source4/lib/ldb/modules/operational.c
+++ b/source4/lib/ldb/modules/operational.c
@@ -158,13 +158,13 @@ static int operational_search_post_process(struct ldb_module *module,
}
}
- return LDB_SUCCESS;
+ return 0;
failed:
ldb_debug_set(module->ldb, LDB_DEBUG_WARNING,
"operational_search_post_process failed for attribute '%s'\n",
attrs[a]);
- return LDB_ERR_OPERATIONS_ERROR;
+ return -1;
}
diff --git a/source4/lib/ldb/modules/paged_results.c b/source4/lib/ldb/modules/paged_results.c
index c7296a1edf..b62b1f92cb 100644
--- a/source4/lib/ldb/modules/paged_results.c
+++ b/source4/lib/ldb/modules/paged_results.c
@@ -86,7 +86,7 @@ int store_destructor(struct results_store *store)
store->priv->store = NULL;
}
- return LDB_SUCCESS;
+ return 0;
}
static struct results_store *new_store(struct private_data *priv)
diff --git a/source4/lib/ldb/modules/skel.c b/source4/lib/ldb/modules/skel.c
index 15df46354b..0cd29ac4b7 100644
--- a/source4/lib/ldb/modules/skel.c
+++ b/source4/lib/ldb/modules/skel.c
@@ -90,7 +90,7 @@ static int skel_destructor(struct ldb_module *ctx)
struct private_data *data = talloc_get_type(ctx->private_data, struct private_data);
/* put your clean-up functions here */
if (data->some_private_data) talloc_free(data->some_private_data);
- return LDB_SUCCESS;
+ return 0;
}
static int skel_request(struct ldb_module *module, struct ldb_request *req)
diff --git a/source4/lib/ldb_wrap.c b/source4/lib/ldb_wrap.c
index 8082f4fac5..6c683a1e33 100644
--- a/source4/lib/ldb_wrap.c
+++ b/source4/lib/ldb_wrap.c
@@ -84,7 +84,7 @@ static int ldb_wrap_destructor(struct ldb_context *ldb)
smb_panic("probable memory leak in ldb");
#endif
}
- return LDB_SUCCESS;
+ return 0;
}
/*