librpc: Shorten dcerpc_binding_handle_call a bit
[Samba/gebeck_regimport.git] / lib / ldb / tests / sample_module.c
blobbee40a5e80fc105447010631e03c981c486672af
1 /*
2 Unix SMB/CIFS implementation.
3 Samba utility functions
4 Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007
6 ** NOTE! The following LGPL license applies to the ldb
7 ** library. This does NOT imply that all of Samba is released
8 ** under the LGPL
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Lesser General Public
12 License as published by the Free Software Foundation; either
13 version 3 of the License, or (at your option) any later version.
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public
21 License along with this library; if not, see <http://www.gnu.org/licenses/>.
24 #include "replace.h"
25 #include "system/filesys.h"
26 #include "system/time.h"
27 #include "ldb_module.h"
29 static int sample_add(struct ldb_module *mod, struct ldb_request *req)
31 struct ldb_control *control;
33 ldb_msg_add_fmt(req->op.add.message, "touchedBy", "sample");
35 /* check if there's a relax control */
36 control = ldb_request_get_control(req, LDB_CONTROL_RELAX_OID);
37 if (control == NULL) {
38 /* not found go on */
39 return ldb_next_request(mod, req);
40 } else {
41 return LDB_ERR_UNWILLING_TO_PERFORM;
45 static int sample_modify(struct ldb_module *mod, struct ldb_request *req)
47 struct ldb_control *control;
49 /* check if there's a relax control */
50 control = ldb_request_get_control(req, LDB_CONTROL_RELAX_OID);
51 if (control == NULL) {
52 /* not found go on */
53 return ldb_next_request(mod, req);
54 } else {
55 return LDB_ERR_UNWILLING_TO_PERFORM;
60 static struct ldb_module_ops ldb_sample_module_ops = {
61 .name = "sample",
62 .add = sample_add,
63 .del = sample_modify,
64 .modify = sample_modify,
67 int ldb_sample_init(const char *version)
69 LDB_MODULE_CHECK_VERSION(version);
70 return ldb_register_module(&ldb_sample_module_ops);