MySQL 8.4.0
Source Code Documentation
dynamic_loader_path_filter_imp.h
Go to the documentation of this file.
1/* Copyright (c) 2016, 2024, Oracle and/or its affiliates.
2
3This program is free software; you can redistribute it and/or modify
4it under the terms of the GNU General Public License, version 2.0,
5as published by the Free Software Foundation.
6
7This program is designed to work with certain software (including
8but not limited to OpenSSL) that is licensed under separate terms,
9as designated in a particular file or component or in included license
10documentation. The authors of MySQL hereby grant you an additional
11permission to link the program and your derivative works with the
12separately licensed software that they have either included with
13the program or referenced in the documentation.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License, version 2.0, for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef MYSQL_SERVER_DYNAMIC_LOADER_PATH_FILTER_H
25#define MYSQL_SERVER_DYNAMIC_LOADER_PATH_FILTER_H
26
29#include <string>
30
31/**
32 Checks if path specified to load is contained in plug-in directory and
33 change it to absolute one using plug-in directory. Calls wrapped file scheme
34 service implementation on calculated absolute URN. Effectively it act as a
35 filtering and mapping service.
36*/
38 public:
39 /**
40 Checks if path specified to load is contained in plug-in directory and
41 change it to absolute one using plug-in directory. Calls wrapped file scheme
42 service implementation on calculated absolute URN.
43
44 @param urn URN to file to load components from.
45 @param [out] out_data Pointer to pointer to MySQL component data structures
46 to set result components data retrieved from specified file.
47 @return Status of performed operation
48 @retval false success
49 @retval true failure
50 */
52 (const char *urn, mysql_component_t **out_data));
53
54 /**
55 Checks if path specified to load is contained in plug-in directory and
56 change it to absolute one using plug-in directory. Calls wrapped file scheme
57 service implementation on calculated absolute URN.
58
59 @param urn URN to file to unload all components from.
60 @return Status of performed operation
61 @retval false success
62 @retval true failure
63 */
64 static DEFINE_BOOL_METHOD(unload, (const char *urn));
65
66 private:
67 /**
68 Ensure that the dynamic library doesn't have a path.
69 This is done to ensure that only approved libraries from the
70 plug-in directory are used (to make this even remotely secure).
71 Extracts real absolute path to file in plug-in directory.
72
73 @param input_urn URN with path to validate and make absolute.
74 @param [out] out_path String to put result URN to.
75 */
76 static bool check_and_make_absolute_urn(const char *input_urn,
77 std::string &out_path);
78};
79
80#endif /* MYSQL_SERVER_DYNAMIC_LOADER_PATH_FILTER_H */
Checks if path specified to load is contained in plug-in directory and change it to absolute one usin...
Definition: dynamic_loader_path_filter_imp.h:37
static mysql_service_status_t unload(const char *urn) noexcept
Checks if path specified to load is contained in plug-in directory and change it to absolute one usin...
Definition: dynamic_loader_path_filter.cc:84
static mysql_service_status_t load(const char *urn, mysql_component_t **out_data) noexcept
Checks if path specified to load is contained in plug-in directory and change it to absolute one usin...
Definition: dynamic_loader_path_filter.cc:59
static bool check_and_make_absolute_urn(const char *input_urn, std::string &out_path)
Ensure that the dynamic library doesn't have a path.
Definition: dynamic_loader_path_filter.cc:107
Specifies macros to define Components.
Specifies macros to define Service Implementations.
#define DEFINE_BOOL_METHOD(name, args)
A short macro to define method that returns bool, which is the most common case.
Definition: service_implementation.h:88
Carries information on the specific Component, all Service Implementations it provides,...
Definition: dynamic_loader.h:263