Commit graph

1137 commits

Author SHA1 Message Date
Harin Vadodaria
0dbd5a8797 Bug#21973610: BUFFER OVERFLOW ISSUES
Description : Incorrect usage of sprintf/strcpy caused
              possible buffer overflow issues at various
              places.

Solution : - Fixed mysql_plugin and mysqlshow
           - Fixed regex library issues

Reviewed-By : Georgi Kodinov <georgi.kodinov@oracle.com>
Reviewed-By : Venkata S Murthy Sidagam <venkata.sidagam@oracle.com>
2015-11-06 16:41:55 +05:30
Tor Didriksen
3e96ec0ef9 Backport from trunk:
Bug#18187290 ISSUE WITH BUILDING MYSQL USING CMAKE 2.8.12

We want to upgrade to VS2013 on Windows.
In order to do this, we need to upgrade to cmake 2.8.12
This has introduced some incompatibilities for .pdb files,
and "make install" no longer works.

To reproduce:
  cmake --build . --target package --config debug

The fix:
Rather than installing .pdb files for static libraries, we use the /Z7 flag
to store symbolic debugging information in the .obj files.
2014-05-07 17:09:14 +02:00
Nisha Gopalakrishnan
56cf9d2db4 BUG#18080920: CRASH; MY_REALLOC_STR DEREFERENCES NEGATIVE VALUE
INTO CLIENT_ERRORS ARRAY
              
Analysis:
--------
The client may crash while executing a statement due to
the missing mapping of the server error to it's equivalent
client error.

When trying to reallocate memory for the packet buffer, if
the system is out of memory or the packet buffer is large,
the server errors 'ER_OUT_OF_RESOURCES' or 'ER_PACKET_TOO_LARGE'
is returned respectively. The client error number calculated is
negative and when trying to dereference the array of client 
error messages with the calculated error number, the client
crashes.

Fix:
----
Map the server error returned to it's equivalent client error
prior to dereferencing the array of client error messages.

Note: Test case is not added since it is difficult to simulate
the error condition.
2014-04-24 09:30:21 +05:30
Tor Didriksen
2bdffb1de4 Backport of Bug#16809055 MYSQL 5.6 AND 5.7 STILL USE LIBMYSQLCLIENT.SO.18
Backported only the softlink part of the patch,
*not* the bumping of library version.

With this patch, the libmysql/ directory contains:
libmysqlclient.a
libmysqlclient_r.a -> libmysqlclient.a
libmysqlclient_r.so -> libmysqlclient.so*
libmysqlclient_r.so.18 -> libmysqlclient.so.18*
libmysqlclient_r.so.18.0.0 -> libmysqlclient.so.18.0.0*
libmysqlclient.so -> libmysqlclient.so.18*
libmysqlclient.so.18 -> libmysqlclient.so.18.0.0*
libmysqlclient.so.18.0.0*
2014-01-23 09:02:47 +01:00
Murthy Narkedimilli
496abd0814 Updated/added copyright headers 2014-01-06 10:52:35 +05:30
Sreedhar.S
faca34da04 Bug 13878021 - WINDOWS PACKAGE THAT INCLUDES .PDB FILES FOR INTERMEDIATE LIBRARIES USED 2013-10-09 11:10:46 +05:30
Murthy Narkedimilli
d978016d93 Fix for Bug 16395495 - OLD FSF ADDRESS IN GPL HEADER 2013-03-19 15:53:48 +01:00
Venkata Sidagam
a40ea266e6 Bug #14553380 MYSQL C API LIBRARY EXITS AT NET_CLEAR AT NET_SERV.CC:223
Problem description: When client loses the connection to the MySQL server or 
if the server gets shutdown after mysql_stmt_prepare() then the next 
mysql_stmt_prepare() will return an error(as expected) but consecutive call 
mysql_stmt_execute(), will crash the client program. 
The expected behavior would be, it should through an error.

Analysis: The mysql_stmt_prepare() interns calls the function end_server() 
and net->vio and net->buff are freed and set to NULL. Then the next call 
mysql_stmt_execute() will interns call net_clear() where we are "net->vio" 
with out validating it.

Fix: we are validating the net->vio, before calling net_clear().
2013-01-10 16:37:20 +05:30
Tor Didriksen
0b034dd21f merge 5.1 => 5.5 2012-11-01 17:33:55 +01:00
Tor Didriksen
e5d2a53b78 Bug#14840488 VALGRIND ERRORS IN MYSQL_CLIENT_TEST
Add missing DBUG_RETURNs, otherwise the debug-stack gets messed up,
and _db_enter_ and _db_exit_ will access data outside the current stack frame.
2012-11-01 17:23:06 +01:00
Georgi Kodinov
26f0c1fd4b merge bug#13708485 5.1->5.5 2012-06-29 16:54:55 +03:00
Georgi Kodinov
428ff7f8a0 Bug #13708485: malformed resultset packet crashes client
Several fixes :

