summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/tests/sample_module.c
diff options
context:
space:
mode:
authorMatthieu Patou <mat@matws.net>2009-12-05 17:56:35 +0300
committerSimo Sorce <idra@samba.org>2009-12-23 08:09:19 -0500
commit8dc636ad674a11825e9043fc356209bf2e28bcff (patch)
tree489079015d6b3ba27016d65783bbc0ecac38e0b1 /source4/lib/ldb/tests/sample_module.c
parent3bd4f6792c63fffec66548ae5cfde60e45f865fa (diff)
downloadsamba-8dc636ad674a11825e9043fc356209bf2e28bcff.tar.gz
samba-8dc636ad674a11825e9043fc356209bf2e28bcff.tar.bz2
samba-8dc636ad674a11825e9043fc356209bf2e28bcff.zip
s4: tests controls parsing and using for ldbadd/ldbedit/ldbmodify
Diffstat (limited to 'source4/lib/ldb/tests/sample_module.c')
-rw-r--r--source4/lib/ldb/tests/sample_module.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/source4/lib/ldb/tests/sample_module.c b/source4/lib/ldb/tests/sample_module.c
index bbe4419b59..bb7906e7ba 100644
--- a/source4/lib/ldb/tests/sample_module.c
+++ b/source4/lib/ldb/tests/sample_module.c
@@ -25,12 +25,40 @@
int sample_add(struct ldb_module *mod, struct ldb_request *req)
{
+ struct ldb_control *control;
+ struct ldb_control *controls;
ldb_msg_add_fmt(req->op.add.message, "touchedBy", "sample");
- return ldb_next_request(mod, req);
+
+ /* check if there's a relax control */
+ control = ldb_request_get_control(req, LDB_CONTROL_RELAX_OID);
+ if (control == NULL) {
+ /* not found go on */
+ return ldb_next_request(mod, req);
+ } else {
+ return LDB_ERR_UNWILLING_TO_PERFORM;
+ }
+}
+
+int sample_modify(struct ldb_module *mod, struct ldb_request *req)
+{
+ struct ldb_control *control;
+ struct ldb_control *controls;
+
+ /* check if there's a relax control */
+ control = ldb_request_get_control(req, LDB_CONTROL_RELAX_OID);
+ if (control == NULL) {
+ /* not found go on */
+ return ldb_next_request(mod, req);
+ } else {
+ return LDB_ERR_UNWILLING_TO_PERFORM;
+ }
}
+
const struct ldb_module_ops ldb_sample_module_ops = {
.name = "sample",
.add = sample_add,
+ .del = sample_modify,
+ .modify = sample_modify,
};