s4:various LDB modules - "build_request" functions - propagate result codes back
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Tue, 6 Oct 2009 17:27:17 +0000 (19:27 +0200)
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>
Tue, 6 Oct 2009 17:41:16 +0000 (19:41 +0200)
It's very useful to know the exact result code when something fails and not
only a generic (by the module) created one.
Sure, there are some exception cases with specific results (special message
constellations, attributes, values...) which shouldn't be changed at all
(examples of them are in the "ldap.py" test). Therefore I looked very
carefully to not change them.

source4/dsdb/samdb/ldb_modules/kludge_acl.c
source4/dsdb/samdb/ldb_modules/local_password.c
source4/dsdb/samdb/ldb_modules/objectguid.c
source4/dsdb/samdb/ldb_modules/partition.c
source4/lib/ldb/modules/asq.c
source4/lib/ldb/modules/paged_results.c
source4/lib/ldb/modules/sort.c

index 34f848de8a4899d8fcd461429ef5dc9a869a081c..79309e82bf7b23ee90afdeda96bb5e2caf454939 100644 (file)
@@ -379,7 +379,7 @@ static int kludge_acl_search(struct ldb_module *module, struct ldb_request *req)
                                        ac, kludge_acl_callback,
                                        req);
        if (ret != LDB_SUCCESS) {
-               return LDB_ERR_OPERATIONS_ERROR;
+               return ret;
        }
 
        /* check if there's an SD_FLAGS control */
index 58c0f1f0d522c63da18d4c43d59feb342e306c88..9c386b354d428385a440240eecce05a28cf8946b 100644 (file)
@@ -633,8 +633,7 @@ static int lpdb_delete_callabck(struct ldb_request *req,
 
        ret = ldb_next_request(ac->module, search_req);
        if (ret != LDB_SUCCESS) {
-               return ldb_module_done(ac->req, NULL, NULL,
-                                       LDB_ERR_OPERATIONS_ERROR);
+               return ldb_module_done(ac->req, NULL, NULL, ret);
        }
        return LDB_SUCCESS;
 }
@@ -1082,7 +1081,7 @@ static int local_password_search(struct ldb_module *module, struct ldb_request *
                                        ac, lpdb_remote_search_callback,
                                        req);
        if (ret != LDB_SUCCESS) {
-               return LDB_ERR_OPERATIONS_ERROR;
+               return ret;
        }
 
        /* perform the search */
index 3d218edc767bd75b4d4a6ff9f10e02bf68634bad..12dd402617205a12fde9cf0cd746ba4b885ac262 100644 (file)
@@ -209,7 +209,7 @@ static int objectguid_add(struct ldb_module *module, struct ldb_request *req)
                                ac, og_op_callback,
                                req);
        if (ret != LDB_SUCCESS) {
-               return LDB_ERR_OPERATIONS_ERROR;
+               return ret;
        }
 
        /* go on with the call chain */
@@ -267,7 +267,7 @@ static int objectguid_modify(struct ldb_module *module, struct ldb_request *req)
                                ac, og_op_callback,
                                req);
        if (ret != LDB_SUCCESS) {
-               return LDB_ERR_OPERATIONS_ERROR;
+               return ret;
        }
 
        /* go on with the call chain */
index 6e86d4c48455310477e7dbd0f9d5986e20b8c861..c5bbdf8dce35b9c3fff78735026797b6ed5bd887 100644 (file)
@@ -829,14 +829,22 @@ static int partition_sequence_number(struct ldb_module *module, struct ldb_reque
                                             res,
                                             ldb_extended_default_callback,
                                             NULL);
-               ret = ldb_next_request(module, treq);
-               if (ret == LDB_SUCCESS) {
-                       ret = ldb_wait(treq->handle, LDB_WAIT_ALL);
+               if (ret != LDB_SUCCESS) {
+                       talloc_free(res);
+                       return ret;
                }
+
+               ret = ldb_next_request(module, treq);
                if (ret != LDB_SUCCESS) {
                        talloc_free(res);
                        return ret;
                }
+               ret = ldb_wait(treq->handle, LDB_WAIT_ALL);
+               if (ret != LDB_SUCCESS) {
+                       talloc_free(res);
+                       return ret;
+               }
+
                seqr = talloc_get_type(res->extended->data,
                                        struct ldb_seqnum_result);
                if (seqr->flags & LDB_SEQ_TIMESTAMP_SEQUENCE) {
@@ -1083,7 +1091,7 @@ static int partition_extended_schema_update_now(struct ldb_module *module, struc
        }
 
        /* fire the first one */
-       ret =  partition_call_first(ac);
+       ret = partition_call_first(ac);
 
        if (ret != LDB_SUCCESS){
                return ret;
@@ -1385,14 +1393,14 @@ static int partition_init(struct ldb_module *module)
        if (ret != LDB_SUCCESS) {
                ldb_debug(ldb_module_get_ctx(module), LDB_DEBUG_ERROR,
                        "partition: Unable to register control with rootdse!\n");
-               return LDB_ERR_OPERATIONS_ERROR;
+               return ret;
        }
 
        ret = ldb_mod_register_control(module, LDB_CONTROL_SEARCH_OPTIONS_OID);
        if (ret != LDB_SUCCESS) {
                ldb_debug(ldb_module_get_ctx(module), LDB_DEBUG_ERROR,
                        "partition: Unable to register control with rootdse!\n");
-               return LDB_ERR_OPERATIONS_ERROR;
+               return ret;
        }
 
        talloc_free(mem_ctx);
index 0819f7f5597ae1e2211c2f361d432cb571bb3cce..491868301c46b945465d88b037b36abbfbd01cea 100644 (file)
@@ -237,7 +237,7 @@ static int asq_build_first_request(struct asq_context *ac, struct ldb_request **
                                        ac, asq_base_callback,
                                        ac->req);
        if (ret != LDB_SUCCESS) {
-               return LDB_ERR_OPERATIONS_ERROR;
+               return ret;
        }
 
        return LDB_SUCCESS;
@@ -292,7 +292,7 @@ static int asq_build_multiple_requests(struct asq_context *ac, bool *terminated)
                                                ac, asq_reqs_callback,
                                                ac->req);
                if (ret != LDB_SUCCESS) {
-                       return LDB_ERR_OPERATIONS_ERROR;
+                       return ret;
                }
 
                /* remove the ASQ control itself */
index b712f84872154327aeda6bd5a8749fd80d0144d6..774109ff06d6fa22aa2922939e22e41f1510475c 100644 (file)
@@ -347,6 +347,9 @@ static int paged_search(struct ldb_module *module, struct ldb_request *req)
                                                ac,
                                                paged_search_callback,
                                                req);
+               if (ret != LDB_SUCCESS) {
+                       return ret;
+               }
 
                /* save it locally and remove it from the list */
                /* we do not need to replace them later as we
index b4ea017b3269947e70c11ce756f049ba1d933ea7..f0aea770184497822c88437a273f1695d127968a 100644 (file)
@@ -315,7 +315,7 @@ static int server_sort_search(struct ldb_module *module, struct ldb_request *req
                                        server_sort_search_callback,
                                        req);
        if (ret != LDB_SUCCESS) {
-               return LDB_ERR_OPERATIONS_ERROR;
+               return ret;
        }
 
        /* save it locally and remove it from the list */