diff options
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/auth_dialog/dialog.c | 2 | ||||
-rw-r--r-- | plugin/auth_pam/Makefile.am | 16 | ||||
-rw-r--r-- | plugin/auth_pam/auth_pam.c | 53 | ||||
-rw-r--r-- | plugin/auth_pam/plug.in | 4 | ||||
-rw-r--r-- | plugin/auth_pam/testing/pam_mariadb_mtr.c | 2 | ||||
-rw-r--r-- | plugin/auth_socket/auth_socket.c | 4 | ||||
-rw-r--r-- | plugin/feedback/Makefile.am | 18 | ||||
-rw-r--r-- | plugin/feedback/feedback.cc | 1 | ||||
-rw-r--r-- | plugin/feedback/plug.in | 28 |
9 files changed, 55 insertions, 73 deletions
diff --git a/plugin/auth_dialog/dialog.c b/plugin/auth_dialog/dialog.c index 2026369bc26..0fa5ab93a35 100644 --- a/plugin/auth_dialog/dialog.c +++ b/plugin/auth_dialog/dialog.c @@ -148,6 +148,8 @@ static int perform_dialog(MYSQL_PLUGIN_VIO *vio, MYSQL *mysql) if (res) return CR_ERROR; + first= 0; + /* repeat unless it was the last question */ } while ((cmd & 1) != 1); diff --git a/plugin/auth_pam/Makefile.am b/plugin/auth_pam/Makefile.am deleted file mode 100644 index be20d393781..00000000000 --- a/plugin/auth_pam/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -EXTRA_LTLIBRARIES = auth_pam.la libauth_pam.la - -pkgplugindir=$(pkglibdir)/plugin -AM_CPPFLAGS = -I$(top_srcdir)/include - -pkgplugin_LTLIBRARIES = @plugin_auth_pam_shared_target@ -auth_pam_la_LDFLAGS = -module -rpath $(pkgplugindir) -L$(top_builddir)/libservices -lmysqlservices -lpam -auth_pam_la_CFLAGS = -shared -DMYSQL_DYNAMIC_PLUGIN -auth_pam_la_SOURCES = auth_pam.c - -noinst_LTLIBRARIES = @plugin_auth_pam_static_target@ -libauth_pam_la_LDFLAGS = -lpam -libauth_pam_la_SOURCES = auth_pam.c - -EXTRA_DIST = plug.in - diff --git a/plugin/auth_pam/auth_pam.c b/plugin/auth_pam/auth_pam.c index 45c49975f6e..fbe2edff449 100644 --- a/plugin/auth_pam/auth_pam.c +++ b/plugin/auth_pam/auth_pam.c @@ -1,5 +1,22 @@ +/* + Copyright (c) 2011, 2012, Monty Program Ab + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #include <mysql/plugin_auth.h> #include <string.h> +#include <my_config.h> #include <security/pam_appl.h> #include <security/pam_modules.h> @@ -8,6 +25,24 @@ struct param { MYSQL_PLUGIN_VIO *vio; }; +/* It least solaris doesn't have strndup */ + +#ifndef HAVE_STRNDUP +char *strndup(const char *from, size_t length) +{ + char *ptr; + size_t max_length= strlen(from); + if (length > max_length) + length= max_length; + if ((ptr= (char*) malloc(length+1)) != 0) + { + memcpy((char*) ptr, (char*) from, length); + ptr[length]=0; + } + return ptr; +} +#endif + static int conv(int n, const struct pam_message **msg, struct pam_response **resp, void *data) { @@ -71,13 +106,21 @@ static int conv(int n, const struct pam_message **msg, #define DO(X) if ((status = (X)) != PAM_SUCCESS) goto end +#ifdef SOLARIS +typedef void** pam_get_item_3_arg; +#else +typedef const void** pam_get_item_3_arg; +#endif + static int pam_auth(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info) { pam_handle_t *pamh = NULL; int status; const char *new_username; struct param param; - struct pam_conv c = { &conv, ¶m }; + /* The following is written in such a way to make also solaris happy */ + struct pam_conv pam_start_arg = { &conv, NULL }; + pam_start_arg.appdata_ptr= (char*) ¶m; /* get the service name, as specified in @@ -90,10 +133,10 @@ static int pam_auth(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info) param.ptr = param.buf + 1; param.vio = vio; - DO( pam_start(service, info->user_name, &c, &pamh) ); + DO( pam_start(service, info->user_name, &pam_start_arg, &pamh) ); DO( pam_authenticate (pamh, 0) ); DO( pam_acct_mgmt(pamh, 0) ); - DO( pam_get_item(pamh, PAM_USER, (const void**)&new_username) ); + DO( pam_get_item(pamh, PAM_USER, (pam_get_item_3_arg) &new_username) ); if (new_username && strcmp(new_username, info->user_name)) strncpy(info->authenticated_as, new_username, @@ -104,7 +147,7 @@ end: return status == PAM_SUCCESS ? CR_OK : CR_ERROR; } -static struct st_mysql_auth pam_info = +static struct st_mysql_auth info = { MYSQL_AUTHENTICATION_INTERFACE_VERSION, "dialog", @@ -114,7 +157,7 @@ static struct st_mysql_auth pam_info = maria_declare_plugin(pam) { MYSQL_AUTHENTICATION_PLUGIN, - &pam_info, + &info, "pam", "Sergei Golubchik", "PAM based authentication", diff --git a/plugin/auth_pam/plug.in b/plugin/auth_pam/plug.in deleted file mode 100644 index 05af6ce6461..00000000000 --- a/plugin/auth_pam/plug.in +++ /dev/null @@ -1,4 +0,0 @@ -MYSQL_PLUGIN(auth_pam, [PAM Authentication Plugin], [PAM Authentication Plugin]) -MYSQL_PLUGIN_DYNAMIC(auth_pam, [auth_pam.la]) - -AC_CHECK_HEADER([security/pam_appl.h],,[MYSQL_PLUGIN_WITHOUT(auth_pam)]) diff --git a/plugin/auth_pam/testing/pam_mariadb_mtr.c b/plugin/auth_pam/testing/pam_mariadb_mtr.c index 73defe30112..8ad1e18e696 100644 --- a/plugin/auth_pam/testing/pam_mariadb_mtr.c +++ b/plugin/auth_pam/testing/pam_mariadb_mtr.c @@ -1,4 +1,6 @@ /* + This code is in the public domain and has no copyright. + Pam module to test pam authentication plugin. Used in pam.test. Linux only. diff --git a/plugin/auth_socket/auth_socket.c b/plugin/auth_socket/auth_socket.c index dbc8513e5dd..41cb1039fd2 100644 --- a/plugin/auth_socket/auth_socket.c +++ b/plugin/auth_socket/auth_socket.c @@ -89,7 +89,7 @@ mysql_declare_plugin(socket_auth) { MYSQL_AUTHENTICATION_PLUGIN, &socket_auth_handler, - "auth_socket", + "unix_socket", "Sergei Golubchik", "Unix Socket based authentication", PLUGIN_LICENSE_GPL, @@ -106,7 +106,7 @@ maria_declare_plugin(socket_auth) { MYSQL_AUTHENTICATION_PLUGIN, &socket_auth_handler, - "auth_socket", + "unix_socket", "Sergei Golubchik", "Unix Socket based authentication", PLUGIN_LICENSE_GPL, diff --git a/plugin/feedback/Makefile.am b/plugin/feedback/Makefile.am deleted file mode 100644 index 7d2a61d593f..00000000000 --- a/plugin/feedback/Makefile.am +++ /dev/null @@ -1,18 +0,0 @@ -pkgplugindir = $(pkglibdir)/plugin -INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include \ - -I$(top_srcdir)/regex -I$(top_srcdir)/sql - -EXTRA_LTLIBRARIES = feedback.la libfeedback.la -pkgplugin_LTLIBRARIES = @plugin_feedback_shared_target@ -feedback_la_LDFLAGS = -module -rpath $(pkgplugindir) -L$(top_builddir)/libservices -lmysqlservices -feedback_la_CXXFLAGS = -shared -DMYSQL_DYNAMIC_PLUGIN -feedback_la_SOURCES = feedback.cc utils.cc url_base.cc url_http.cc \ - sender_thread.cc - -noinst_LTLIBRARIES = @plugin_feedback_static_target@ -libfeedback_la_SOURCES= feedback.cc utils.cc url_base.cc url_http.cc \ - sender_thread.cc - -noinst_HEADERS = feedback.h -EXTRA_DIST = CMakeLists.txt plug.in - diff --git a/plugin/feedback/feedback.cc b/plugin/feedback/feedback.cc index d7342eaa109..f093fd4df25 100644 --- a/plugin/feedback/feedback.cc +++ b/plugin/feedback/feedback.cc @@ -138,6 +138,7 @@ static LEX_STRING vars_filter[]= { {C_STRING_WITH_LEN("ft\\_m%")}, {C_STRING_WITH_LEN("have\\_%")}, {C_STRING_WITH_LEN("%\\_size")}, + {C_STRING_WITH_LEN("innodb_f%")}, {C_STRING_WITH_LEN("%\\_length%")}, {C_STRING_WITH_LEN("%\\_timeout")}, {C_STRING_WITH_LEN("large\\_%")}, diff --git a/plugin/feedback/plug.in b/plugin/feedback/plug.in deleted file mode 100644 index 88a4448321d..00000000000 --- a/plugin/feedback/plug.in +++ /dev/null @@ -1,28 +0,0 @@ -MYSQL_PLUGIN(feedback,[MariaDB User Feedback Plugin], - [MariaDB User Feedback Plugin]) - -dnl Although it's not exactly obvious, top-level CMakeLists.txt parses plug.in -dnl files, in particular looking for what the library name should be. It uses -dnl regexp that matches MYSQL_PLUGIN_DYNAMIC or MYSQL_PLUGIN_STATIC, followed -dnl by an open parenthesys, and the plugin name. Having engine name enclosed in -dnl square brackets below causes this regexp to fail and as a result feedback -dnl plugin will not be considered for dynamic builds on Windows. -dnl Unfortunately, feedback cannot be built dynamically on Windows, because it -dnl needs to access server internals that aren't designed for plugin use and -dnl aren't marked with MYSQL_PLUGIN_IMPORT. -MYSQL_PLUGIN_DYNAMIC([feedback], [feedback.la]) -ifelse(index(AC_PACKAGE_NAME, [MariaDB]), -1, [], [ - -dnl MariaDB and MySQL define static plugins differently. -dnl I only support MariaDB here, for now. -MYSQL_PLUGIN_STATIC(feedback, [libfeedback.la]) - -]) - -dnl MariaDB before 5.5 needs this define: -MYSQL_PLUGIN_DEFINE(feedback, [WITH_FEEDBACK_PLUGIN]) - -MYSQL_PLUGIN_ACTIONS(feedback, [ - AC_CHECK_HEADERS([netdb.h sys/utsname.h]) -]) - |