summaryrefslogtreecommitdiff
path: root/libmysql
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-03-27 23:41:02 +0100
committerSergei Golubchik <sergii@pisem.net>2013-03-27 23:41:02 +0100
commit993ea79f2df42292eceeee394e8ece9f4a3f6cf2 (patch)
treed105c8288a89a25d412e9006b740c756db6326d6 /libmysql
parent1827d9591e24ee469527021771088d842ab18374 (diff)
parent6599fd3e9c23a8957a63146cbe6a0ffc4c292a3d (diff)
downloadmariadb-git-993ea79f2df42292eceeee394e8ece9f4a3f6cf2.tar.gz
5.5 merge
Diffstat (limited to 'libmysql')
-rw-r--r--libmysql/CMakeLists.txt24
-rw-r--r--libmysql/get_password.c33
-rw-r--r--libmysql/libmysql_rpm_version.in16
3 files changed, 61 insertions, 12 deletions
diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt
index 9996b167323..1ddb0f7db98 100644
--- a/libmysql/CMakeLists.txt
+++ b/libmysql/CMakeLists.txt
@@ -141,13 +141,14 @@ mysql_load_plugin
mysql_load_plugin_v
mysql_plugin_options
# Async API
+mysql_get_timeout_value
+mysql_get_timeout_value_ms
+mysql_get_socket
mysql_autocommit_cont
mysql_autocommit_start
mysql_change_user_cont
mysql_change_user_start
mysql_close_cont
-mysql_close_slow_part_cont
-mysql_close_slow_part_start
mysql_close_start
mysql_commit_cont
mysql_commit_start
@@ -262,17 +263,26 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
IF(RPM)
# Fedora & Co declared following functions as part of API
- # These functions are alias of another function (given mysql_ prefix=. The
- # renaming is handled in rpm_support.cc below
SET(CLIENT_API_EXTRA
mysql_default_charset_info
mysql_get_charset
mysql_get_charset_by_csname
mysql_net_realloc
mysql_client_errors
- )
+
+ # Also export the non-renamed variants
+ # (in case someone wants to rebuild mysqli-php or something similar)
+ # See MDEV-4127
+ default_charset_info
+ get_charset
+ get_charset_by_csname
+ net_realloc
+ client_errors
+ THR_KEY_mysys
+ )
+
# Add special script to fix symbols renames by Fedora
- SET(CLIENT_SOURCES_EXTRA ${CLIENT_SOURCES} rpm_support.cc)
+ SET(CLIENT_SOURCES_EXTRA rpm_support.cc)
SET(VERSION_SCRIPT_TEMPLATE
${CMAKE_CURRENT_SOURCE_DIR}/libmysql_rpm_version.in)
ELSEIF(DEB)
@@ -361,7 +371,7 @@ IF(UNIX)
ENDIF()
IF(NOT DISABLE_SHARED)
- MERGE_LIBRARIES(libmysql SHARED ${LIBS} EXPORTS ${CLIENT_API_FUNCTIONS} COMPONENT SharedLibraries)
+ MERGE_LIBRARIES(libmysql SHARED ${LIBS} EXPORTS ${CLIENT_API_FUNCTIONS} ${CLIENT_API_EXTRA} COMPONENT SharedLibraries)
IF(UNIX)
# libtool compatability
IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR APPLE)
diff --git a/libmysql/get_password.c b/libmysql/get_password.c
index 16f6b25822d..e704aec8337 100644
--- a/libmysql/get_password.c
+++ b/libmysql/get_password.c
@@ -62,13 +62,35 @@
/* 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 (;;)
{
- int tmp;
- tmp=_getch();
+ 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)
@@ -78,13 +100,16 @@ void get_tty_password_buff(const char *opt_message, char *to, size_t length)
continue;
}
}
- if (tmp == -1 || tmp == '\n' || tmp == '\r' || tmp == 3)
+ if (tmp == '\n' || tmp == '\r')
break;
if (iscntrl(tmp) || pos == end)
continue;
_cputs("*");
- *(pos++) = (char)tmp;
+ *(pos++) = tmp;
}
+ /* Reset console mode after password input. */
+ SetConsoleMode(consoleinput, oldstate);
+ CloseHandle(consoleinput);
*pos=0;
_cputs("\n");
}
diff --git a/libmysql/libmysql_rpm_version.in b/libmysql/libmysql_rpm_version.in
index ad15c8aa2c8..ff0707cdb75 100644
--- a/libmysql/libmysql_rpm_version.in
+++ b/libmysql/libmysql_rpm_version.in
@@ -21,6 +21,8 @@ libmysqlclient_16 {
my_print_help;
# pure-ftpd requires this
my_make_scrambled_password;
+# fedora18 export
+ THR_KEY_mysys;
# hydra requires this
scramble;
# DBD::mysql requires this
@@ -34,15 +36,27 @@ libmysqlclient_18 {
@CLIENT_API_5_5_LIST@
#
# Ideally the following symbols wouldn't be exported, but various applications
-# require them. We limit the namespace damage by prefixing mysql_
+# require them. Fedora limits the namespace damage by prefixing mysql_
# (see mysql-dubious-exports.patch), which means the symbols are not present
# in libmysqlclient_16.
#
+# MariaDB does not do the Fedora-style function renaming via #define in headers,
+# however it exports mysql_ prefixed symbols in addition to the "normal" ones.
+#
+# To ensure successful recompilation of affected projects, as well as drop-in replacement
+# for MySQL libraries, provided by distribution, both original symbols and their mysql_
+# prefixed counterparts have to be exported.
+
# mysql-connector-odbc requires these
mysql_default_charset_info;
mysql_get_charset;
mysql_get_charset_by_csname;
mysql_net_realloc;
+ default_charset_info;
+ get_charset;
+ get_charset_by_csname;
+ net_realloc;
# PHP's mysqli.so requires this (via the ER() macro)
mysql_client_errors;
+ client_errors;
};