MySQL 9.0.0
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#ifndef AUTHETICATION_KERBEROS_CLIENTOPT_VARS_H
25#define AUTHETICATION_KERBEROS_CLIENTOPT_VARS_H
26
27#if defined(_WIN32)
28#include "m_string.h"
29#include "mysql.h"
30#include "template_utils.h"
31#include "typelib.h"
32
33#include <cstdio>
34
35using std::snprintf;
36
37const char *client_mode_names_lib[] = {"SSPI", "GSSAPI", NullS};
38
39TYPELIB client_mode_typelib = {array_elements(client_mode_names_lib) - 1, "",
40 client_mode_names_lib, nullptr};
41
42static int opt_authentication_kerberos_client_mode = 0;
43
44static int set_authentication_kerberos_client_mode(MYSQL *mysql, char *error,
45 size_t error_size) {
46 if (opt_authentication_kerberos_client_mode == 1) {
47 struct st_mysql_client_plugin *kerberos_client_plugin =
48 mysql_client_find_plugin(mysql, "authentication_kerberos_client",
50 if (!kerberos_client_plugin) {
51 snprintf(error, error_size,
52 "Failed to load plugin authentication_kerberos_client.");
53 return 1;
54 }
55
57 kerberos_client_plugin,
58 "plugin_authentication_kerberos_client_mode",
59 client_mode_names_lib[opt_authentication_kerberos_client_mode])) {
60 snprintf(error, error_size,
61 "Failed to set value '%s' for "
62 "--plugin-authentication-kerberos-client-mode",
63 client_mode_names_lib[opt_authentication_kerberos_client_mode]);
64 return 1;
65 }
66 }
67 return 0;
68}
69#endif /* _WIN32 */
70
71#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:657
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:630
#define MYSQL_CLIENT_AUTHENTICATION_PLUGIN
Definition: client_plugin.h:80
This file defines the client API to MySQL and also the ABI of the dynamically linked libmysqlclient.
void error(const char *format,...)
Definition: instrumented_condition_variable.h:32
#define NullS
Definition of the null string (a null pointer of type char *), used in some of our string handling co...
Definition: nulls.h:33
Definition: mysql.h:300
Definition: typelib.h:35
Definition: client_plugin.h:114
#define array_elements(A)
Definition: validate_password_imp.cc:48