MySQL 8.0.30
Source Code Documentation
dynamic_loader_path_filter_imp.h
Go to the documentation of this file.
1/* Copyright (c) 2016, 2022, 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 also distributed 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 included with MySQL.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU General Public License, version 2.0, for more details.
18
19You should have received a copy of the GNU General Public License
20along with this program; if not, write to the Free Software
21Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23#ifndef MYSQL_SERVER_DYNAMIC_LOADER_PATH_FILTER_H
24#define MYSQL_SERVER_DYNAMIC_LOADER_PATH_FILTER_H
25
28#include <string>
29
30/**
31 Checks if path specified to load is contained in plug-in directory and
32 change it to absolute one using plug-in directory. Calls wrapped file scheme
33 service implementation on calculated absolute URN. Effectively it act as a
34 filtering and mapping service.
35*/
37 public:
38 /**
39 Checks if path specified to load is contained in plug-in directory and
40 change it to absolute one using plug-in directory. Calls wrapped file scheme
41 service implementation on calculated absolute URN.
42
43 @param urn URN to file to load components from.
44 @param [out] out_data Pointer to pointer to MySQL component data structures
45 to set result components data retrieved from specified file.
46 @return Status of performed operation
47 @retval false success
48 @retval true failure
49 */
51 (const char *urn, mysql_component_t **out_data));
52
53 /**
54 Checks if path specified to load is contained in plug-in directory and
55 change it to absolute one using plug-in directory. Calls wrapped file scheme
56 service implementation on calculated absolute URN.
57
58 @param urn URN to file to unload all components from.
59 @return Status of performed operation
60 @retval false success
61 @retval true failure
62 */
63 static DEFINE_BOOL_METHOD(unload, (const char *urn));
64
65 private:
66 /**
67 Ensure that the dynamic library doesn't have a path.
68 This is done to ensure that only approved libraries from the
69 plug-in directory are used (to make this even remotely secure).
70 Extracts real absolute path to file in plug-in directory.
71
72 @param input_urn URN with path to validate and make absolute.
73 @param [out] out_path String to put result URN to.
74 */
75 static bool check_and_make_absolute_urn(const char *input_urn,
76 std::string &out_path);
77};
78
79#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:36
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:81
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:56
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:104
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:87
Carries information on the specific Component, all Service Implementations it provides,...
Definition: dynamic_loader.h:262