• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt/router/samba-3.5.8/source3/lib/ldb/modules/
1
2/* A handy macro to report Out of Memory conditions */
3#define map_oom(module) ldb_set_errstring(module->ldb, talloc_asprintf(module, "Out of Memory"));
4
5/* The type of search callback functions */
6typedef int (*ldb_search_callback)(struct ldb_context *, void *, struct ldb_reply *);
7
8/* The special DN from which the local and remote base DNs are fetched */
9#define MAP_DN_NAME	"@MAP"
10#define MAP_DN_FROM	"@FROM"
11#define MAP_DN_TO	"@TO"
12
13/* Private data structures
14 * ======================= */
15
16/* Context data for mapped requests */
17struct map_context {
18	enum map_step {
19		MAP_SEARCH_REMOTE,
20		MAP_ADD_REMOTE,
21		MAP_ADD_LOCAL,
22		MAP_SEARCH_SELF_MODIFY,
23		MAP_MODIFY_REMOTE,
24		MAP_MODIFY_LOCAL,
25		MAP_SEARCH_SELF_DELETE,
26		MAP_DELETE_REMOTE,
27		MAP_DELETE_LOCAL,
28		MAP_SEARCH_SELF_RENAME,
29		MAP_RENAME_REMOTE,
30		MAP_RENAME_FIXUP,
31		MAP_RENAME_LOCAL
32	} step;
33
34	struct ldb_module *module;
35
36	const struct ldb_dn *local_dn;
37	const struct ldb_parse_tree *local_tree;
38	const char * const *local_attrs;
39	const char * const *remote_attrs;
40	const char * const *all_attrs;
41
42	struct ldb_request *orig_req;
43	struct ldb_request *local_req;
44	struct ldb_request *remote_req;
45	struct ldb_request *down_req;
46	struct ldb_request *search_req;
47
48	/* for search, we may have a lot of contexts */
49	int num_searches;
50	struct ldb_request **search_reqs;
51};
52
53/* Context data for mapped search requests */
54struct map_search_context {
55	struct map_context *ac;
56	struct ldb_reply *local_res;
57	struct ldb_reply *remote_res;
58};
59
60
61/* Common operations
62 * ================= */
63
64/* The following definitions come from lib/ldb/modules/ldb_map.c */
65const struct ldb_map_context *map_get_context(struct ldb_module *module);
66struct map_search_context *map_init_search_context(struct map_context *ac, struct ldb_reply *ares);
67struct ldb_handle *map_init_handle(struct ldb_request *req, struct ldb_module *module);
68
69int ldb_next_remote_request(struct ldb_module *module, struct ldb_request *request);
70
71BOOL map_check_local_db(struct ldb_module *module);
72BOOL map_attr_check_remote(const struct ldb_map_context *data, const char *attr);
73BOOL ldb_dn_check_local(struct ldb_module *module, const struct ldb_dn *dn);
74
75const struct ldb_map_attribute *map_attr_find_local(const struct ldb_map_context *data, const char *name);
76const struct ldb_map_attribute *map_attr_find_remote(const struct ldb_map_context *data, const char *name);
77
78const char *map_attr_map_local(void *mem_ctx, const struct ldb_map_attribute *map, const char *attr);
79const char *map_attr_map_remote(void *mem_ctx, const struct ldb_map_attribute *map, const char *attr);
80int map_attrs_merge(struct ldb_module *module, void *mem_ctx, const char ***attrs, const char * const *more_attrs);
81
82struct ldb_val ldb_val_map_local(struct ldb_module *module, void *mem_ctx, const struct ldb_map_attribute *map, const struct ldb_val *val);
83struct ldb_val ldb_val_map_remote(struct ldb_module *module, void *mem_ctx, const struct ldb_map_attribute *map, const struct ldb_val *val);
84
85struct ldb_dn *ldb_dn_map_local(struct ldb_module *module, void *mem_ctx, const struct ldb_dn *dn);
86struct ldb_dn *ldb_dn_map_remote(struct ldb_module *module, void *mem_ctx, const struct ldb_dn *dn);
87struct ldb_dn *ldb_dn_map_rebase_remote(struct ldb_module *module, void *mem_ctx, const struct ldb_dn *dn);
88
89struct ldb_request *map_search_base_req(struct map_context *ac, const struct ldb_dn *dn, const char * const *attrs, const struct ldb_parse_tree *tree, void *context, ldb_search_callback callback);
90struct ldb_request *map_search_self_req(struct map_context *ac, const struct ldb_dn *dn);
91struct ldb_request *map_build_fixup_req(struct map_context *ac, const struct ldb_dn *olddn, const struct ldb_dn *newdn);
92
93int map_subtree_collect_remote_simple(struct ldb_module *module, void *mem_ctx, struct ldb_parse_tree **new, const struct ldb_parse_tree *tree, const struct ldb_map_attribute *map);
94
95/* LDB Requests
96 * ============ */
97
98/* The following definitions come from lib/ldb/modules/ldb_map_inbound.c */
99int map_add_do_remote(struct ldb_handle *handle);
100int map_add_do_local(struct ldb_handle *handle);
101int map_add(struct ldb_module *module, struct ldb_request *req);
102
103int map_modify_do_remote(struct ldb_handle *handle);
104int map_modify_do_local(struct ldb_handle *handle);
105int map_modify(struct ldb_module *module, struct ldb_request *req);
106
107int map_delete_do_remote(struct ldb_handle *handle);
108int map_delete_do_local(struct ldb_handle *handle);
109int map_delete(struct ldb_module *module, struct ldb_request *req);
110
111int map_rename_do_remote(struct ldb_handle *handle);
112int map_rename_do_fixup(struct ldb_handle *handle);
113int map_rename_do_local(struct ldb_handle *handle);
114int map_rename(struct ldb_module *module, struct ldb_request *req);
115
116/* The following definitions come from lib/ldb/modules/ldb_map_outbound.c */
117int map_search(struct ldb_module *module, struct ldb_request *req);
118