* sql-common/client.c
Added a validity check of the fields metadata packet sent 
by the server.
Now libmysql will check if the length of the data sent by
the server matches what's expected by the protocol before
using the data.

* client/mysqltest.cc
Fixed the error handling code in mysqltest to avoid sending
new commands when the reading the result set failed (and 
there are unread data in the pipe).

* sql_common.h + libmysql/libmysql.c + sql-common/client.c
unpack_fields() now generates a proper error when it fails.
Added a new argument to this function to support the error 
generation.

* sql/protocol.cc
Added a debug trigger to cause the server to send a NULL
insted of the packet expected by the client for testing 
purposes.
2012-06-28 18:38:55 +03:00
MySQL Build Team
5734bae576 Updated/added copyright headers 2012-02-16 10:48:16 +01:00
Tor Didriksen
4adc2ec909 Bug#13604121 - LIBMYSQLCIENT.SO MISSING SOME FUNCTIONS PRESENT IN LIBMYSQLCLIENT.A
+get_tty_password  this is the only external symbol in get_password.c,
                   which is explicitly listed in CLIENT_SOURCES
+handle_options    this is in mysys/my_getopt.c
                   adding this sysmbol pulls in the other externals:
T getopt_compare_strings
T getopt_double_limit_value
T getopt_ll_limit_value
T getopt_ull_limit_value
T handle_options
T my_cleanup_options
T my_getopt_register_get_addr
T my_print_help
T my_print_variables
2012-01-30 10:08:22 +01:00
Rafal Somla
aa21a71059 Bug#13101974 SLAVE CAN'T CONNECT AS REPLICATION USER USING WINDOWS AUTH PLUGIN
Problem was that built-in client-side support for Windows Native Authentication (WNA) was included only in the client library, but not into the server code (which also uses some of the sources from the client library).

This is fixed by modyfying sql/CMakeLists.txt to include the client-side WNA plugin library and enable WNA related code by defining AUTHENTICATION_WIN macro.

Also, the logic of libmysql/CMakeLists.txt is simplified a bit.
2011-11-17 12:34:52 +01:00
Rafal Somla
f03a55cc5b Bug#12982926 CLIENT CAN OVERRIDE ZERO-LENGTH-ALLOCATE BUFFER
Changes in client plugin needed for testing the issue (test instrumentation).
2011-09-29 17:02:16 +02:00
Daniel Fischer
fe1b205d02 merge from 5.5.16 2011-09-21 12:40:41 +02:00
Rafal Somla
3b17a24eff Bug#12897501 REPLICATION DOES NOT SUPPORT WINDOWS AUTH PLUG-IN
Connection of slave to master using a replication account which authenticates
with an external plugin was not possible.

Fixed by making sure that the CLIENT_PLUGIN_AUTH capability is set when client connects using mysql_real_connect(). Also, a plugin-dir path used by client library to locate authentication plugins is set based on the analogous server setting. This is done in connect_to_master() function before a call to mysql_real_connect().
2011-09-14 16:10:18 +02:00
Rafal Somla
362709444f Bug#12873214 WINDOWS AUTHENTICATION PLUGIN PRODUCES EXCESSIVE RECORDS IN SERVER ERROR LOG
Changed semantics of AUTHENTICATION_WIN_LOG environment variable recognized by client library to accept the following values which are levels of logging done during Windows authentication handshake:
      
  0 - no logging
  1 - log only error messages
  2 - additionally log warnings
  3 - additionally log info notes
  4 - also log debug messages
      
Setting it to 'on', 'yes' or 'true' will request log level 2 and setting it to 'debug' or 'dbug' will request log level 4.
2011-09-07 20:02:35 +02:00
Kent Boortz
b6e6097c95 Updated/added copyright headers 2011-07-03 17:47:37 +02:00
Kent Boortz
1400d7a2cc Updated/added copyright headers 2011-06-30 17:37:13 +02:00
Kent Boortz
e5ce023f57 Updated/added copyright headers 2011-06-30 17:31:31 +02:00
Kent Boortz
9da00ebec9 Updated/added copyright headers 2011-06-30 17:46:53 +02:00
Rafal Somla
6a6ef034c9 Bug#12612143 - LIBMYSQL 5.5.13 BREAKS USER APPLICATION BUILD
Since the Windows authentication support has been added to libmysql, this library depends on the system Secur32 library. Consequently, clients which are linked against libmysql should be also linked with Secur32 (in addition to ws2_32).

