ldb: Fix included ldb build.
[kamenim/samba.git] / source4 / lib / ldb / common / ldb_modules.c
index 5e9d0e6e988adc5a55e5f1028100c11afda346aa..21225acd3f8b642a958f37841d53166282b71e2f 100644 (file)
@@ -48,7 +48,7 @@ void ldb_set_modules_dir(struct ldb_context *ldb, const char *path)
 
 static char *ldb_modules_strdup_no_spaces(TALLOC_CTX *mem_ctx, const char *string)
 {
-       int i, len;
+       size_t i, len;
        char *trimmed;
 
        trimmed = talloc_strdup(mem_ctx, string);
@@ -79,7 +79,7 @@ const char **ldb_modules_list_from_string(struct ldb_context *ldb, TALLOC_CTX *m
        char **modules = NULL;
        const char **m;
        char *modstr, *p;
-       int i;
+       unsigned int i;
 
        /* spaces not admitted */
        modstr = ldb_modules_strdup_no_spaces(mem_ctx, string);
@@ -144,7 +144,7 @@ static const struct ldb_builtins {
 static ldb_connect_fn ldb_find_backend(const char *url)
 {
        struct backends_list_entry *backend;
-       int i;
+       unsigned int i;
 
        for (i = 0; builtins[i].backend_ops || builtins[i].module_ops; i++) {
                if (builtins[i].backend_ops == NULL) continue;
@@ -262,7 +262,7 @@ int ldb_connect_backend(struct ldb_context *ldb,
 static const struct ldb_module_ops *ldb_find_module_ops(const char *name)
 {
        struct ops_list_entry *e;
-       int i;
+       unsigned int i;
 
        for (i = 0; builtins[i].backend_ops || builtins[i].module_ops; i++) {
                if (builtins[i].module_ops == NULL) continue;
@@ -333,7 +333,7 @@ static void *ldb_dso_load_symbol(struct ldb_context *ldb, const char *name,
 int ldb_load_modules_list(struct ldb_context *ldb, const char **module_list, struct ldb_module *backend, struct ldb_module **out)
 {
        struct ldb_module *module;
-       int i;
+       unsigned int i;
 
        module = backend;
 
@@ -399,7 +399,7 @@ int ldb_init_module_chain(struct ldb_context *ldb, struct ldb_module *module)
 int ldb_load_modules(struct ldb_context *ldb, const char *options[])
 {
        const char **modules = NULL;
-       int i;
+       unsigned int i;
        int ret;
        TALLOC_CTX *mem_ctx = talloc_new(ldb);
        if (!mem_ctx) {
@@ -795,7 +795,7 @@ int ldb_module_send_referral(struct ldb_request *req,
  *     req:   the original request passed to your module
  *     ctrls: controls to send in the reply (must be a talloc pointer, steal)
  *     response: results for extended request (steal)
- *     error: LDB_SUCCESS for a succesful return
+ *     error: LDB_SUCCESS for a successful return
  *            any other ldb error otherwise
  */
 int ldb_module_done(struct ldb_request *req,
@@ -829,10 +829,7 @@ int ldb_module_done(struct ldb_request *req,
                ldb_debug_end(req->handle->ldb, LDB_DEBUG_TRACE);
        }
 
-       req->callback(req, ares);
-       /* returning ares->error here allows the callback routines in
-          modules to override the error code */
-       return ares->error;
+       return req->callback(req, ares);
 }
 
 /* to be used *only* in modules init functions.
@@ -869,6 +866,10 @@ int ldb_mod_register_control(struct ldb_module *module, const char *oid)
        return ret;
 }
 
+#ifdef STATIC_ldb_MODULES
+#define STATIC_LIBLDB_MODULES STATIC_ldb_MODULES
+#endif
+
 #ifndef STATIC_LIBLDB_MODULES
 
 #ifdef HAVE_LDB_LDAP