Commit 629cdab8 authored by Michael Widenius's avatar Michael Widenius

Fixed compiler and test failures found by buildbot

configure.in:
  Added testing of STRNDUP (not found on solaris)
mysql-test/include/wait_until_connected_again.inc:
  Also test for error 2005 (can happen on windows)
mysql-test/include/wait_until_disconnected.inc:
  Also test for error 2005 (can happen on windows)
mysql-test/suite/innodb_plugin/r/innodb_bug30423.result:
  Number of rows is not stable (found difference on Solaris)
mysql-test/suite/innodb_plugin/t/innodb_bug30423.test:
  Number of rows is not stable (found difference on Solaris)
plugin/auth_pam/auth_pam.c:
  Use internal strndup if it doesn't exist on system (solaris)
  Changed code so that it should also compile on solaris.
parent 7e576c07
......@@ -2033,7 +2033,7 @@ dnl Checks for library functions.
AC_FUNC_ALLOCA
AC_PROG_GCC_TRADITIONAL
AC_TYPE_SIGNAL
AC_CHECK_FUNCS(re_comp regcomp strdup)
AC_CHECK_FUNCS(re_comp regcomp strdup strndup)
dnl Sun compilers have their own vis.h that is about something
dnl totally different. So, not to change the libedit source, we
......
......@@ -14,7 +14,7 @@ while ($mysql_errno)
# Strangely enough, the server might return "Too many connections"
# while being shutdown, thus 1040 is an "allowed" error
# See BUG#36228
--error 0,1040,1053,2002,2003,2006,2013
--error 0,1040,1053,2002,2003,2005,2006,2013
show status;
dec $counter;
......
......@@ -12,7 +12,7 @@ while (!$mysql_errno)
# Strangely enough, the server might return "Too many connections"
# while being shutdown, thus 1040 is an "allowed" error.
# See BUG#36228.
--error 0,1040,1053,2002,2003,2006,2013
--error 0,1040,1053,2002,2003,2005,2006,2013
show status;
dec $counter;
......
......@@ -48,9 +48,9 @@ ON orgs.org_id=sa_opportunities.org_id
LEFT JOIN bug30243_2 contacts
ON orgs.org_id=contacts.org_id ;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE orgs index NULL org_id 4 NULL 128 Using index
1 SIMPLE sa_opportunities ref org_id org_id 5 test.orgs.org_id 1 Using index
1 SIMPLE contacts ref contacts$org_id contacts$org_id 5 test.orgs.org_id 1 Using index
1 SIMPLE orgs index NULL org_id 4 NULL # Using index
1 SIMPLE sa_opportunities ref org_id org_id 5 test.orgs.org_id # Using index
1 SIMPLE contacts ref contacts$org_id contacts$org_id 5 test.orgs.org_id # Using index
select @@innodb_stats_method;
@@innodb_stats_method
nulls_ignored
......
......@@ -140,6 +140,7 @@ analyze table bug30243_3;
# Following query plan shows that we get the correct rows per
# unique value (should be approximately 1 row per value)
--replace_column 9 #
explain SELECT COUNT(*), 0
FROM bug30243_1 orgs
LEFT JOIN bug30243_3 sa_opportunities
......
#include <mysql/plugin_auth.h>
#include <string.h>
#include <my_config.h>
#include <security/pam_appl.h>
#include <security/pam_modules.h>
......@@ -8,6 +9,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 +90,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, &param };
/* 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*) &param;
/*
get the service name, as specified in
......@@ -90,10 +117,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,
......
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