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