struct ldb_request *map_search_base_req(struct map_context *ac, struct ldb_dn *dn, const char * const *attrs, struct ldb_parse_tree *tree, void *context, ldb_map_callback_t callback)
{
	struct ldb_parse_tree *search_tree;
	struct ldb_context *ldb;
	struct ldb_request *req;
	int ret;

	ldb = ldb_module_get_ctx(ac->module);

	if (tree) {
		search_tree = tree;
	} else {
		search_tree = ldb_parse_tree(ac, NULL);
		if (search_tree == NULL) {
			return NULL;
		}
	}

	ret = ldb_build_search_req_ex(&req, ldb, ac,
					dn, LDB_SCOPE_BASE,
					search_tree, attrs,
					NULL,
					context, callback,
					ac->req);
	LDB_REQ_SET_LOCATION(req);
	if (ret != LDB_SUCCESS) {
		return NULL;
	}

	return req;
}
struct ldb_request *map_search_base_req(struct map_context *ac, struct ldb_dn *dn, const char * const *attrs, struct ldb_parse_tree *tree, void *context, ldb_map_callback_t callback)
{
	struct ldb_parse_tree *search_tree;
	struct ldb_context *ldb;
	struct ldb_request *req;
	int ret;

	ldb = ldb_module_get_ctx(ac->module);

	if (tree) {
		search_tree = tree;
	} else {
		search_tree = ldb_parse_tree(ac, NULL);
		if (search_tree == NULL) {
			return NULL;
		}
	}

	ret = ldb_build_search_req_ex(&req, ldb, ac,
					dn, LDB_SCOPE_BASE,
					search_tree, attrs,
					NULL,
					context, callback,
					ac->req);
	LDB_REQ_SET_LOCATION(req);
	if (ret != LDB_SUCCESS) {
		return NULL;
	}

	return req;
}