Fix bug #9147 - winbind can't fetch user or group info from AD via LDAP
[Samba.git] / source3 / lib / ldb / modules / skel.c
blobbe3cefc84ec96b2be1dad027c7c090974a58cb05
1 /*
2 ldb database library
4 Copyright (C) Simo Sorce 2004
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/>.
25 * Name: ldb
27 * Component: ldb skel module
29 * Description: example module
31 * Author: Simo Sorce
34 #include "includes.h"
35 #include "ldb/include/includes.h"
37 struct private_data {
39 char *some_private_data;
42 /* search */
43 static int skel_search(struct ldb_module *module, struct ldb_request *req)
45 return ldb_next_request(module, req);
48 /* add */
49 static int skel_add(struct ldb_module *module, struct ldb_request *req){
50 return ldb_next_request(module, req);
53 /* modify */
54 static int skel_modify(struct ldb_module *module, struct ldb_request *req)
56 return ldb_next_request(module, req);
59 /* delete */
60 static int skel_delete(struct ldb_module *module, struct ldb_request *req)
62 return ldb_next_request(module, req);
65 /* rename */
66 static int skel_rename(struct ldb_module *module, struct ldb_request *req)
68 return ldb_next_request(module, req);
71 /* start a transaction */
72 static int skel_start_trans(struct ldb_module *module)
74 return ldb_next_start_trans(module);
77 /* end a transaction */
78 static int skel_end_trans(struct ldb_module *module)
80 return ldb_next_end_trans(module);
83 /* delete a transaction */
84 static int skel_del_trans(struct ldb_module *module)
86 return ldb_next_del_trans(module);
89 static int skel_destructor(struct ldb_module *ctx)
91 struct private_data *data = talloc_get_type(ctx->private_data, struct private_data);
92 /* put your clean-up functions here */
93 if (data->some_private_data) talloc_free(data->some_private_data);
94 return 0;
97 static int skel_request(struct ldb_module *module, struct ldb_request *req)
99 return ldb_next_request(module, req);
102 static int skel_init(struct ldb_module *ctx)
104 struct private_data *data;
106 data = talloc(ctx, struct private_data);
107 if (data == NULL) {
108 return 1;
111 data->some_private_data = NULL;
112 ctx->private_data = data;
114 talloc_set_destructor (ctx, skel_destructor);
116 return ldb_next_init(ctx);
119 static const struct ldb_module_ops skel_ops = {
120 .name = "skel",
121 .init_context = skel_init,
122 .search = skel_search,
123 .add = skel_add,
124 .modify = skel_modify,
125 .del = skel_delete,
126 .rename = skel_rename,
127 .request = skel_request,
128 .start_transaction = skel_start_trans,
129 .end_transaction = skel_end_trans,
130 .del_transaction = skel_del_trans,
133 int ldb_skel_init(void)
135 return ldb_register_module(&skel_ops);