diff --git a/source/lib/ldb/common/attrib_handlers.c b/source/lib/ldb/common/attrib_handlers.c index fb57e2d..6f1b081 100644 --- a/source/lib/ldb/common/attrib_handlers.c +++ b/source/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 -1; + return LDB_ERR_OPERATIONS_ERROR; } - return 0; + return LDB_SUCCESS; } /* @@ -57,13 +57,13 @@ int ldb_handler_fold(struct ldb_context *ldb, void *mem_ctx, int l; if (!in || !out || !(in->data)) { - return -1; + return LDB_ERR_OPERATIONS_ERROR; } 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 -1; + return LDB_ERR_OPERATIONS_ERROR; } 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 0; + return LDB_SUCCESS; } @@ -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 -1; + return LDB_ERR_OPERATIONS_ERROR; } out->data = (uint8_t *)talloc_asprintf(mem_ctx, "%lld", i); if (out->data == NULL) { - return -1; + return LDB_ERR_OPERATIONS_ERROR; } out->length = strlen((char *)out->data); - return 0; + return LDB_SUCCESS; } /* @@ -251,7 +251,7 @@ int ldb_canonicalise_dn(struct ldb_context *ldb, void *mem_ctx, } out->length = strlen((char *)out->data); - ret = 0; + ret = LDB_SUCCESS; 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 -1; + return LDB_ERR_OPERATIONS_ERROR; } out->length = strlen((char *)out->data); - return 0; + return LDB_SUCCESS; } /* diff --git a/source/lib/ldb/common/ldb_attributes.c b/source/lib/ldb/common/ldb_attributes.c index 747f241..0fbb5e2 100644 --- a/source/lib/ldb/common/ldb_attributes.c +++ b/source/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 -1; + return LDB_ERR_OPERATIONS_ERROR; } 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 0; + return LDB_SUCCESS; } 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 -1; + return LDB_ERR_OPERATIONS_ERROR; } } - return 0; + return LDB_SUCCESS; } static const struct ldb_schema_syntax ldb_syntax_default = { diff --git a/source/lib/ldb/common/ldb_debug.c b/source/lib/ldb/common/ldb_debug.c index 0f78e37..8e1c491 100644 --- a/source/lib/ldb/common/ldb_debug.c +++ b/source/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 0; + return LDB_SUCCESS; } /* diff --git a/source/lib/ldb/common/ldb_ldif.c b/source/lib/ldb/common/ldb_ldif.c index fb93e17..6cbd30f 100644 --- a/source/lib/ldb/common/ldb_ldif.c +++ b/source/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 0; + return LDB_SUCCESS; } if (p[0] == ' ' || p[0] == ':') { - return 1; + return LDB_ERR_OPERATIONS_ERROR; } for (i=0; ilength; i++) { if (!isprint(p[i]) || p[i] == '\n') { - return 1; + return LDB_ERR_OPERATIONS_ERROR; } } - return 0; + return LDB_SUCCESS; } /* 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 0; + return LDB_SUCCESS; } p = strchr(*s, ':'); if (!p) { - return -1; + return LDB_ERR_OPERATIONS_ERROR; } *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 -1; + return LDB_ERR_OPERATIONS_ERROR; } 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 -1; + return LDB_ERR_OPERATIONS_ERROR; } } - return 0; + return LDB_SUCCESS; } diff --git a/source/lib/ldb/common/ldb_modules.c b/source/lib/ldb/common/ldb_modules.c index 4d69dc6..96c97ab 100644 --- a/source/lib/ldb/common/ldb_modules.c +++ b/source/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 -1; + return LDB_ERR_OPERATIONS_ERROR; if (entry == NULL) - return -1; + return LDB_ERR_OPERATIONS_ERROR; entry->ops = ops; entry->next = registered_modules; registered_modules = entry; - return 0; + return LDB_SUCCESS; } void *ldb_dso_load_symbol(struct ldb_context *ldb, const char *name, diff --git a/source/lib/ldb/modules/operational.c b/source/lib/ldb/modules/operational.c index a59e81b..716f34d 100644 --- a/source/lib/ldb/modules/operational.c +++ b/source/lib/ldb/modules/operational.c @@ -158,13 +158,13 @@ static int operational_search_post_process(struct ldb_module *module, } } - return 0; + return LDB_SUCCESS; failed: ldb_debug_set(module->ldb, LDB_DEBUG_WARNING, "operational_search_post_process failed for attribute '%s'\n", attrs[a]); - return -1; + return LDB_ERR_OPERATIONS_ERROR; } diff --git a/source/lib/ldb/modules/paged_results.c b/source/lib/ldb/modules/paged_results.c index b62b1f9..c7296a1 100644 --- a/source/lib/ldb/modules/paged_results.c +++ b/source/lib/ldb/modules/paged_results.c @@ -86,7 +86,7 @@ int store_destructor(struct results_store *store) store->priv->store = NULL; } - return 0; + return LDB_SUCCESS; } static struct results_store *new_store(struct private_data *priv) diff --git a/source/lib/ldb/modules/skel.c b/source/lib/ldb/modules/skel.c index 0cd29ac..15df463 100644 --- a/source/lib/ldb/modules/skel.c +++ b/source/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 0; + return LDB_SUCCESS; } static int skel_request(struct ldb_module *module, struct ldb_request *req)