Commit Graph

1526 Commits

Author SHA1 Message Date
Max Semenik
2b5de6f839
Remove proto comments from C files
Closes GH-5758
2020-07-06 21:13:34 +02:00
twosee
83a77015ad Add helper APIs for maybe-interned string creation
Add ZVAL_CHAR/RETVAL_CHAR/RETURN_CHAR as a shortcut for using
ZVAL_INTERNED_STRING and ZSTR_CHAR.

Add zend_string_init_fast() as a helper for the empty string /
one char interned string / zend_string_init() pattern.

Also add corresponding ZVAL_STRINGL_FAST etc macros.

Closes GH-5684.
2020-06-08 15:31:52 +02:00
twosee
7d6a0ba808 Fix expression warnings and break warnings
Close GH-5675.
2020-06-07 10:41:11 +02:00
twosee
1b85e749c7 Fix warning of strict-prototypes
Closes GH-5673.
2020-06-07 10:36:50 +02:00
Christoph M. Becker
5a04796f76 Fix MSVC level 1 (severe) warnings
We fix (hopefully) all instances of:

* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4005>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4024>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4028>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4047>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4087>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4090>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4273>
* <https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4312>

`zend_llist_add_element()` and `zend_llist_prepend_element()` now
explicitly expect a *const* pointer.

We use the macro `ZEND_VOIDP()` instead of a `(void*)` cast to suppress
C4090; this should prevent accidential removal of the cast by
clarifying the intention, and makes it easier to remove the casts if
the issue[1] will be resolved sometime.

[1] <https://developercommunity.visualstudio.com/content/problem/390711/c-compiler-incorrect-propagation-of-const-qualifie.html>
2020-06-05 11:17:05 +02:00
Nikita Popov
4984bd100b Remove MYSQLND_COMPRESSION_WANTED define
Instead directly define MYSQLND_COMPRESSION_ENABLED. This also
matches what config.w32 does.
2020-06-04 10:03:39 +02:00
Nikita Popov
fc458eee3b Merge branch 'PHP-7.4'
* PHP-7.4:
  mysqlnd: Remove unnecessary check for HAVE_ZLIB
2020-06-04 10:02:12 +02:00
talyz
a230717fbb mysqlnd: Remove unnecessary check for HAVE_ZLIB
If MYSQLND_COMPRESSION_WANTED is set, we already guarantee that
zlib is linked, but don't necessarily set HAVE_ZLIB.

Closes GH-5658.
2020-06-04 10:01:17 +02:00
George Peter Banyard
1330359515 Fix [-Wundef] warning in MySQLnd extension 2020-05-18 00:37:20 +02:00
Christoph M. Becker
2393692937 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79596: MySQL FLOAT truncates to int some locales
2020-05-15 09:13:22 +02:00
Christoph M. Becker
844a1245ef Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79596: MySQL FLOAT truncates to int some locales
2020-05-15 09:11:44 +02:00
Christoph M. Becker
d1cd489a53 Fix #79596: MySQL FLOAT truncates to int some locales
We must not do locale aware float to string conversion here; instead
we using our `snprintf()` implementation with the `F` specifier.
2020-05-15 09:09:41 +02:00
George Peter Banyard
f91f72607b Drop unnecessary stdint and inttypes header checks
These are always available as of C99.

Closes GH-5323

Co-authored-by: "Christoph M. Becker" <cmbecker69@gmx.de>
2020-04-22 20:18:19 +02:00
George Peter Banyard
594287a736 Fix [-Wjump-misses-init] warning in MySQL new driver extension 2020-04-18 14:52:49 +02:00
Nikita Popov
a866ef88ed Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix MySQL local infile / attr handling on big endian systems
2020-04-16 11:23:11 +02:00
Nikita Popov
f684553c2c Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix MySQL local infile / attr handling on big endian systems
2020-04-16 11:22:43 +02:00
guirish
a1c1736bfb Fix MySQL local infile / attr handling on big endian systems
Make sure pointer types match what is used by libmysql everywhere.

Closes GH-5380.
2020-04-16 11:22:17 +02:00
Nikita Popov
d4471c6aae Remove int6store()
The implementation is broken (syntactically). As it's not used
anyway, I'm just dropping it instead.
2020-04-14 10:37:37 +02:00
Nikita Popov
6e1ff5f951 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix incorrect free for last_message
2020-04-03 10:06:52 +02:00
Nikita Popov
37a179bd3c Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix incorrect free for last_message
2020-04-03 10:06:09 +02:00
Qianqian Bu
ee21657a6a Fix incorrect free for last_message
In commit a7305eb539 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
2020-04-03 10:05:16 +02:00
Christoph M. Becker
3b26a3868e Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix leak on Windows as well
2020-03-23 16:33:26 +01:00
Christoph M. Becker
0afdf194f0 Fix leak on Windows as well
Cf. <http://git.php.net/?p=php-src.git;a=commit;h=db08ef0d3274b239a6b9e68d71d02bb6acb71d82>
2020-03-23 16:32:52 +01:00
Nikita Popov
e9c2dec720 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix RSA memory leak in mysqlnd auth
2020-03-23 12:01:15 +01:00
Nikita Popov
db08ef0d32 Fix RSA memory leak in mysqlnd auth 2020-03-23 11:55:22 +01:00
Christoph M. Becker
3abe64f16a Merge branch 'PHP-7.4'
* PHP-7.4:
  Native Windows support for mysqlnd sha256 authentification
  Abstract over crypto operations
