summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/CMakeLists.txt4
-rw-r--r--client/mysql.cc19
-rw-r--r--client/mysqladmin.cc11
-rw-r--r--cmake/iconv.cmake78
-rw-r--r--include/my_time.h4
-rw-r--r--include/sql_common.h2
-rw-r--r--mysys/my_static.c7
-rw-r--r--mysys/typelib.c7
-rw-r--r--sql-common/get_password.c227
-rw-r--r--sql-common/my_time.c4
-rw-r--r--sql/sql_acl.cc1
-rw-r--r--tests/mysql_client_test.c7
-rw-r--r--tests/nonblock-wrappers.h38
13 files changed, 20 insertions, 389 deletions
diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt
index 87535ea7baa..e0d34b9f5ed 100644
--- a/client/CMakeLists.txt
+++ b/client/CMakeLists.txt
@@ -25,8 +25,6 @@ INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR}
)
-ADD_DEFINITIONS(-DHAVE_OPENSSL=1)
-
INCLUDE_DIRECTORIES(BEFORE
${CMAKE_BINARY_DIR}/libmariadb/include
${CMAKE_SOURCE_DIR}/libmariadb/include)
@@ -34,8 +32,6 @@ INCLUDE_DIRECTORIES(BEFORE
## We will need libeay32.dll and ssleay32.dll when running client executables.
COPY_OPENSSL_DLLS(copy_openssl_client)
-
-ADD_DEFINITIONS(-DHAVE_LIBMARIADB=1)
SET(CLIENT_LIB mariadbclient mysys)
ADD_DEFINITIONS(${SSL_DEFINES})
diff --git a/client/mysql.cc b/client/mysql.cc
index 181320e436e..65b7c192595 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -1367,8 +1367,6 @@ static bool do_connect(MYSQL *mysql, const char *host, const char *user,
opt_ssl_capath, opt_ssl_cipher);
mysql_options(mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl);
mysql_options(mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath);
- char enforce= 1;
- mysql_options(mysql, MYSQL_OPT_SSL_ENFORCE, &enforce);
}
mysql_options(mysql,MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
(char*)&opt_ssl_verify_server_cert);
@@ -4621,23 +4619,6 @@ sql_real_connect(char *host,char *database,char *user,char *password,
mysql_options(&mysql,MYSQL_OPT_COMPRESS,NullS);
if (using_opt_local_infile)
mysql_options(&mysql,MYSQL_OPT_LOCAL_INFILE, (char*) &opt_local_infile);
-#if !defined(EMBEDDED_LIBRARY)
- if (opt_use_ssl)
- {
- mysql_ssl_set(&mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
- opt_ssl_capath, opt_ssl_cipher);
- mysql_options(&mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl);
- mysql_options(&mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath);
- }
- mysql_options(&mysql,MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
- (my_bool*)&opt_ssl_verify_server_cert);
-#endif
- if (opt_protocol)
- mysql_options(&mysql,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol);
-#ifdef HAVE_SMEM
- if (shared_memory_base_name)
- mysql_options(&mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name);
-#endif
if (safe_updates)
{
char init_command[100];
diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc
index fcc4e626f2f..d186a4c7fcc 100644
--- a/client/mysqladmin.cc
+++ b/client/mysqladmin.cc
@@ -22,7 +22,6 @@
#include <my_pthread.h> /* because of signal() */
#include <sys/stat.h>
#include <mysql.h>
-#include <sql_common.h>
#include <mysql_version.h>
#include <welcome_copyright_notice.h>
#include <my_rnd.h>
@@ -545,16 +544,16 @@ static my_bool sql_connect(MYSQL *mysql, uint wait)
{
fprintf(stderr,
"Check that mysqld is running and that the socket: '%s' exists!\n",
- unix_port ? unix_port : MYSQL_UNIX_ADDR);
+ unix_port ? unix_port : mysql_unix_port);
}
else if (mysql_errno(mysql) == CR_CONN_HOST_ERROR ||
mysql_errno(mysql) == CR_UNKNOWN_HOST)
{
fprintf(stderr,"Check that mysqld is running on %s",host);
fprintf(stderr," and that the port is %d.\n",
- tcp_port ? tcp_port: MYSQL_PORT);
+ tcp_port ? tcp_port: mysql_port);
fprintf(stderr,"You can check this by doing 'telnet %s %d'\n",
- host, tcp_port ? tcp_port: MYSQL_PORT);
+ host, tcp_port ? tcp_port: mysql_port);
}
}
return 1;
@@ -1080,9 +1079,9 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
}
}
if (old)
- my_make_scrambled_password_323(crypted_pw, typed_password, sizeof(crypted_pw));
+ my_make_scrambled_password_323(crypted_pw, typed_password, strlen(typed_password));
else
- my_make_scrambled_password(crypted_pw, typed_password, sizeof(crypted_pw));
+ my_make_scrambled_password(crypted_pw, typed_password, strlen(typed_password));
}
else
crypted_pw[0]=0; /* No password */
diff --git a/cmake/iconv.cmake b/cmake/iconv.cmake
deleted file mode 100644
index f6afd9d102a..00000000000
--- a/cmake/iconv.cmake
+++ /dev/null
@@ -1,78 +0,0 @@
-#
-# Copyright (c) 2010 Michael Bell <michael.bell@web.de>
-# 2015-2016 MariaDB Corporation AB
-
-if (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
- # Already in cache, be silent
- set(ICONV_FIND_QUIETLY TRUE)
-endif (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
-
-
-IF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
- # There is some libiconv.so in /usr/local that must
- # be avoided, iconv routines are in libc
- find_library(ICONV_LIBRARIES NAMES c)
-ELSEIF(APPLE)
- find_path(ICONV_INCLUDE_DIR iconv.h PATHS
- /usr/include/
- /opt/local/include/
- )
- find_library(ICONV_LIBRARIES NAMES iconv libiconv PATHS
- /usr/lib/
- /opt/local/lib/
- )
- SET(ICONV_EXTERNAL TRUE)
-ELSE()
- find_path(ICONV_INCLUDE_DIR iconv.h)
- find_library(ICONV_LIBRARIES NAMES iconv libiconv libiconv-2)
- IF(ICONV_LIBRARIES)
- SET(ICONV_EXTERNAL TRUE)
- ELSE()
- find_library(ICONV_LIBRARIES NAMES c)
- ENDIF()
-ENDIF()
-
-if (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
- set (ICONV_FOUND TRUE)
-endif (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
-
-set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR})
-IF(ICONV_EXTERNAL)
- set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES})
-ENDIF()
-
-if (ICONV_FOUND)
- include(CheckCSourceCompiles)
- CHECK_C_SOURCE_COMPILES("
- #include <iconv.h>
- int main(){
- iconv_t conv = 0;
- const char* in = 0;
- size_t ilen = 0;
- char* out = 0;
- size_t olen = 0;
- iconv(conv, &in, &ilen, &out, &olen);
- return 0;
- }
-" ICONV_SECOND_ARGUMENT_IS_CONST )
-endif (ICONV_FOUND)
-
-set (CMAKE_REQUIRED_INCLUDES)
-set (CMAKE_REQUIRED_LIBRARIES)
-
-if (ICONV_FOUND)
- if (NOT ICONV_FIND_QUIETLY)
- message (STATUS "Found Iconv: ${ICONV_LIBRARIES}")
- endif (NOT ICONV_FIND_QUIETLY)
-else (ICONV_FOUND)
- if (Iconv_FIND_REQUIRED)
- message (FATAL_ERROR "Could not find Iconv")
- endif (Iconv_FIND_REQUIRED)
-endif (ICONV_FOUND)
-
-MARK_AS_ADVANCED(
- ICONV_INCLUDE_DIR
- ICONV_LIBRARIES
- ICONV_EXTERNAL
- ICONV_SECOND_ARGUMENT_IS_CONST
-)
diff --git a/include/my_time.h b/include/my_time.h
index a5fe7858797..8dc1f09ba0f 100644
--- a/include/my_time.h
+++ b/include/my_time.h
@@ -171,6 +171,10 @@ static inline my_bool validate_timestamp_range(const MYSQL_TIME *t)
return TRUE;
}
+/* Can't include mysqld_error.h, it needs mysys to build, thus hardcode 2 error values here. */
+#define ER_WARN_DATA_OUT_OF_RANGE 1264
+#define ER_WARN_INVALID_TIMESTAMP 1299
+
my_time_t
my_system_gmt_sec(const MYSQL_TIME *t, long *my_timezone, uint *error_code);
diff --git a/include/sql_common.h b/include/sql_common.h
index 6fdef6fef2b..49616f6d56c 100644
--- a/include/sql_common.h
+++ b/include/sql_common.h
@@ -113,7 +113,9 @@ void set_mysql_extended_error(MYSQL *mysql, int errcode, const char *sqlstate,
const char *format, ...);
/* client side of the pluggable authentication */
+struct st_vio;
struct st_plugin_vio_info;
+void mpvio_info(struct st_vio *vio, struct st_plugin_vio_info *info);
int run_plugin_auth(MYSQL *mysql, char *data, uint data_len,
const char *data_plugin, const char *db);
int mysql_client_plugin_init();
diff --git a/mysys/my_static.c b/mysys/my_static.c
index 4aca78e30a9..ce9e8831be6 100644
--- a/mysys/my_static.c
+++ b/mysys/my_static.c
@@ -98,3 +98,10 @@ my_bool my_disable_sync=0;
my_bool my_disable_async_io=0;
my_bool my_disable_flush_key_blocks=0;
my_bool my_disable_symlinks=0;
+
+/* Typelib by all clients */
+const char *sql_protocol_names_lib[] =
+{ "TCP", "SOCKET", "PIPE", "MEMORY", NullS };
+
+TYPELIB sql_protocol_typelib ={ array_elements(sql_protocol_names_lib) - 1, "",
+ sql_protocol_names_lib, NULL };
diff --git a/mysys/typelib.c b/mysys/typelib.c
index bb4499020df..75744a65ec8 100644
--- a/mysys/typelib.c
+++ b/mysys/typelib.c
@@ -409,10 +409,3 @@ my_ulonglong find_set_from_flags(const TYPELIB *lib, uint default_name,
return res;
}
-/* Typelib by all clients */
-const char *sql_protocol_names_lib[] =
-{ "TCP", "SOCKET", "PIPE", "MEMORY", NullS };
-
-TYPELIB sql_protocol_typelib ={ array_elements(sql_protocol_names_lib) - 1, "",
-sql_protocol_names_lib, NULL };
-
diff --git a/sql-common/get_password.c b/sql-common/get_password.c
deleted file mode 100644
index a113306ed57..00000000000
--- a/sql-common/get_password.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
-
- 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.
-
- There are special exceptions to the terms and conditions of the GPL as it
- is applied to this software.
-
- 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
-
-/*
-** Ask for a password from tty
-** This is an own file to avoid conflicts with curses
-*/
-#include <my_global.h>
-#include <my_sys.h>
-#include "mysql.h"
-#include <m_string.h>
-#include <m_ctype.h>
-
-#ifdef HAVE_GETPASS
-#ifdef HAVE_PWD_H
-#include <pwd.h>
-#endif /* HAVE_PWD_H */
-#else /* ! HAVE_GETPASS */
-#if !defined(__WIN__)
-#include <sys/ioctl.h>
-#ifdef HAVE_TERMIOS_H /* For tty-password */
-#include <termios.h>
-#define TERMIO struct termios
-#else
-#ifdef HAVE_TERMIO_H /* For tty-password */
-#include <termio.h>
-#define TERMIO struct termio
-#else
-#include <sgtty.h>
-#define TERMIO struct sgttyb
-#endif
-#endif
-#ifdef alpha_linux_port
-#include <asm/ioctls.h>
-#include <asm/termiobits.h>
-#endif
-#else
-#include <conio.h>
-#endif /* __WIN__ */
-#endif /* HAVE_GETPASS */
-
-#ifdef HAVE_GETPASSPHRASE /* For Solaris */
-#define getpass(A) getpassphrase(A)
-#endif
-
-#if defined(__WIN__)
-/* were just going to fake it here and get input from the keyboard */
-void get_tty_password_buff(const char *opt_message, char *to, size_t length)
-{
- HANDLE consoleinput;
- DWORD oldstate;
- char *pos=to,*end=to+length-1;
- int i=0;
-
- consoleinput= CreateFile("CONIN$", GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ ,
- NULL, OPEN_EXISTING, 0, NULL);
- if (consoleinput == NULL || consoleinput == INVALID_HANDLE_VALUE)
- {
- /* This is a GUI application or service without console input, bail out. */
- *to= 0;
- return;
- }
- _cputs(opt_message ? opt_message : "Enter password: ");
-
- /*
- Switch to raw mode (no line input, no echo input).
- Allow Ctrl-C handler with ENABLE_PROCESSED_INPUT.
- */
- GetConsoleMode(consoleinput, &oldstate);
- SetConsoleMode(consoleinput, ENABLE_PROCESSED_INPUT);
- for (;;)
- {
- char tmp;
- DWORD chars_read;
- if (!ReadConsole(consoleinput, &tmp, 1, &chars_read, NULL))
- break;
- if (chars_read == 0)
- break;
- if (tmp == '\b' || tmp == 127)
- {
- if (pos != to)
- {
- _cputs("\b \b");
- pos--;
- continue;
- }
- }
- if (tmp == '\n' || tmp == '\r')
- break;
- if (iscntrl(tmp) || pos == end)
- continue;
- _cputs("*");
- *(pos++) = tmp;
- }
- /* Reset console mode after password input. */
- SetConsoleMode(consoleinput, oldstate);
- CloseHandle(consoleinput);
- *pos=0;
- _cputs("\n");
-}
-
-#else
-
-#ifndef HAVE_GETPASS
-/*
- Can't use fgets, because readline will get confused
- length is max number of chars in to, not counting \0
- to will not include the eol characters.
-*/
-
-static void get_password(char *to,uint length,int fd, my_bool echo)
-{
- char *pos=to,*end=to+length;
-
- for (;;)
- {
- char tmp;
- if (my_read(fd,&tmp,1,MYF(0)) != 1)
- break;
- if (tmp == '\b' || (int) tmp == 127)
- {
- if (pos != to)
- {
- if (echo)
- {
- fputs("\b \b",stdout);
- fflush(stdout);
- }
- pos--;
- continue;
- }
- }
- if (tmp == '\n' || tmp == '\r' || tmp == 3)
- break;
- if (iscntrl(tmp) || pos == end)
- continue;
- if (echo)
- {
- fputc('*',stdout);
- fflush(stdout);
- }
- *(pos++) = tmp;
- }
- *pos=0;
- return;
-}
-#endif /* ! HAVE_GETPASS */
-
-
-void get_tty_password_buff(const char *opt_message, char *buff, size_t buflen)
-{
-#ifdef HAVE_GETPASS
- char *passbuff;
-#else /* ! HAVE_GETPASS */
- TERMIO org,tmp;
-#endif /* HAVE_GETPASS */
-
-#ifdef HAVE_GETPASS
- passbuff = getpass(opt_message ? opt_message : "Enter password: ");
-
- /* copy the password to buff and clear original (static) buffer */
- strncpy(buff, passbuff, buflen - 1);
-#ifdef _PASSWORD_LEN
- memset(passbuff, 0, _PASSWORD_LEN);
-#endif
-#else
- if (isatty(fileno(stdout)))
- {
- fputs(opt_message ? opt_message : "Enter password: ",stdout);
- fflush(stdout);
- }
-#if defined(HAVE_TERMIOS_H)
- tcgetattr(fileno(stdin), &org);
- tmp = org;
- tmp.c_lflag &= ~(ECHO | ISIG | ICANON);
- tmp.c_cc[VMIN] = 1;
- tmp.c_cc[VTIME] = 0;
- tcsetattr(fileno(stdin), TCSADRAIN, &tmp);
- get_password(buff, buflen, fileno(stdin), isatty(fileno(stdout)));
- tcsetattr(fileno(stdin), TCSADRAIN, &org);
-#elif defined(HAVE_TERMIO_H)
- ioctl(fileno(stdin), (int) TCGETA, &org);
- tmp=org;
- tmp.c_lflag &= ~(ECHO | ISIG | ICANON);
- tmp.c_cc[VMIN] = 1;
- tmp.c_cc[VTIME]= 0;
- ioctl(fileno(stdin),(int) TCSETA, &tmp);
- get_password(buff,buflen-1,fileno(stdin),isatty(fileno(stdout)));
- ioctl(fileno(stdin),(int) TCSETA, &org);
-#else
- gtty(fileno(stdin), &org);
- tmp=org;
- tmp.sg_flags &= ~ECHO;
- tmp.sg_flags |= RAW;
- stty(fileno(stdin), &tmp);
- get_password(buff,buflen-1,fileno(stdin),isatty(fileno(stdout)));
- stty(fileno(stdin), &org);
-#endif
- if (isatty(fileno(stdout)))
- fputc('\n',stdout);
-#endif /* HAVE_GETPASS */
-}
-#endif /*__WIN__*/
-
-#ifndef MYSQL_DYNAMIC_PLUGIN
-char *get_tty_password(const char *opt_message)
-{
- char buff[80];
- get_tty_password_buff(opt_message, buff, sizeof(buff));
- return my_strdup(buff, MYF(MY_FAE));
-}
-#endif
diff --git a/sql-common/my_time.c b/sql-common/my_time.c
index 5fcb07e45c0..450a0fca775 100644
--- a/sql-common/my_time.c
+++ b/sql-common/my_time.c
@@ -777,10 +777,6 @@ long calc_daynr(uint year,uint month,uint day)
DBUG_RETURN(delsum+(int) y/4-temp);
} /* calc_daynr */
-/* Can't include mysqld_error.h, it needs mysys to build, thus hardcode 2 error values here. */
-#define ER_WARN_DATA_OUT_OF_RANGE 1264
-#define ER_WARN_INVALID_TIMESTAMP 1299
-
/*
Convert time in MYSQL_TIME representation in system time zone to its
my_time_t form (number of seconds in UTC since begginning of Unix Epoch).
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 592631da5d8..37e6e769a89 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -12283,7 +12283,6 @@ err:
DBUG_RETURN(-1);
}
-extern "C" void mpvio_info(Vio *vio, struct st_plugin_vio_info *info);
/**
fills MYSQL_PLUGIN_VIO_INFO structure with the information about the
connection
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 76db1f62f85..66955a14fa5 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -6350,19 +6350,16 @@ static void test_pure_coverage()
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
-#if 0
- /* MariaDB C/C converts geometry to string */
my_bind[0].buffer_type= MYSQL_TYPE_GEOMETRY;
rc= mysql_stmt_bind_result(stmt, my_bind);
- check_execute_r(stmt, rc); /* unsupported buffer type */
+ check_execute(stmt, rc); /* MariaDB C/C converts geometry to string */
rc= mysql_stmt_store_result(stmt);
- DIE_UNLESS(rc);
+ DIE_IF(rc);
rc= mysql_stmt_store_result(stmt);
DIE_UNLESS(rc); /* Old error must be reset first */
-#endif
mysql_stmt_close(stmt);
mysql_query(mysql, "DROP TABLE test_pure");
diff --git a/tests/nonblock-wrappers.h b/tests/nonblock-wrappers.h
index fd50e4e4ee6..78851854442 100644
--- a/tests/nonblock-wrappers.h
+++ b/tests/nonblock-wrappers.h
@@ -321,44 +321,6 @@ MK_WRAPPER(
mysql,
mysql)
-#ifdef HAVE_DEPRECATED_ASYNC_API
-MK_WRAPPER(
- MYSQL_RES *,
- mysql_list_dbs,
- (MYSQL *mysql, const char *wild),
- (&res, mysql, wild),
- (mysql, wild),
- mysql,
- mysql)
-
-MK_WRAPPER(
- MYSQL_RES *,
- mysql_list_tables,
- (MYSQL *mysql, const char *wild),
- (&res, mysql, wild),
- (mysql, wild),
- mysql,
- mysql)
-
-MK_WRAPPER(
- MYSQL_RES *,
- mysql_list_processes,
- (MYSQL *mysql),
- (&res, mysql),
- (mysql),
- mysql,
- mysql)
-
-MK_WRAPPER(
- MYSQL_RES *,
- mysql_list_fields,
- (MYSQL *mysql, const char *table, const char *wild),
- (&res, mysql, table, wild),
- (mysql, table, wild),
- mysql,
- mysql)
-#endif /* HAVE_DEPRECATED_ASYNC_API */
-
MK_WRAPPER(
my_bool,
mysql_read_query_result,