Commit Graph

323 Commits

Author SHA1 Message Date
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
6225137b4a Support auth switch request during caching sha2 auth 2019-12-27 17:27:04 +01:00
Gabriel Caruso
5d6e923d46
Remove mention of PHP major version in Copyright headers
Closes GH-4732.
2019-09-25 14:51:43 +02:00
Nikita Popov
d59aac58b3 Report errors from stream read and write operations
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.
2019-07-22 17:17:28 +02:00
Peter Kokot
bebcdcc745 Remove legacy AC_CHECK_TYPE calls for uint and ulong
The AC_CHECK_TYPE was refactored in more recent versions of Autoconf
and the call with two arguments is obsolete and not recommended anymore.

This patch also refactors some leftovers of using ulong and uint which
are not standard nor common usages of types in C.

The ulong can be used as zend_ulong and uint usage is actually
`unsigned int`.

The usage of HAVE_ULONG removed since it is not used in current code
base.

Legacy edgecase for some legacy HPUX systems removed:
- sys/stream.h header is not checked and the HAVE_SYS_STREAM_H is
  not defined with current build system.

- flags are unsigned int
- max_allowed_packet changed to unsigned int
2019-03-06 22:49:16 +01:00
Peter Kokot
c245898bfa Update and fix remaining year ranges (2019)
This patch follows previous license year ranges updates. With new
approach source code files now have simplified headers with license
information without year ranges.
2019-02-08 23:14:29 +01:00
Nikita Popov
e219ec144e Implement typed properties
RFC: https://wiki.php.net/rfc/typed_properties_v2

This is a squash of PR #3734, which is a squash of PR #3313.

Co-authored-by: Bob Weinand <bobwei9@hotmail.com>
Co-authored-by: Joe Watkins <krakjoe@php.net>
Co-authored-by: Dmitry Stogov <dmitry@zend.com>
2019-01-11 15:49:06 +01:00
Andrey Hristov
d12443efc7 Const changes 2019-01-07 20:16:33 +02:00
Andrey Hristov
8975e4dcd7 Simplify the command factory
Since more than an year it not possible to create commands in the heap
but they are allocated on the stack and directly run. In this regard, it
doesn't make sense to have all the vararg stuff. Commands made sense
to be created and pushed onto a stack then a general executor will
run thru the stack and execute/handle the commands.
2019-01-07 18:47:39 +02:00
Andrey Hristov
711e1fb33b Mark const what should not be changed 2019-01-07 15:07:24 +02:00
Andrey Hristov
f1ede80781 const-ify some functions 2019-01-04 13:55:34 +02:00
Andrey Hristov
4c4216bcab Add type safety for mysqlnd plugin developers 2019-01-04 13:12:04 +02:00
Nikita Popov
4f06e67ad2 Re-commit MySQL 8 cached SHA auth support
With changes to (hopefully) correctly fall back if OpenSSL support
is missing. Furthermore the hard-coded dependency on ext/hash is
no longer an issue, as this extension is required in master.

This reverts commit 63072e9c0e, reversing
changes made to 4cbabb6852.
2018-11-21 20:16:44 +01:00
Nikita Popov
63072e9c0e Merge branch 'PHP-7.2' into PHP-7.3 2018-09-04 05:57:07 +02:00
Nikita Popov
03740ef7df Revert all MySQL auth related changes
Per bug #76651 these changes do not appear to work correctly in
some cases. As no immediate fix seems to be forthcoming, I'm
reverting these changes.

Revert "Fixed invalid free introduced by d6e81f0bfd (avoid keeping "invalid" pointer)"

This reverts commit 11507c0e1b.

Revert "Fix mysqlnd build without openssl"

This reverts commit 6c9db02ff7.

Revert "Fix VC compilation as variable size array is not supported"

This reverts commit f96df64cb2.

Revert "Fix MySQL 8 auth"