In MS VC++ it is possible to embed information about required libraries into object file using #pragma directive. This patch adds such directive when the Windows authentiaction support is compiled. This is similar to analogous #pragma for ws2_32 library in my_init.c
2011-06-03 13:44:33 +02:00
Tatjana Azundris Nuernberg
92b901d297 Bug#11745920/Bug#21287: "SSL connection error" is not helpful! (ssl-verify-server-cert=true vs localhos)
SSL errors on client and now more specific to aid end-user
with debugging. Also restructures error handling for
compliance with SSL docs.
2011-05-19 10:47:43 +01:00
Alexander Nozdrin
cd501675d8 Patch for Bug#12374486 - SEVERE MEMORY LEAK IN PREPARED STATEMENTS
THAT CALL STORED PROCEDURES.

The bug was introduced by WL#4435. The problem was that if a stored
procedure generated a few result sets with different set of columns,
a new memory would be allocated after every EXECUTE for every
result set.

The fix is to introduce a new memory root in scope of MYSQL_STMT,
and to store result-set metadata in that memory root.
2011-05-06 17:39:20 +04:00
Rafal Somla
a6acc73bb1 BUG#11879051: FIRST REPLY LENGTH LIMIT (255) CAN BE VIOLATED
BEFORE: First packet sent by client-side plugin (generated by Windows
function InitializeSecurityContext()) could be longer than 255 bytes 
violating the limitation imposed by authentication protocol.

AFTER: Handshake protocol is  changed so that if first client's reply is 
longer than 254 bytes then  it is be sent in 2 parts. However, for replies
shorter than 255 bytes nothing changes.

ADDITIONAL CHANGES: 
- The generic packet processing loop  (Handshake::packet_processing_loop) 
has been refactored. Communication with the peer has been abstracted
into virtual methods read/write_packet() which are implemented in client 
and server and transparently do the required splitting and gluing of packets.
- Make it possible to optionally use dbug library in the plugin.
- Add code for testing splitting of long first client reply.
2011-04-28 21:39:42 +02:00
Rafal Somla
6d7aceeead Bug#11766631 (59780) - Move the client authentication_windows plugin
into the server repository

This patch adds client windows authentication plugin code to the client 
library libmysql (only on Windows platform). The plugin is compiled into 
the library and added to the list of built-in plugins. This way clients 
should be able to connect to a server which uses windows authentication 
plugin even as an SQL user which uses such authentication.

Note: this makes the client library to depend on Secur32 Windows system
library. When building clients, they must be linked against Secur32. 
Command mysql_config --libs correctly lists Secur32 as a required 
dependency.
2011-04-28 21:17:29 +02:00
Georgi Kodinov
82a68a5f50 Bug #12325444 : 60746: CLIENT_PLUGIN.H IS BROKEN
Removed the STDCALL macro and the function from the .def file,
since it's not used by the connectors atm.
2011-04-06 17:31:26 +03:00
Magne Mahre
4c4cb80b0a Bug#11900714 REMOVE LGPL LICENSED FILES IN MYSQL 5.1
The LGPL license is used in some legacy code, and to
adhere to current licensing polity, we remove those
files that are no longer used, and reorganize the
remaining LGPL code so it will be GPL licensed from
now on.
      
