MySQL 8.0.39
Source Code Documentation
security_context_imp.h
Go to the documentation of this file.
1/* Copyright (c) 2017, 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 SECURITY_CONTEXT_IMP_H
25#define SECURITY_CONTEXT_IMP_H
26
29
30/**
31 An implementation of security_context service methods
32*/
34 public:
35 /**
36 Gets the security context for the thread.
37
38 @sa mysql_thd_security_context::get()
39 */
41 (void *_thd, Security_context_handle *out_ctx));
42
43 /**
44 Sets a new security context for the thread.
45
46 @sa mysql_thd_security_context::set()
47 */
48 static DEFINE_BOOL_METHOD(set, (void *_thd, Security_context_handle in_ctx));
49
50 /**
51 Creates a new security context and initializes it with the defaults
52 (no access, no user etc).
53
54 @sa mysql_security_context_factory::create()
55 */
57
58 /**
59 Deallocates a security context.
60
61 @sa mysql_security_context_factory::destroy()
62 */
64
65 /**
66 Duplicates a security context.
67
68 @sa mysql_security_context_factory::copy()
69 */
71 Security_context_handle *out_ctx));
72
73 /**
74 Looks up in the defined user accounts.
75
76 @sa mysql_account_database_security_context_lookup::lookup()
77 */
79 (Security_context_handle ctx, const char *user,
80 const char *host, const char *ip, const char *db));
81
82 /**
83 Reads a named security context attribute and returns its value.
84
85 @sa mysql_security_context_options::get()
86 */
87 static DEFINE_BOOL_METHOD(get, (Security_context_handle ctx, const char *name,
88 void *inout_pvalue));
89
90 /**
91 Sets a value for a named security context attribute
92
93 @sa mysql_security_context_options::set()
94 */
95 static DEFINE_BOOL_METHOD(set, (Security_context_handle ctx, const char *name,
96 void *pvalue));
97};
98#endif /* SECURITY_CONTEXT_IMP_H */
An implementation of security_context service methods.
Definition: security_context_imp.h:33
static mysql_service_status_t set(void *_thd, Security_context_handle in_ctx) noexcept
Sets a new security context for the thread.
Definition: security_context_imp.cc:65
static mysql_service_status_t lookup(Security_context_handle ctx, const char *user, const char *host, const char *ip, const char *db) noexcept
Looks up in the defined user accounts.
Definition: security_context_imp.cc:173
static mysql_service_status_t destroy(Security_context_handle ctx) noexcept
Deallocates a security context.
Definition: security_context_imp.cc:118
static mysql_service_status_t get(void *_thd, Security_context_handle *out_ctx) noexcept
Gets the security context for the thread.
Definition: security_context_imp.cc:41
static mysql_service_status_t create(Security_context_handle *out_ctx) noexcept
Creates a new security context and initializes it with the defaults (no access, no user etc).
Definition: security_context_imp.cc:99
static mysql_service_status_t copy(Security_context_handle in_ctx, Security_context_handle *out_ctx) noexcept
Duplicates a security context.
Definition: security_context_imp.cc:139
struct Security_context_handle_imp * Security_context_handle
Definition: dynamic_privilege.h:29
char * user
Definition: mysqladmin.cc:60
const char * host
Definition: mysqladmin.cc:59
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
case opt name
Definition: sslopt-case.h:33