This reverts commit d6e81f0bfd.
2018-09-04 05:47:28 +02:00
Johannes Schlüter
84f6f693e7 Merge branch 'PHP-7.1' 2018-06-06 00:24:19 +02:00
Johannes Schlüter
d6e81f0bfd Fix MySQL 8 auth 2018-06-06 00:17:34 +02:00
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +08:00
Xinchen Hui
ccd4716ec7 year++ 2018-01-02 12:53:31 +08:00
Dmitry Stogov
6bcace1b72 Use single memory pool for result metadata and result set. 2017-11-15 14:07:09 +03:00
Dmitry Stogov
e2c9dfb5de Cleanup. Make difference between MYSQLND_ROW_BUFFER and MYSQLND_MEMORY_POOL_CHUNK (the last one is completely removed). 2017-11-15 11:33:32 +03:00
Dmitry Stogov
69462bdf4c Embeded zend_list into st_mysqlnd_error_info, to avoid extra allocation/deallocation. 2017-11-15 00:53:51 +03:00
Dmitry Stogov
f1f1f63ce1 Reimplemented MYSQLND_MEMORY_POOL to avoid allocations ouside of pool. Store all data related to result set in the pool. 2017-11-14 23:08:29 +03:00
Dmitry Stogov
4d5330fbe1 Run mysqlmd commands in one step (without separate create/run/free). 2017-11-14 17:32:41 +03:00
Dmitry Stogov
148641980c Merge mysqlnd_field_hash_key structure into st_mysqlnd_field. 2017-11-14 16:14:13 +03:00
Dmitry Stogov
93334b5fc2 Use stack-allocated packets. 2017-11-14 15:10:27 +03:00
Dmitry Stogov
a7305eb539 Made "result", "statement" and "last_message" to always use Zend MM heap. (even for persistent connections these entities don't relive request boundary) 2017-11-02 03:27:25 +03:00
Sammy Kaye Powers
dac6c639bb Update copyright headers to 2017 2017-01-04 11:23:42 -06:00
Sammy Kaye Powers
9e29f841ce Update copyright headers to 2017 2017-01-02 09:30:12 -06:00
Andrey Hristov
9eca4dca73 Optimized memory handling of BIT fields. Less memory copies and less
memory usage.
2016-12-12 21:59:29 +02:00
Andrey Hristov
3a33ee63e8 Merge branch 'PHP-7.0' 2016-03-16 10:47:27 +01:00
Andrey Hristov
f2ab731a8c Fix emails in headers. @mysql.com addresses are no more since many years. 2016-03-16 10:24:52 +01:00
Nikita Popov
2d1559f827 Move free_chunk and resize_chunk into memory pool
Drops 24 bytes from each chunk. For the example in bug #71468 it
reduces memory usage by 30%.
2016-02-22 19:40:32 +01:00
Nikita Popov
42fe5e6791 Drop mysqlnd mempool refcount
This member was no longer used.

Also fix handling of from_pool in resize_chunk. It was setting
pool to NULL instead of from_pool to FALSE.
2016-02-22 19:40:32 +01:00
Andrey Hristov
7e9a6f7202 Move cleanup code to a separate function and export it. Export also
other functions that can be of use for plugins
2016-01-15 03:08:02 +01:00
Andrey Hristov
bcf7172258 Forgot to add const-ness to the macro 2016-01-14 14:55:23 +01:00
Andrey Hristov
c69c23ba2f Convenience macros 2016-01-14 12:58:41 +01:00
Andrey Hristov
4e8988b45a commit 597db443cd
Author: John Bafford <john@bafford.com>
Date:   Mon Jan 11 17:17:44 2016 -0500

    MYSQLND_METHOD(mysqlnd_conn_data, get_scheme) should take socket_or_pipe by reference to allow modifications

    Fixes a read-from-null crash in mnd_pestrdup when trying to duplicate the socket filename. (Fixes regression in e81ecc80c)
2016-01-13 16:30:23 +01:00
Lior Kaplan
3d5438bf7b Merge branch 'PHP-7.0'
* PHP-7.0:
  Update header to PHP Version 7
  Happy new year (Update copyright to 2016)
  Happy new year (Update copyright to 2016)
2016-01-01 20:04:31 +02:00
Lior Kaplan
ed35de784f Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  Happy new year (Update copyright to 2016)
2016-01-01 19:48:25 +02:00
Lior Kaplan
49493a2dcf Happy new year (Update copyright to 2016) 2016-01-01 19:21:47 +02:00
Andrey Hristov
139af35c25 Add a method for checking if the underlying stream is valid. 2015-12-01 12:52:36 +01:00
Andrey Hristov
6b0d026c76 Remove unused variable 2015-11-23 11:36:25 +01:00
Andrey Hristov
d477557094 Revert "Add some const-ness to the protocol frame codec"
This reverts commit f8c2b45948.
2015-11-17 17:55:32 +01:00
Andrey Hristov
057ad5626b Don't use the specific translated name but use the macro for this 2015-11-17 17:48:27 +01:00
Andrey Hristov
a6b79f08b3 More const and moved the declaration of php_mysqlnd_scramble() to mysqlnd_auth.h 2015-11-17 14:59:59 +01:00
Andrey Hristov
fae994fed9 Bring consistency to the class by renaming the methods too (from the
old temporary name)
2015-11-17 13:28:47 +01:00
Andrey Hristov
f8c2b45948 Add some const-ness to the protocol frame codec 2015-11-17 13:17:17 +01:00
Andrey Hristov
33e97d465d mysqlnd refactoring:
- move MYSQLND_READ_BUFFER to own file
2015-11-17 12:32:01 +01:00
Andrey Hristov
4fed8a28d0 mysqlnd refactoring :
- move the command buffer out of the networking code to the protocol frame
  codec.
2015-11-16 15:37:11 +01:00