s4:ldap_backend.c - move function "ldb_mod_req_with_controls" to a better place in...
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Sun, 20 Jun 2010 13:09:55 +0000 (15:09 +0200)
committerMatthias Dieter Wallnöfer <mdw@samba.org>
Sun, 20 Jun 2010 16:52:30 +0000 (18:52 +0200)
Under the "add" and over the "delete" function.

source4/ldap_server/ldap_backend.c

index 32780d49575220f5d633a9a05f91562653ccb8c8..e009641cdd76cee9741876ea3041b43f151468c2 100644 (file)
@@ -175,51 +175,6 @@ static int map_ldb_error(TALLOC_CTX *mem_ctx, int ldb_err,
        /* result is 1:1 for now */
        return ldb_err;
 }
-/* create and execute a modify request */
-static int ldb_mod_req_with_controls(struct ldb_context *ldb,
-                                    const struct ldb_message *message,
-                                    struct ldb_control **controls,
-                                    void *context)
-{
-       struct ldb_request *req;
-       int ret;
-
-       ret = ldb_msg_sanity_check(ldb, message);
-       if (ret != LDB_SUCCESS) {
-               return ret;
-       }
-
-       ret = ldb_build_mod_req(&req, ldb, ldb,
-                                       message,
-                                       controls,
-                                       context,
-                                       ldb_modify_default_callback,
-                                       NULL);
-
-       if (ret != LDB_SUCCESS) {
-               return ret;
-       }
-
-       ret = ldb_transaction_start(ldb);
-       if (ret != LDB_SUCCESS) {
-               return ret;
-       }
-
-       ret = ldb_request(ldb, req);
-       if (ret == LDB_SUCCESS) {
-               ret = ldb_wait(req->handle, LDB_WAIT_ALL);
-       }
-
-       if (ret == LDB_SUCCESS) {
-               ret = ldb_transaction_commit(ldb);
-       }
-       else {
-               ldb_transaction_cancel(ldb);
-       }
-
-       talloc_free(req);
-       return ret;
-}
 
 /*
   connect to the sam database
@@ -320,9 +275,9 @@ static NTSTATUS ldapsrv_unwilling(struct ldapsrv_call *call, int error)
        return NT_STATUS_OK;
 }
 
-int ldb_add_with_context(struct ldb_context *ldb,
-                        const struct ldb_message *message,
-                        void *context)
+static int ldb_add_with_context(struct ldb_context *ldb,
+                               const struct ldb_message *message,
+                               void *context)
 {
        struct ldb_request *req;
        int ret;
@@ -362,9 +317,55 @@ int ldb_add_with_context(struct ldb_context *ldb,
        return ret;
 }
 
-int ldb_delete_with_context(struct ldb_context *ldb,
-                           struct ldb_dn *dn,
-                           void *context)
+/* create and execute a modify request */
+static int ldb_mod_req_with_controls(struct ldb_context *ldb,
+                                    const struct ldb_message *message,
+                                    struct ldb_control **controls,
+                                    void *context)
+{
+       struct ldb_request *req;
+       int ret;
+
+       ret = ldb_msg_sanity_check(ldb, message);
+       if (ret != LDB_SUCCESS) {
+               return ret;
+       }
+
+       ret = ldb_build_mod_req(&req, ldb, ldb,
+                                       message,
+                                       controls,
+                                       context,
+                                       ldb_modify_default_callback,
+                                       NULL);
+
+       if (ret != LDB_SUCCESS) {
+               return ret;
+       }
+
+       ret = ldb_transaction_start(ldb);
+       if (ret != LDB_SUCCESS) {
+               return ret;
+       }
+
+       ret = ldb_request(ldb, req);
+       if (ret == LDB_SUCCESS) {
+               ret = ldb_wait(req->handle, LDB_WAIT_ALL);
+       }
+
+       if (ret == LDB_SUCCESS) {
+               ret = ldb_transaction_commit(ldb);
+       }
+       else {
+               ldb_transaction_cancel(ldb);
+       }
+
+       talloc_free(req);
+       return ret;
+}
+
+static int ldb_delete_with_context(struct ldb_context *ldb,
+                                  struct ldb_dn *dn,
+                                  void *context)
 {
        struct ldb_request *req;
        int ret;