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"));
5 /* The type of search callback functions */
6 typedef int (*ldb_search_callback)(struct ldb_context *, void *, struct ldb_reply *);
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"
13 /* Private data structures
14 * ======================= */
16 /* Global private data */
18 struct ldb_map_context context;
21 /* Context data for mapped requests */
27 MAP_SEARCH_SELF_MODIFY,
30 MAP_SEARCH_SELF_DELETE,
33 MAP_SEARCH_SELF_RENAME,
39 struct ldb_module *module;
41 const struct ldb_dn *local_dn;
42 const struct ldb_parse_tree *local_tree;
43 const char * const *local_attrs;
45 struct ldb_request *orig_req;
46 struct ldb_request *local_req;
47 struct ldb_request *remote_req;
48 struct ldb_request *down_req;
49 struct ldb_request *search_req;
51 /* for search, we may have a lot of contexts */
53 struct ldb_request **search_reqs;
56 /* Context data for mapped search requests */
57 struct map_search_context {
58 struct map_context *ac;
59 struct ldb_reply *local_res;
60 struct ldb_reply *remote_res;
65 * ================= */
67 /* The following definitions come from lib/ldb/modules/ldb_map.c */
68 const struct ldb_map_context *map_get_context(struct ldb_module *module);
69 struct map_search_context *map_init_search_context(struct map_context *ac, struct ldb_reply *ares);
70 struct ldb_handle *map_init_handle(struct ldb_request *req, struct ldb_module *module);
72 int ldb_next_remote_request(struct ldb_module *module, struct ldb_request *request);
74 BOOL map_check_local_db(struct ldb_module *module);
75 BOOL map_attr_check_remote(const struct ldb_map_context *data, const char *attr);
76 BOOL ldb_dn_check_local(struct ldb_module *module, const struct ldb_dn *dn);
78 const struct ldb_map_attribute *map_attr_find_local(const struct ldb_map_context *data, const char *name);
79 const struct ldb_map_attribute *map_attr_find_remote(const struct ldb_map_context *data, const char *name);
81 const char *map_attr_map_local(void *mem_ctx, const struct ldb_map_attribute *map, const char *attr);
82 const char *map_attr_map_remote(void *mem_ctx, const struct ldb_map_attribute *map, const char *attr);
84 struct ldb_val ldb_val_map_local(struct ldb_module *module, void *mem_ctx, const struct ldb_map_attribute *map, struct ldb_val val);
85 struct ldb_val ldb_val_map_remote(struct ldb_module *module, void *mem_ctx, const struct ldb_map_attribute *map, struct ldb_val val);
87 struct ldb_dn *ldb_dn_map_local(struct ldb_module *module, void *mem_ctx, const struct ldb_dn *dn);
88 struct ldb_dn *ldb_dn_map_remote(struct ldb_module *module, void *mem_ctx, const struct ldb_dn *dn);
89 struct ldb_dn *ldb_dn_map_rebase_remote(struct ldb_module *module, void *mem_ctx, const struct ldb_dn *dn);
91 struct 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);
92 struct ldb_request *map_search_self_req(struct map_context *ac, const struct ldb_dn *dn);
93 struct ldb_request *map_build_fixup_req(struct map_context *ac, const struct ldb_dn *olddn, const struct ldb_dn *newdn);
99 /* The following definitions come from lib/ldb/modules/ldb_map_inbound.c */
100 int map_add_do_remote(struct ldb_handle *handle);
101 int map_add_do_local(struct ldb_handle *handle);
102 int map_add(struct ldb_module *module, struct ldb_request *req);
104 int map_modify_do_remote(struct ldb_handle *handle);
105 int map_modify_do_local(struct ldb_handle *handle);
106 int map_modify(struct ldb_module *module, struct ldb_request *req);
108 int map_delete_do_remote(struct ldb_handle *handle);
109 int map_delete_do_local(struct ldb_handle *handle);
110 int map_delete(struct ldb_module *module, struct ldb_request *req);
112 int map_rename_do_remote(struct ldb_handle *handle);
113 int map_rename_do_fixup(struct ldb_handle *handle);
114 int map_rename_do_local(struct ldb_handle *handle);
115 int map_rename(struct ldb_module *module, struct ldb_request *req);
117 /* The following definitions come from lib/ldb/modules/ldb_map_outbound.c */
118 int map_search(struct ldb_module *module, struct ldb_request *req);