Commit 67cf76ad authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV 4691- address review comments

parent 059c0c8b
......@@ -44,11 +44,10 @@ FUNCTION (INSTALL_DEBUG_SYMBOLS)
ENDIF()
set(comp "")
IF(ARG_COMPONENT STREQUAL "Server")
IF(target MATCHES "mysqld" OR type MATCHES "MODULE")
#MESSAGE("PDB: ${targets}")
SET(comp Server)
ENDIF()
IF(target MATCHES "mysqld" OR type MATCHES "MODULE")
#MESSAGE("PDB: ${targets}")
SET(comp Server)
ENDIF()
IF(NOT comp MATCHES Server)
......
......@@ -19,6 +19,7 @@ INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake)
# MYSQL_ADD_PLUGIN(plugin_name source1...sourceN
# [STORAGE_ENGINE]
# [CLIENT]
# [MANDATORY|DEFAULT]
# [STATIC_ONLY|DYNAMIC_ONLY]
# [MODULE_OUTPUT_NAME module_name]
......@@ -30,7 +31,7 @@ INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake)
MACRO(MYSQL_ADD_PLUGIN)
MYSQL_PARSE_ARGUMENTS(ARG
"LINK_LIBRARIES;DEPENDENCIES;MODULE_OUTPUT_NAME;STATIC_OUTPUT_NAME;COMPONENT;CONFIG"
"STORAGE_ENGINE;STATIC_ONLY;MODULE_ONLY;MANDATORY;DEFAULT;DISABLED;RECOMPILE_FOR_EMBEDDED"
"STORAGE_ENGINE;STATIC_ONLY;MODULE_ONLY;MANDATORY;DEFAULT;DISABLED;RECOMPILE_FOR_EMBEDDED;CLIENT"
${ARGN}
)
......@@ -120,7 +121,7 @@ MACRO(MYSQL_ADD_PLUGIN)
# Build either static library or module
IF (PLUGIN_${plugin} MATCHES "(STATIC|AUTO|YES)" AND NOT ARG_MODULE_ONLY
AND NOT ARG_DISABLED)
AND NOT ARG_DISABLED AND NOT ARG_CLIENT)
IF(CMAKE_GENERATOR MATCHES "Makefiles|Ninja")
# If there is a shared library from previous shared build,
......@@ -188,14 +189,14 @@ MACRO(MYSQL_ADD_PLUGIN)
TARGET_LINK_LIBRARIES (${target} mysqlservices ${ARG_LINK_LIBRARIES})
# Plugin uses symbols defined in mysqld executable.
# Server plugins use symbols defined in mysqld executable.
# Some operating systems like Windows and OSX and are pretty strict about
# unresolved symbols. Others are less strict and allow unresolved symbols
# in shared libraries. On Linux for example, CMake does not even add
# executable to the linker command line (it would result into link error).
# Thus we skip TARGET_LINK_LIBRARIES on Linux, as it would only generate
# an additional dependency.
IF(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
IF(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT ARG_CLIENT)
TARGET_LINK_LIBRARIES (${target} mysqld)
ENDIF()
ADD_DEPENDENCIES(${target} GenError ${ARG_DEPENDENCIES})
......@@ -206,19 +207,21 @@ MACRO(MYSQL_ADD_PLUGIN)
IF(ARG_COMPONENT)
IF(CPACK_COMPONENTS_ALL AND
NOT CPACK_COMPONENTS_ALL MATCHES ${ARG_COMPONENT})
SET(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} ${ARG_COMPONENT} PARENT_SCOPE)
SET(CPACK_RPM_${ARG_COMPONENT}_PACKAGE_REQUIRES "MariaDB" PARENT_SCOPE)
IF (NOT ARG_CONFIG)
SET(ARG_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/${target}.cnf")
FILE(WRITE ${ARG_CONFIG} "[mariadb]\nplugin-load-add=${ARG_MODULE_OUTPUT_NAME}.so\n")
ENDIF()
INSTALL(FILES ${ARG_CONFIG} COMPONENT ${ARG_COMPONENT} DESTINATION ${INSTALL_SYSCONF2DIR})
SET(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} ${ARG_COMPONENT})
SET(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} PARENT_SCOPE)
SET(CPACK_RPM_${ARG_COMPONENT}_PACKAGE_REQUIRES "MariaDB" PARENT_SCOPE)
# workarounds for cmake issues #13248 and #12864:
SET(CPACK_RPM_${ARG_COMPONENT}_PACKAGE_PROVIDES "cmake_bug_13248" PARENT_SCOPE)
SET(CPACK_RPM_${ARG_COMPONENT}_PACKAGE_OBSOLETES "cmake_bug_13248" PARENT_SCOPE)
SET(CPACK_RPM_${ARG_COMPONENT}_USER_FILELIST ${ignored} "%config(noreplace) ${INSTALL_SYSCONF2DIR}/*" PARENT_SCOPE)
IF(NOT ARG_CLIENT AND NOT ARG_CONFIG AND UNIX)
SET(ARG_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/${target}.cnf")
FILE(WRITE ${ARG_CONFIG} "[mariadb]\nplugin-load-add=${ARG_MODULE_OUTPUT_NAME}.so\n")
INSTALL(FILES ${ARG_CONFIG} COMPONENT ${ARG_COMPONENT} DESTINATION ${INSTALL_SYSCONF2DIR})
SET(CPACK_RPM_${ARG_COMPONENT}_USER_FILELIST ${ignored} "%config(noreplace) ${INSTALL_SYSCONF2DIR}/*" PARENT_SCOPE)
ENDIF()
ENDIF()
ELSE()
SET(ARG_COMPONENT Server)
......
......@@ -15,4 +15,4 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
MYSQL_ADD_PLUGIN(dialog dialog.c ${CMAKE_SOURCE_DIR}/libmysql/get_password.c
MODULE_ONLY COMPONENT ClientPlugins)
MODULE_ONLY CLIENT COMPONENT ClientPlugins)
......@@ -30,4 +30,4 @@ MYSQL_ADD_PLUGIN(qa_auth_client qa_auth_client.c
MYSQL_ADD_PLUGIN(auth_0x0100 auth_0x0100.c MODULE_ONLY COMPONENT Test)
MYSQL_ADD_PLUGIN(mysql_clear_password clear_password_client.c
MODULE_ONLY COMPONENT ClientPlugins)
MODULE_ONLY CLIENT COMPONENT ClientPlugins)
......@@ -25,9 +25,12 @@ ENDIF ()
MYSQL_ADD_PLUGIN(auth_gssapi server_plugin.cc ${GSSAPI_SERVER} ${GSSAPI_ERRMSG}
LINK_LIBRARIES ${GSSAPI_LIBS}
LINK_LIBRARIES ${GSSAPI_LIBS}
COMPONENT gssapi-server
MODULE_ONLY)
MYSQL_ADD_PLUGIN(auth_gssapi_client client_plugin.cc ${GSSAPI_CLIENT} ${GSSAPI_ERRMSG}
LINK_LIBRARIES ${GSSAPI_LIBS}
COMPONENT gssapi-client
CLIENT
MODULE_ONLY)
......@@ -11,7 +11,7 @@ environment.
## Server-side preparations on Unix
To use the plugin, some preparation need to be done on the server side on Unixes.
MariaDB server will read need access to the Kerberos keytab file, that contains service principal name for the MariaDB server.
MariaDB server will need read access to the Kerberos keytab file, that contains service principal name for the MariaDB server.
If you are using **Unix Kerberos KDC (MIT,Heimdal)**
......@@ -91,7 +91,7 @@ You may also use alternative *short* form of CREATE USER
CREATE USER usr1 IDENTIFIED WITH gssapi;
```
If this syntax is used, realm part is used for comparison
If this syntax is used, realm part is *not* used for comparison
thus 'usr1@EXAMPLE.COM', 'usr1@EXAMPLE.CO.UK' and 'mymachine\usr1' will all identify as 'usr1'.
#Login as GSSAPI user with command line clients
......
/* Copyright (c) 2015, Shuang Qiu, Robbie Hardwood,
/* Copyright (c) 2015, Shuang Qiu, Robbie Harwood,
Vladislav Vaintroub & MariaDB Corporation
All rights reserved.
......
......@@ -8,8 +8,28 @@
# Copyright (c) 2006, Pino Toscano, <toscano.pino@tiscali.it>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
if(GSSAPI_LIBS AND GSSAPI_FLAVOR)
......
/* Copyright (c) 2015, Shuang Qiu, Robbie Hardwood,
/* Copyright (c) 2015, Shuang Qiu, Robbie Harwood,
Vladislav Vaintroub & MariaDB Corporation
All rights reserved.
......
/* Copyright (c) 2015, Shuang Qiu, Robbie Hardwood,
/* Copyright (c) 2015, Shuang Qiu, Robbie Harwood,
Vladislav Vaintroub & MariaDB Corporation
All rights reserved.
......
......@@ -36,11 +36,13 @@ if (!$ENV{'GSSAPI_FULLNAME'} || !$ENV{'GSSAPI_SHORTNAME'})
return "Environment variable GSSAPI_SHORTNAME and GSSAPI_FULLNAME need to be set"
}
foreach $var ('GSSAPI_SHORTNAME','GSSAPI_FULLNAME','GSSAPI_KEYTAB_PATH','GSSAPI_PRINCIPAL_NAME')
if ($::opt_verbose)
{
print "$var=$ENV{$var}\n";
foreach $var ('GSSAPI_SHORTNAME','GSSAPI_FULLNAME','GSSAPI_KEYTAB_PATH','GSSAPI_PRINCIPAL_NAME')
{
print "$var=$ENV{$var}\n";
}
}
sub is_default { 1 }
bless { };
......
/* Copyright (c) 2015, Shuang Qiu, Robbie Hardwood,
/* Copyright (c) 2015, Shuang Qiu, Robbie Harwood,
Vladislav Vaintroub & MariaDB Corporation
All rights reserved.
......@@ -59,6 +59,14 @@ static int gssapi_auth(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *auth_info)
const char *user;
int user_len;
/* No user name yet ? Read the client handshake packet with the user name. */
if (auth_info->user_name == 0)
{
unsigned char *pkt;
if (vio->read_packet(vio, &pkt) < 0)
return CR_ERROR;
}
/* Send first packet with target name and mech name */
if (vio->write_packet(vio, (unsigned char *)first_packet, first_packet_len))
{
......@@ -106,7 +114,7 @@ static int deinitialize_plugin(void *unused)
/* system variable */
static MYSQL_SYSVAR_STR(keytab_path, srv_keytab_path,
PLUGIN_VAR_RQCMDARG|PLUGIN_VAR_READONLY,
"Keytab file path (Kerberos)",
"Keytab file path for Kerberos authentication",
NULL,
NULL,
"");
......@@ -131,7 +139,7 @@ static TYPELIB mech_name_typelib = {
};
static MYSQL_SYSVAR_ENUM(mech_name, srv_mech,
PLUGIN_VAR_RQCMDARG|PLUGIN_VAR_READONLY,
"GSSAPI mechanism : either Kerberos or Negotiate",
"GSSAPI mechanism",
NULL,
NULL,
2,&mech_name_typelib);
......@@ -169,7 +177,7 @@ maria_declare_plugin(gssapi_server)
NULL, /* status variables */
system_variables, /* system variables */
"1.0",
MariaDB_PLUGIN_MATURITY_EXPERIMENTAL
MariaDB_PLUGIN_MATURITY_BETA
}
maria_declare_plugin_end;
/* Copyright (c) 2015, Shuang Qiu, Robbie Hardwood,
/* Copyright (c) 2015, Shuang Qiu, Robbie Harwood,
Vladislav Vaintroub & MariaDB Corporation
All rights reserved.
......
/* Copyright (c) 2015, Shuang Qiu, Robbie Hardwood,
/* Copyright (c) 2015, Shuang Qiu, Robbie Harwood,
Vladislav Vaintroub & MariaDB Corporation
All rights reserved.
......
/* Copyright (c) 2015, Shuang Qiu, Robbie Hardwood,
/* Copyright (c) 2015, Shuang Qiu, Robbie Harwood,
Vladislav Vaintroub & MariaDB Corporation
All rights reserved.
......
/* Copyright (c) 2015, Shuang Qiu, Robbie Hardwood,
/* Copyright (c) 2015, Shuang Qiu, Robbie Harwood,
Vladislav Vaintroub & MariaDB Corporation
All rights reserved.
......
/* Copyright (c) 2015, Shuang Qiu, Robbie Hardwood,
/* Copyright (c) 2015, Shuang Qiu, Robbie Harwood,
Vladislav Vaintroub & MariaDB Corporation
All rights reserved.
......
......@@ -9,7 +9,7 @@ IF(ESSENTIALS)
ENDIF()
ELSE()
SET(CPACK_COMPONENTS_USED
"Server;Client;Development;SharedLibraries;Embedded;Documentation;IniFiles;Readme;Debuginfo;Common;connect-engine")
"Server;Client;Development;SharedLibraries;Embedded;Documentation;IniFiles;Readme;Debuginfo;Common;connect-engine;ClientPlugins;gssapi-server;gssapi-client")
ENDIF()
SET( WIX_FEATURE_MySQLServer_EXTRA_FEATURES "DBInstance;SharedClientServerComponents")
......@@ -54,20 +54,15 @@ SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_DESCRIPTION "Install server")
SET(CPACK_COMPONENT_DEBUGBINARIES_DESCRIPTION
"Debug/trace versions of executables and libraries" )
#SET(CPACK_COMPONENT_DEBUGBINARIES_WIX_LEVEL 2)
#Subfeature "Data Files"
SET(CPACK_COMPONENT_DATAFILES_GROUP "MySQLServer")
SET(CPACK_COMPONENT_DATAFILES_DISPLAY_NAME "Server data files")
SET(CPACK_COMPONENT_DATAFILES_DESCRIPTION "Server data files" )
SET(CPACK_COMPONENT_DATAFILES_HIDDEN 1)
#Subfeature "Connect Engine"
SET(CPACK_COMPONENT_CONNECT-ENGINE_GROUP "MySQLServer")
SET(CPACK_COMPONENT_CONNECT-ENGINE_DISPLAY_NAME "Server data files")
SET(CPACK_COMPONENT_CONNECT-ENGINE_DESCRIPTION "Server data files" )
SET(CPACK_COMPONENT_CONNECT-ENGINE_HIDDEN 1)
#Miscellaneous (hidden) components, part of server / or client programs
FOREACH(comp connect-engine ClientPlugins gssapi-server gssapi-client)
STRING(TOUPPER "${comp}" comp)
SET(CPACK_COMPONENT_${comp}_GROUP "MySQLServer")
SET(CPACK_COMPONENT_${comp}_HIDDEN 1)
ENDFOREACH()
#Feature "Devel"
SET(CPACK_COMPONENT_GROUP_DEVEL_DISPLAY_NAME "Development Components")
SET(CPACK_COMPONENT_GROUP_DEVEL_DESCRIPTION "Installs C/C++ header files and libraries")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment