4 Copyright (C) Andrew Bartlett <abartlet@samba.org> 2009
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 * Component: ldb lazy_commit module
25 * Description: module to pretend to support the 'lazy commit' control
27 * Author: Andrew Bartlett
30 #include "ldb_module.h"
32 static int unlazy_op(struct ldb_module *module, struct ldb_request *req)
35 struct ldb_request *new_req;
36 struct ldb_control *control = ldb_request_get_control(req, LDB_CONTROL_SERVER_LAZY_COMMIT);
38 return ldb_next_request(module, req);
41 switch (req->operation) {
43 ret = ldb_build_search_req_ex(&new_req, ldb_module_get_ctx(module),
50 req->context, req->callback,
54 ret = ldb_build_add_req(&new_req, ldb_module_get_ctx(module), req,
57 req->context, req->callback,
61 ret = ldb_build_mod_req(&new_req, ldb_module_get_ctx(module), req,
64 req->context, req->callback,
68 ret = ldb_build_del_req(&new_req, ldb_module_get_ctx(module), req,
71 req->context, req->callback,
75 ret = ldb_build_rename_req(&new_req, ldb_module_get_ctx(module), req,
79 req->context, req->callback,
83 ret = ldb_build_extended_req(&new_req, ldb_module_get_ctx(module),
86 req->op.extended.data,
88 req->context, req->callback,
92 ldb_set_errstring(ldb_module_get_ctx(module),
93 "Unsupported request type!");
94 ret = LDB_ERR_UNWILLING_TO_PERFORM;
97 if (ret != LDB_SUCCESS) {
101 control->critical = 0;
102 return ldb_next_request(module, new_req);
105 static int unlazy_init(struct ldb_module *module)
108 struct ldb_context *ldb;
109 ldb = ldb_module_get_ctx(module);
111 ret = ldb_mod_register_control(module, LDB_CONTROL_SHOW_DELETED_OID);
112 if (ret != LDB_SUCCESS) {
113 ldb_debug(ldb, LDB_DEBUG_ERROR,
114 "lazy_commit: Unable to register control with rootdse!\n");
115 return LDB_ERR_OPERATIONS_ERROR;
118 return ldb_next_init(module);
121 const struct ldb_module_ops ldb_lazy_commit_module_ops = {
122 .name = "lazy_commit",
128 .request = unlazy_op,
129 .extended = unlazy_op,
130 .init_context = unlazy_init,