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