MySQL 8.0.40
Source Code Documentation
authentication_kerberos_clientopt-vars.h
Go to the documentation of this file.
1/* Copyright (c) 2022, 2024, Oracle and/or its affiliates.
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 designed to work 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 either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24/**
25 @file include/authentication_kerberos_clientopt-vars.h
26*/
27
28#ifndef AUTHETICATION_KERBEROS_CLIENTOPT_VARS_H
29#define AUTHETICATION_KERBEROS_CLIENTOPT_VARS_H
30
31#if defined(_WIN32)
32#include "m_string.h"
33#include "mysql.h"
34#include "template_utils.h"
35#include "typelib.h"
36
37#include <cstdio>
38
39using std::snprintf;
40
41const char *client_mode_names_lib[] = {"SSPI", "GSSAPI", NullS};
42
43TYPELIB client_mode_typelib = {array_elements(client_mode_names_lib) - 1, "",
44 client_mode_names_lib, nullptr};
45
46static int opt_authentication_kerberos_client_mode = 0;
47
48static int set_authentication_kerberos_client_mode(MYSQL *mysql, char *error,
49 size_t error_size) {
50 if (opt_authentication_kerberos_client_mode == 1) {
51 struct st_mysql_client_plugin *kerberos_client_plugin =
52 mysql_client_find_plugin(mysql, "authentication_kerberos_client",
54 if (!kerberos_client_plugin) {
55 snprintf(error, error_size,
56 "Failed to load plugin authentication_kerberos_client.");
57 return 1;
58 }
59
61 kerberos_client_plugin,
62 "plugin_authentication_kerberos_client_mode",
63 client_mode_names_lib[opt_authentication_kerberos_client_mode])) {
64 snprintf(error, error_size,
65 "Failed to set value '%s' for "
66 "--plugin-authentication-kerberos-client-mode",
67 client_mode_names_lib[opt_authentication_kerberos_client_mode]);
68 return 1;
69 }
70 }
71 return 0;
72}
73#endif /* _WIN32 */
74
75#endif // !AUTHETICATION_KERBEROS_CLIENTOPT_VARS_H
int mysql_plugin_options(struct st_mysql_client_plugin *plugin, const char *option, const void *value)
set plugin options
Definition: client_plugin.cc:581
struct st_mysql_client_plugin * mysql_client_find_plugin(struct MYSQL *mysql, const char *name, int type)
finds an already loaded plugin by name, or loads it, if necessary
Definition: client_plugin.cc:554
#define MYSQL_CLIENT_AUTHENTICATION_PLUGIN
Definition: client_plugin.h:80
#define NullS
Definition of the null string (a null pointer of type char *), used in some of our string handling co...
Definition: m_string.h:53
This file defines the client API to MySQL and also the ABI of the dynamically linked libmysqlclient.
Log error(cerr, "ERROR")
Definition: instrumented_condition_variable.h:32
Definition: mysql.h:299
Definition: typelib.h:35
Definition: client_plugin.h:112
#define array_elements(A)
Definition: validate_password_imp.cc:48