2020-03-02 16:33:40 +01:00
Christoph M. Becker
a0377021c5 Native Windows support for mysqlnd sha256 authentification
We implement that on top of Cryptography API: Next Generation (CNG).
2020-03-02 16:32:51 +01:00
Christoph M. Becker
a7400d5fd3 Abstract over crypto operations 2020-03-02 16:26:53 +01:00
Nikita Popov
172010a08d Merge branch 'PHP-7.4'
* PHP-7.4:
  Don't use VLA in mysqlnd auth
2020-02-18 16:18:50 +01:00
Nikita Popov
9d31a42a30 Don't use VLA in mysqlnd auth
We use alloca instead of VLA. This should also allow building
this code on Windows.
2020-02-18 16:17:56 +01:00
George Peter Banyard
01957adb7f Fix [-Wmissing-field-initializers] compiler warning in mysqlnd_result.c
Explicitly initialize to NULL the unused pointers to preserve
ABI forwards compatibility.
2020-02-10 12:14:47 +01:00
Christoph M. Becker
7e5a8d9faa Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79172: STRUCT_OFFSET() relies on undefined behavior
2020-01-28 09:19:45 +01:00
Christoph M. Becker
412b476b7f Fix #79172: STRUCT_OFFSET() relies on undefined behavior
Since this pattern is understood by compilers, not a real issue, but
certainly cleaner this way.
2020-01-28 09:18:05 +01:00
Nikita Popov
dc6ede092f Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #79011
  Fix memory leaks in mysqlnd debug functionality
2020-01-24 14:55:00 +01:00
Nikita Popov
bb5cdd9b74 Fixed bug #79011
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.
2020-01-24 14:54:46 +01:00
Nikita Popov
555567468a Fix memory leaks in mysqlnd debug functionality 2020-01-24 14:54:46 +01:00
Máté Kocsis
d1764ca330
Make error messages more consistent by fixing capitalization
Closes GH-5066 As a first step, let's capitalize their initial letter when it is applicable.
2020-01-17 14:52:46 +01:00
Máté Kocsis
afdaa91170
Fix #78880: Final spelling fixes 2020-01-16 19:14:31 +01:00
Christoph M. Becker
8ea190ba95 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #79084: mysqlnd may fetch wrong column indexes with MYSQLI_BOTH
2020-01-13 13:24:12 +01:00
Christoph M. Becker
b0cdd8cc53 Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fix #79084: mysqlnd may fetch wrong column indexes with MYSQLI_BOTH
2020-01-13 13:23:12 +01:00
Christoph M. Becker
1752393bb4 Fix #79084: mysqlnd may fetch wrong column indexes with MYSQLI_BOTH
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.
2020-01-13 13:21:45 +01:00
Nikita Popov
184f118d3f Merge branch 'PHP-7.4'
* PHP-7.4:
  Handle empty password fast path in caching_sha2_password
  Handle error response during caching_sha2_password auth
  Add support for caching_sha2_password in change user authentication
  Fix unix socket check during caching_sha2_password
  Support auth switch request during caching sha2 auth
2019-12-27 17:31:27 +01:00
Nikita Popov
32cd373dfd Handle empty password fast path in caching_sha2_password
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.
2019-12-27 17:27:45 +01:00
Nikita Popov
813d4a00b4 Handle error response during caching_sha2_password auth
In particular, this fixes handling of expired passwords.
2019-12-27 17:27:45 +01:00
Nikita Popov
e7e1254f3e Add support for caching_sha2_password in change user authentication
Same as for connection handshakes.
2019-12-27 17:27:45 +01:00
Nikita Popov
03ee36d1c5 Fix unix socket check during caching_sha2_password
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.
2019-12-27 17:27:41 +01:00
Nikita Popov
6225137b4a Support auth switch request during caching sha2 auth 2019-12-27 17:27:04 +01:00
Nikita Popov
e2a1dbd502 Merge branch 'PHP-7.4'
* PHP-7.4:
  Free RSA public key in mysqlnd sha256 auth
2019-12-11 10:32:06 +01:00
Nikita Popov
b6a59cee47 Free RSA public key in mysqlnd sha256 auth
Not sure why this only started showing up as a leak now.
2019-12-11 10:31:56 +01:00
Nikita Popov
af301be4ef Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix bug #78823: add zlib library to mysqlnd
2019-12-05 07:25:26 +01:00