static int sample_add(struct ldb_module *mod, struct ldb_request *req)
{
struct ldb_control *control;
- struct ldb_context *ldb = ldb_module_get_ctx(mod);
- struct ldb_message *msg;
- struct ldb_request *down_req;
- int ret;
+
+ ldb_msg_add_fmt(req->op.add.message, "touchedBy", "sample");
/* check if there's a relax control */
control = ldb_request_get_control(req, LDB_CONTROL_RELAX_OID);
- if (control != NULL) {
+ if (control == NULL) {
+ /* not found go on */
+ return ldb_next_request(mod, req);
+ } else {
return LDB_ERR_UNWILLING_TO_PERFORM;
}
-
- msg = ldb_msg_copy_shallow(req, req->op.add.message);
- if (msg == NULL) {
- return LDB_ERR_OPERATIONS_ERROR;
- }
-
- ldb_msg_add_fmt(msg, "touchedBy", "sample");
-
- ret = ldb_build_add_req(&down_req, ldb, req,
- msg,
- req->controls,
- NULL, /* callback context */
- ldb_op_default_callback,
- req);
- if (ret != LDB_SUCCESS) {
- return ret;
- }
-
- talloc_steal(down_req, msg);
-
- /* go on with the call chain */
- return ldb_next_request(mod, down_req);
}
static int sample_modify(struct ldb_module *mod, struct ldb_request *req)