Note:  This patch only removed LGPL licensed files
       in MySQL 5.1, and is the second of a set of
       patches to remove LGPL from all trees.
       (See Bug# 11840513 for details)
2011-03-28 10:47:30 +02:00
Magne Mahre
ebd24626ca Remove configuration preprocessor symbols 'THREAD'
and 'THREAD_SAFE_CLIENT'.
  
As of MySQL 5.5, we no longer support non-threaded
builds.   This patch removes all references to the
obsolete THREAD and THREAD_SAFE_CLIENT preprocessor
symbols.  These were used to distinguish between
threaded and non-threaded builds.
2011-01-11 10:07:37 +01:00
Alexander Nozdrin
d7a4672cf7 Merge from mysql-5.0-bugteam. 2010-11-24 13:07:37 +03:00
Alexander Nozdrin
174a6962da A follow-up for Bug#58340 (Remove Server GPL EXCEPTIONS-CLIENT file) -- remove all
EXCEPTIONS-CLIENT from all the places.
2010-11-24 12:53:39 +03:00
Alexander Nozdrin
7a3636c1af Merge from mysql-5.1-bugteam. 2010-11-24 13:23:44 +03:00
Davi Arnaut
f6deb00a56 WL#5665: Removal of the autotools-based build system
The autotools-based build system has been superseded and
is being removed in order to ease the maintenance burden on
developers tweaking and maintaining the build system.

In order to support tools that need to extract the server
version, a new file that (only) contains the server version,
called VERSION, is introduced. The file contents are human
and machine-readable. The format is:

MYSQL_VERSION_MAJOR=5
MYSQL_VERSION_MINOR=5
MYSQL_VERSION_PATCH=8
MYSQL_VERSION_EXTRA=-rc

The CMake based version extraction in cmake/mysql_version.cmake
is changed to extract the version from this file. The configure
to CMake wrapper is retained for backwards compatibility and to
support the BUILD/ scripts. Also, a new a makefile target
show-dist-name that prints the server version is introduced.
2010-11-20 12:47:50 -02:00
Vladislav Vaintroub
a6b4be2522 add missing COMPONENT to all CMake INSTALL commands 2010-11-13 23:16:52 +01:00
Davi Arnaut
80246ac8b8 Bug#58057: 5.1 libmysql/libmysql.c unused variable/compile failure
Bug#57995: Compiler flag change build error on OSX 10.4: my_getncpus.c
Bug#57996: Compiler flag change build error on OSX 10.5 : bind.c
Bug#57994: Compiler flag change build error : my_redel.c
Bug#57993: Compiler flag change build error on FreeBsd 7.0 : regexec.c
Bug#57992: Compiler flag change build error on FreeBsd : mf_keycache.c
Bug#57997: Compiler flag change build error on OSX 10.6: debug_sync.cc

Fix assorted compiler generated warnings.
2010-11-10 19:14:47 -02:00
Georgi Kodinov
fee2a518b4 Bug #56767: Make sure client plugins in 1054 are compatible with
connectors plugins
      
Implemented changes needed to keep the client plugin API compatible with 
the existing plugins :
      
1. Provided an options() client plugin API to let the application pass
options to the plugin after loading it
2. Added "License" (const char *) to specify the client plugin's license
3. Added "mysql_api" as a placeholder that the client library can use
to pass function pointers to the plugin so that the plugin can call the 
C lib back.
4. Updated the existing client plugins to comply with the API change.
5. Added more detailed error message generation for Windows.
2010-10-04 15:54:41 +03:00
Georgi Kodinov
dd2e3db48f merge 2010-10-04 15:42:16 +03:00
Dmitry Shulga
d88a11a766 Fix mysql_client_test failure introduced by a patch for Bug#47485.
The problem was that mysql_stmt_next_result() (new to 5.5)
was not properly updated.
2010-09-09 19:36:57 +07:00
Dmitry Shulga
d439036a04 Auto-merge from mysql-5.1-bugteam. 2010-09-07 14:49:47 +07:00
Dmitry Shulga
14dbc7e4e6 Fixed bug #47485 - mysql_store_result returns a not NULL result set
for a prepared statement.
2010-09-07 14:18:01 +07:00
Georgi Kodinov
5c81e2cf16 merged mysql-5.5 into WL1054-5.5 2010-08-16 18:16:07 +03:00
Alexander Nozdrin
13ec2a1625 Patch for Bug#55854 (MySQL AB should not be AUTHOR, copyright incorrect).
Fixing copyright text.
2010-08-12 19:19:57 +04:00
Georgi Kodinov
881a76699e WL#1054: Pluggable authentication support
Merged the implementation to a new base tree.
2010-08-09 11:32:50 +03:00
Davi Arnaut
68cd3bce9c WL#5498: Remove dead and unused source code
Remove unused string functions.
2010-07-23 17:17:14 -03:00
Davi Arnaut
60ab2b9283 WL#5498: Remove dead and unused source code
Remove unused macros or macro which are always defined.
2010-07-23 17:16:29 -03:00
Davi Arnaut
85bbcfee02 WL#5498: Remove dead and unused source code
Remove the ancient and dead raid code. By now, even the server side
has been removed.
2010-07-23 17:15:07 -03:00
Davi Arnaut
e83f1d37c4 WL#5498: Remove dead and unused source code
Remove unused source code and associated paraphernalia.
2010-07-23 17:14:35 -03:00
Davi Arnaut
fb91a92330 WL#5498: Remove dead and unused source code
Remove Windows related files which aren't used anymore.
2010-07-23 17:14:04 -03:00