summaryrefslogtreecommitdiff
path: root/ext/mysqlnd
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'PHP-7.3' into PHP-7.4Nikita Popov2020-04-161-5/+5
|\ | | | | | | | | * PHP-7.3: Fix MySQL local infile / attr handling on big endian systems
| * Fix MySQL local infile / attr handling on big endian systemsguirish2020-04-161-5/+5
| | | | | | | | | | | | Make sure pointer types match what is used by libmysql everywhere. Closes GH-5380.
* | Merge branch 'PHP-7.3' into PHP-7.4Nikita Popov2020-04-031-1/+1
|\ \ | |/ | | | | | | * PHP-7.3: Fix incorrect free for last_message
| * Fix incorrect free for last_messageQianqian Bu2020-04-031-1/+1
| | | | | | | | | | | | | | | | In commit a7305eb539596e175bd6c3ae9a20953358c5d677 the last_message field of the connection object was changed to be always non-persistent. But there is a place on change_user path that still treats it depending on conn->persistent flag. This will cause PHP crash after com_change_user success when there is last_message set
* | Fix leak on Windows as wellChristoph M. Becker2020-03-231-0/+5
| | | | | | | | Cf. <http://git.php.net/?p=php-src.git;a=commit;h=db08ef0d3274b239a6b9e68d71d02bb6acb71d82>
* | Fix RSA memory leak in mysqlnd authNikita Popov2020-03-231-0/+3
| |
* | Native Windows support for mysqlnd sha256 authentificationChristoph M. Becker2020-03-022-0/+132
| | | | | | | | We implement that on top of Cryptography API: Next Generation (CNG).
* | Abstract over crypto operationsChristoph M. Becker2020-03-021-61/+77
| |
* | Don't use VLA in mysqlnd authNikita Popov2020-02-182-9/+8
| | | | | | | | | | We use alloca instead of VLA. This should also allow building this code on Windows.
* | Fix #79172: STRUCT_OFFSET() relies on undefined behaviorChristoph M. Becker2020-01-281-1/+1
| | | | | | | | | | Since this pattern is understood by compilers, not a real issue, but certainly cleaner this way.
* | Fixed bug #79011Nikita Popov2020-01-241-1/+7
| | | | | | | | | | | | auth_plugin_data_len here is 21, including the trailing null byte. Directly use SCRAMBLE_LENGTH instead. Also add a sanity check that the provided scramble is long enough.
* | Fix memory leaks in mysqlnd debug functionalityNikita Popov2020-01-241-1/+5
| |
* | Merge branch 'PHP-7.3' into PHP-7.4Christoph M. Becker2020-01-131-6/+9
|\ \ | |/ | | | | | | * PHP-7.3: Fix #79084: mysqlnd may fetch wrong column indexes with MYSQLI_BOTH
| * Fix #79084: mysqlnd may fetch wrong column indexes with MYSQLI_BOTHChristoph M. Becker2020-01-131-6/+9
| | | | | | | | | | | | Column names can be numeric strings, so we have to make sure to insert the column values with the appropriate numeric keys, instead of adding them.
* | Handle empty password fast path in caching_sha2_passwordNikita Popov2019-12-271-1/+6
| | | | | | | | | | | | If an empty password is used, no additional packets are exchanged during caching_sha2_password auth. We're only looking for an OK/ERR response.
* | Handle error response during caching_sha2_password authNikita Popov2019-12-273-6/+24
| | | | | | | | In particular, this fixes handling of expired passwords.
* | Add support for caching_sha2_password in change user authenticationNikita Popov2019-12-272-0/+16
| | | | | | | | Same as for connection handshakes.
* | Fix unix socket check during caching_sha2_passwordNikita Popov2019-12-272-7/+11
| | | | | | | | | | | | | | | | The fact that conn->unix_socket is set does not mean that a Unix socket is actually in use -- this member is set in a default configuration. Instead check whether a unix_socket stream ops is used.
* | Support auth switch request during caching sha2 authNikita Popov2019-12-274-12/+60
| |
* | Free RSA public key in mysqlnd sha256 authNikita Popov2019-12-111-0/+1
| | | | | | | | Not sure why this only started showing up as a leak now.
* | Fix bug #78823: add zlib library to mysqlndArjen de Korte2019-12-051-0/+3
| | | | | | | | | | | | | | | | | | | | The problem is newer binutils will no longer default to --copy-dt-needed-entries but use --no-copy-dt-needed-entries instead. So all libraries needed *must* be provided. Workarounds (either one works) 1) Add "-Wl,--copy-dt-needed-entries" to LDFLAGS to bring back the old behavior of the linker 2) Add "-lz" to list of libraries to be added In "ext/mysqlnd/mysqlnd_protocol_frame_codec.c" when the "zlib.h" header is included should also trigger adding '-lz' to the list of libraries.
* | Remove dead code `ext/mysqlnd/mysqlnd_net.c`.Adam Saponara2019-11-041-1224/+0
| | | | | | | | | | | | | | I believe this code has been dead since 05c5e05 (2015) now replaced by `ext/mysqlnd/mysqlnd_vio.c`. Closes GH-4888.
* | Merge branch 'PHP-7.3' into PHP-7.4Nikita Popov2019-09-132-15/+14
|\ \ | |/
| * Fix bug #78525Nikita Popov2019-09-132-15/+14
| | | | | | | | | | | | | | When calling free_result_buffers(), also free field metadata and restore the mempool state to what it was before any allocations have been made. Remove the mempool save/restore logic for the inner result set as this is now handled on a higher level.
* | Remove --with-zlib-dir option from mysqlnd configNikita Popov2019-09-051-9/+0
| | | | | | | | | | mysqlnd doesn't actually use this. PDO MySQL uses it, but also declares it separately.
* | Merge branch 'PHP-7.3' into PHP-7.4Christoph M. Becker2019-08-203-2/+12
|\ \ | |/ | | | | | | * PHP-7.3: fix the problem for connect_attr, set db condition, and add a new attribute _server_host
| * Merge branch 'PHP-7.2' into PHP-7.3Christoph M. Becker2019-08-203-2/+12
| |\ | | | | | | | | | | | | * PHP-7.2: fix the problem for connect_attr, set db condition, and add a new attribute _server_host
| | * fix the problem for connect_attr, set db condition, and add a new attribute ↵Qianqian Bu2019-08-203-2/+12
| | | | | | | | | | | | _server_host
* | | Merge branch 'PHP-7.3' into PHP-7.4Christoph M. Becker2019-08-021-0/+8
|\ \ \ | |/ / | | | | | | | | | * PHP-7.3: Fix #78179: MariaDB server version incorrectly detected
| * | Merge branch 'PHP-7.2' into PHP-7.3Christoph M. Becker2019-08-021-0/+8
| |\ \ | | |/ | | | | | | | | | * PHP-7.2: Fix #78179: MariaDB server version incorrectly detected
| | * Fix #78179: MariaDB server version incorrectly detectedChristoph M. Becker2019-08-021-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | As of MariaDB 10.0.2, the server reports a fake version number as work- around for replication issues[1]. We apply the same "fix" as in the MariaDB client to cater to this. [1] <https://github.com/MariaDB/server/commit/c50ee6c23dbeb090963580754bec2f0a96ac0557#diff-5b45fa673c88c06a9651c7906364f592>
* | | Merge branch 'PHP-7.3' into PHP-7.4Christoph M. Becker2019-07-311-1/+1
|\ \ \ | |/ / | | | | | | | | | * PHP-7.3: Fix 78213: Empty row pocket
| * | Fix 78213: Empty row pocketChristoph M. Becker2019-07-311-1/+1
| | | | | | | | | | | | | | | We have to ensure that we don't create an arena which is smaller than its header, regardless of the configured alignment.
* | | Report errors from stream read and write operationsNikita Popov2019-07-224-21/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The php_stream_read() and php_stream_write() functions now return an ssize_t value, with negative results indicating failure. Functions like fread() and fwrite() will return false in that case. As a special case, EWOULDBLOCK and EAGAIN on non-blocking streams should not be regarded as error conditions, and be reported as successful zero-length reads/writes instead. The handling of EINTR remains unclear and is internally inconsistent (e.g. some code-paths will automatically retry on EINTR, while some won't). I'm landing this now to make sure the stream wrapper ops API changes make it into 7.4 -- however, if the user-facing changes turn out to be problematic we have the option of clamping negative returns to zero in php_stream_read() and php_stream_write() to restore the old behavior in a relatively non-intrusive manner.
* | | Remove HAVE_DSA_DEFAULT_METHODPeter Kokot2019-07-221-3/+0
| | | | | | | | | | | | | | | | | | Last usage removed via 6a813634052710f3f4bf6e2e03ca1b6c7be3bcee. Closes GH-4455
* | | Sync mysqlnd version with PHP versionChristoph M. Becker2019-07-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Since mysqlnd is solely developed in the php-src repository, it makes not much sense to have its own version number, particularly since nobody cares to update it. Therefore we use PHP's version number, but stick with the "mysqlnd" prefix which can be important to distinguish the mysqli driver (libmysqlclient vs. mysqlnd).
* | | Removed mysqlnd stats from phpinfo pagePieter Hordijk2019-07-031-27/+0
| | | | | | | | | | | | All information can already be retrieved using the APIs at https://www.php.net/manual/en/mysqlnd.stats.php. Closes https://bugs.php.net/bug.php?id=60594
* | | Add tracked arena allocatorNikita Popov2019-06-281-81/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Available under -DZEND_TRACK_ARENA_ALLOC. This will use the system allocator combined with arena checkpointing & release semantics and allows analyzing arena usage under asan/valgrind. I've sacrificed the duplicate arena implementation in mysqlnd, as the integration with mysqlnd alloc is not worth the code duplication to me.
* | | Fix mysqlnd memory leakNikita Popov2019-06-282-12/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The actual leak is observed in ext/pdo_mysql/tests/bug_74376.phpt. The persistent connection leaks because a refcount decrement on a result is missed. The refcount decrement is missed because free_result_contents is used, rather than free_result. Looking at other uses of free_result_contents, it looks like they could also suffer from this problem. Apart from one case, free_result_contents is always used to release the result entirely (I've adjusted the one differing case to only free meta), so I'm moving most of the logic from free_result into free_result_contents. The only difference is now that free_result will skip_result first.
* | | Fix use-after-free in stream freeing during shutdownNikita Popov2019-06-271-11/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Streams will be freed in an unpredictable order during shutdown. Ignore explicit calls to php_stream_close() entirely to avoid use-after-free -- instead let the stream resource destructor deal with it. We have to account for a few special cases: * Enclosed streams should be freed, as the resource destructor will forward to the enclosing stream. * Stream cookies also directly free streams, because we delegate to the cookie destruction if one exists. * Mysqlnd also directly frees streams, because it explicitly removes stream resources (because mysqlnd!)
* | | Merge branch 'PHP-7.3' into PHP-7.4Andrey Hristov2019-06-211-1/+3
|\ \ \ | |/ /
| * | Merge branch 'PHP-7.2' into PHP-7.3Andrey Hristov2019-06-211-1/+3
| |\ \ | | |/
| | * Add explicit cast to uint32_t.Andrey Hristov2019-06-211-1/+3
| | | | | | | | | | | | | | | It works even without it but explicit stuff is better. The compiler probably converts the 16-bit uint16_t to uint32_t before doing the shift.
* | | Fix shift UB in sint4korr()Nikita Popov2019-06-191-4/+4
| | |
* | | Fix incorrect shift in mysqlnd_wireprotocolNikita Popov2019-06-191-1/+1
| | | | | | | | | | | | | | | This one looks like a genuine bug: We're shifting a uint16_t by 16 bits. On x86 that likely results in no shift happening.
* | | Fix ifdef positionNikita Popov2019-06-121-1/+1
| | | | | | | | | | | | Hopefully fixes the release build...
* | | Remove always true conditionNikita Popov2019-06-121-1/+1
| | |
* | | Remove MYSQLND_LLU_SPEC/MYSQLND_LL_SPECNikita Popov2019-06-121-59/+0
| | | | | | | | | | | | No longer used, replaced by PRIu64/PRIi64.
* | | Fix mysqlnd printf modifiersNikita Popov2019-06-124-6/+6
| | | | | | | | | | | | By moving the the standard macros...
* | | Fix warnings in mysqlnd_alloc.cNikita Popov2019-06-121-91/+60
| | | | | | | | | | | | | | | And also separate the PHP_DEBUG codepaths more, to avoids having an ifdef every other line...