MySQL  8.0.17
Source Code Documentation
security_context_imp.h
Go to the documentation of this file.
1 /* Copyright (c) 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 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  */
39  static DEFINE_BOOL_METHOD(get,
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 retuns 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 */
char * user
Definition: mysqladmin.cc:58
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:141
An implementation of security_context service methods.
Definition: security_context_imp.h:32
const string name("\ame\)
#define DEFINE_BOOL_METHOD(name, args)
const char * host
Definition: mysqladmin.cc:57
static mysql_service_status_t destroy(Security_context_handle ctx) noexcept
Deallocates a security context.
Definition: security_context_imp.cc:120
struct Security_context_handle_imp * Security_context_handle
Definition: dynamic_privilege.h:28
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:175
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:101
Specifies macros to define Service Implementations.