28static const char *
const mysqlnd_old_passwd =
"mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. "
29"Please use an administration tool to reset your password with the command SET PASSWORD = PASSWORD('your_existing_password'). This will "
30"store a new, and more secure, hash value in mysql.user. If this user is used in other scripts executed by PHP 5.2 or earlier you might need to remove the old-passwords "
31"flag from your my.cnf file";
38 const char *
const user,
39 const char *
const passwd,
40 const size_t passwd_len,
41 const char *
const db,
44 const char *
const auth_protocol,
45 const unsigned int charset_no,
49 const bool is_change_user
53 bool first_call =
TRUE;
55 char * switch_to_auth_protocol =
NULL;
56 size_t switch_to_auth_protocol_len = 0;
57 char * requested_protocol =
NULL;
59 size_t plugin_data_len;
61 DBG_ENTER(
"mysqlnd_run_authentication");
63 plugin_data_len = auth_plugin_data.
l;
68 memcpy(plugin_data, auth_plugin_data.
s, plugin_data_len);
69 plugin_data[plugin_data_len] =
'\0';
72 if (!requested_protocol) {
85 mnd_sprintf(&
msg, 0,
"The server requested authentication method unknown to the client [%s]", requested_protocol);
95 size_t switch_to_auth_protocol_data_len = 0;
97 size_t scrambled_data_len = 0;
99 switch_to_auth_protocol =
NULL;
100 switch_to_auth_protocol_len = 0;
107 DBG_INF_FMT(
"salt(%zu)=[%.*s]", plugin_data_len, (
int) plugin_data_len, plugin_data);
111 NULL, &scrambled_data_len, conn, user, passwd,
112 passwd_len, plugin_data, plugin_data_len,
120 if (
FALSE == is_change_user) {
125 auth_plugin, plugin_data, plugin_data_len,
126 scrambled_data, scrambled_data_len,
127 &switch_to_auth_protocol, &switch_to_auth_protocol_len,
128 &switch_to_auth_protocol_data, &switch_to_auth_protocol_data_len
134 auth_plugin, plugin_data, plugin_data_len,
135 scrambled_data, scrambled_data_len,
136 &switch_to_auth_protocol, &switch_to_auth_protocol_len,
137 &switch_to_auth_protocol_data, &switch_to_auth_protocol_data_len
141 free(scrambled_data);
143 DBG_INF_FMT(
"switch_to_auth_protocol=%s", switch_to_auth_protocol? switch_to_auth_protocol:
"n/a");
144 if (requested_protocol && switch_to_auth_protocol) {
146 requested_protocol = switch_to_auth_protocol;
152 plugin_data_len = switch_to_auth_protocol_data_len;
153 plugin_data = switch_to_auth_protocol_data;
159 DBG_INF_FMT(
"saving requested_protocol=%s", requested_protocol);
166 if (requested_protocol) {
178 unsigned int charset_no,
179 const size_t server_capabilities,
185 DBG_ENTER(
"mysqlnd_switch_to_ssl_if_needed");
192 const size_t client_capabilities = mysql_flags;
193 ret = conn->command->enable_ssl(conn, client_capabilities, server_capabilities, charset_no);
204 const char *
const user,
205 const char *
const passwd,
206 const char *
const db,
208 const size_t passwd_len,
210 const char *
const authentication_protocol,
211 const unsigned int charset_no,
212 const size_t server_capabilities,
218 DBG_ENTER(
"mysqlnd_connect_run_authentication");
220 ret = mysqlnd_switch_to_ssl_if_needed(conn, charset_no, server_capabilities, session_options, mysql_flags);
223 authentication_plugin_data, authentication_protocol,
224 charset_no, session_options, mysql_flags,
FALSE ,
FALSE);
234 const char *
const user,
235 const char *
const passwd,
236 const size_t passwd_len,
237 const char *
const db,
241 const unsigned int server_charset_no,
242 const bool use_full_blown_auth_packet,
243 const char *
const auth_protocol,
245 const zend_uchar *
const orig_auth_plugin_data,
246 const size_t orig_auth_plugin_data_len,
248 const size_t auth_plugin_data_len,
249 char ** switch_to_auth_protocol,
250 size_t *
const switch_to_auth_protocol_len,
252 size_t *
const switch_to_auth_protocol_data_len
259 DBG_ENTER(
"mysqlnd_auth_handshake");
263 if (use_full_blown_auth_packet !=
TRUE) {
268 change_auth_resp_packet.
auth_data = auth_plugin_data;
269 change_auth_resp_packet.
auth_data_len = auth_plugin_data_len;
292 auth_packet.
user = user;
294 auth_packet.
db_len = db_len;
296 auth_packet.
auth_data = auth_plugin_data;
309 if (use_full_blown_auth_packet ==
TRUE) {
318 orig_auth_plugin_data, orig_auth_plugin_data_len, passwd, passwd_len,
319 switch_to_auth_protocol, switch_to_auth_protocol_len,
320 switch_to_auth_protocol_data, switch_to_auth_protocol_data_len)) {
329 DBG_ERR(mysqlnd_old_passwd);
336 *switch_to_auth_protocol_data =
mnd_emalloc(*switch_to_auth_protocol_data_len);
339 *switch_to_auth_protocol_data =
NULL;
340 *switch_to_auth_protocol_data_len = 0;
346 DBG_ERR_FMT(
"ERROR:%u [SQLSTATE:%s] %s", auth_resp_packet.
error_no, auth_resp_packet.
sqlstate, auth_resp_packet.
error);
365 const char *
const user,
366 const size_t user_len,
367 const char *
const passwd,
368 const size_t passwd_len,
369 const char *
const db,
372 const bool use_full_blown_auth_packet,
373 const char *
const auth_protocol,
375 const zend_uchar *
const orig_auth_plugin_data,
376 const size_t orig_auth_plugin_data_len,
378 const size_t auth_plugin_data_len,
379 char ** switch_to_auth_protocol,
380 size_t *
const switch_to_auth_protocol_len,
382 size_t *
const switch_to_auth_protocol_data_len
389 DBG_ENTER(
"mysqlnd_auth_change_user");
393 if (use_full_blown_auth_packet !=
TRUE) {
398 change_auth_resp_packet.
auth_data = auth_plugin_data;
399 change_auth_resp_packet.
auth_data_len = auth_plugin_data_len;
415 auth_packet.
user = user;
417 auth_packet.
db_len = db_len;
418 auth_packet.
silent = silent;
420 auth_packet.
auth_data = auth_plugin_data;
428 if (conn->m->get_server_version(conn) >= 50123) {
444 orig_auth_plugin_data, orig_auth_plugin_data_len, passwd, passwd_len,
445 switch_to_auth_protocol, switch_to_auth_protocol_len,
446 switch_to_auth_protocol_data, switch_to_auth_protocol_data_len)) {
457 DBG_ERR(mysqlnd_old_passwd);
464 *switch_to_auth_protocol_data =
mnd_emalloc(*switch_to_auth_protocol_data_len);
467 *switch_to_auth_protocol_data =
NULL;
468 *switch_to_auth_protocol_data_len = 0;
480 if (conn->m->get_server_version(conn) > 50113L &&conn->m->get_server_version(conn) < 50118L) {
486 DBG_INF_FMT(
"Server is " ZEND_ULONG_FMT ", buggy, sends two ERR messages", conn->m->get_server_version(conn));
497 if (conn->m->get_server_version(conn) < 50123) {
498 ret = conn->m->set_charset(conn, old_cs->
name);
502 DBG_ERR(mysqlnd_old_passwd);
521 while (s1 < s1_end) {
560 size_t * auth_data_len,
562 const size_t passwd_len,
zend_uchar * auth_plugin_data,
const size_t auth_plugin_data_len,
569 DBG_ENTER(
"mysqlnd_native_auth_get_auth_data");
576 DBG_ERR_FMT(
"The server sent wrong length for scramble %zu. Expected %u", auth_plugin_data_len,
SCRAMBLE_LENGTH);
581 if (passwd && passwd_len) {
596 "auth_plugin_mysql_native_password",
600 "Andrey Hristov <andrey@php.net>, Ulf Wendel <uwendel@mysql.com>, Georg Richter <georg@mysql.com>",
610 mysqlnd_native_auth_get_auth_data,
621 size_t * auth_data_len,
623 const size_t passwd_len,
zend_uchar * auth_plugin_data,
const size_t auth_plugin_data_len,
632 if (passwd && passwd_len) {
639 *auth_data_len = passwd_len + 1;
650 "auth_plugin_mysql_clear_password",
654 "Andrey Hristov <andrey@php.net>, Ulf Wendel <uw@php.net>, Georg Richter <georg@php.net>",
664 mysqlnd_pam_auth_get_auth_data,
671#ifdef MYSQLND_HAVE_SSL
673mysqlnd_xor_string(
char * dst,
const size_t dst_len,
const char * xor_str,
const size_t xor_str_len)
676 for (i = 0; i <= dst_len; ++i) {
677 dst[i] ^= xor_str[i % xor_str_len];
683#include <openssl/rsa.h>
684#include <openssl/pem.h>
685#include <openssl/err.h>
687typedef EVP_PKEY * mysqlnd_rsa_t;
691mysqlnd_sha256_get_rsa_from_pem(
const char *
buf,
size_t len)
693 BIO *bio = BIO_new_mem_buf(
buf,
len);
702mysqlnd_sha256_public_encrypt(
MYSQLND_CONN_DATA * conn, mysqlnd_rsa_t server_public_key,
size_t passwd_len,
size_t * auth_data_len,
char *xor_str)
705 size_t server_public_key_len = (size_t) EVP_PKEY_size(server_public_key);
707 DBG_ENTER(
"mysqlnd_sha256_public_encrypt");
713 if (server_public_key_len <= passwd_len + 41) {
715 EVP_PKEY_free(server_public_key);
717 DBG_ERR(
"password is too long");
721 *auth_data_len = server_public_key_len;
722 ret = malloc(*auth_data_len);
723 EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new(server_public_key,
NULL);
724 if (!ctx || EVP_PKEY_encrypt_init(ctx) <= 0 ||
725 EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_OAEP_PADDING) <= 0 ||
726 EVP_PKEY_encrypt(ctx,
ret, &server_public_key_len, (
zend_uchar *) xor_str, passwd_len + 1) <= 0) {
727 DBG_ERR(
"encrypt failed");
731 EVP_PKEY_CTX_free(ctx);
732 EVP_PKEY_free(server_public_key);
742typedef HANDLE mysqlnd_rsa_t;
746mysqlnd_sha256_get_rsa_from_pem(
const char *
buf,
size_t len)
748 BCRYPT_KEY_HANDLE
ret = 0;
749 LPSTR der_buf =
NULL;
751 CERT_PUBLIC_KEY_INFO *key_info =
NULL;
755 if (!CryptStringToBinaryA(
buf,
len, CRYPT_STRING_BASE64HEADER,
NULL, &der_len,
NULL,
NULL)) {
759 if (!CryptStringToBinaryA(
buf,
len, CRYPT_STRING_BASE64HEADER, der_buf, &der_len,
NULL,
NULL)) {
762 if (!CryptDecodeObjectEx(X509_ASN_ENCODING, X509_PUBLIC_KEY_INFO, der_buf, der_len, CRYPT_ENCODE_ALLOC_FLAG,
NULL, &key_info, &key_info_len)) {
765 if (!CryptImportPublicKeyInfoEx2(X509_ASN_ENCODING, key_info, CRYPT_OID_INFO_PUBKEY_ENCRYPT_KEY_FLAG,
NULL, &
ret)) {
776 return (mysqlnd_rsa_t)
ret;
782mysqlnd_sha256_public_encrypt(
MYSQLND_CONN_DATA * conn, mysqlnd_rsa_t server_public_key,
size_t passwd_len,
size_t * auth_data_len,
char *xor_str)
785 DWORD server_public_key_len = passwd_len;
786 BCRYPT_OAEP_PADDING_INFO padding_info;
788 DBG_ENTER(
"mysqlnd_sha256_public_encrypt");
790 ZeroMemory(&padding_info,
sizeof padding_info);
791 padding_info.pszAlgId = BCRYPT_SHA1_ALGORITHM;
792 if (BCryptEncrypt((BCRYPT_KEY_HANDLE) server_public_key, xor_str, passwd_len + 1, &padding_info,
793 NULL, 0,
NULL, 0, &server_public_key_len, BCRYPT_PAD_OAEP)) {
802 if ((
size_t) server_public_key_len <= passwd_len + 41) {
804 BCryptDestroyKey((BCRYPT_KEY_HANDLE) server_public_key);
806 DBG_ERR(
"password is too long");
810 *auth_data_len = server_public_key_len;
811 ret = malloc(*auth_data_len);
812 if (BCryptEncrypt((BCRYPT_KEY_HANDLE) server_public_key, xor_str, passwd_len + 1, &padding_info,
813 NULL, 0,
ret, server_public_key_len, &server_public_key_len, BCRYPT_PAD_OAEP)) {
814 BCryptDestroyKey((BCRYPT_KEY_HANDLE) server_public_key);
817 BCryptDestroyKey((BCRYPT_KEY_HANDLE) server_public_key);
836 DBG_ENTER(
"mysqlnd_sha256_get_rsa_key");
837 DBG_INF_FMT(
"options_s256_pk=[%s] MYSQLND_G(sha256_server_public_key)=[%s]",
840 if (!fname || fname[0] ==
'\0') {
845 DBG_INF(
"requesting the public key from the server");
850 DBG_ERR_FMT(
"Error while sending public key request packet");
851 php_error(
E_WARNING,
"Error while sending public key request packet. PID=%d", getpid());
856 DBG_ERR_FMT(
"Error while receiving public key");
868 DBG_INF_FMT(
"ret=%p",
ret);
872 "sha256_server_public_key is not set for the connection or as mysqlnd.sha256_server_public_key");
873 DBG_ERR(
"server_public_key is not set");
877 DBG_INF_FMT(
"Key in a file. [%s]", fname);
883 DBG_INF(
"Successfully loaded");
898 size_t * auth_data_len,
900 const size_t passwd_len,
zend_uchar * auth_plugin_data,
const size_t auth_plugin_data_len,
906 mysqlnd_rsa_t server_public_key;
908 DBG_ENTER(
"mysqlnd_sha256_auth_get_auth_data");
909 DBG_INF_FMT(
"salt(%zu)=[%.*s]", auth_plugin_data_len, (
int) auth_plugin_data_len, auth_plugin_data);
913 DBG_INF(
"simple clear text under SSL");
917 *auth_data_len = passwd_len + 1;
918 ret = malloc(passwd_len + 1);
920 ret[passwd_len] =
'\0';
923 server_public_key = mysqlnd_sha256_get_rsa_key(conn, session_options, pfc_data);
925 if (server_public_key) {
927 char *xor_str =
do_alloca(passwd_len + 1, use_heap);
928 memcpy(xor_str, passwd, passwd_len);
929 xor_str[passwd_len] =
'\0';
933 mysqlnd_xor_string(xor_str, passwd_len, (
char *) auth_plugin_data,
SCRAMBLE_LENGTH);
934 ret = mysqlnd_sha256_public_encrypt(conn, server_public_key, passwd_len, auth_data_len, xor_str);
948 "auth_plugin_sha256_password",
952 "Andrey Hristov <andrey@php.net>, Ulf Wendel <uwendel@mysql.com>",
962 mysqlnd_sha256_auth_get_auth_data,
969#ifdef MYSQLND_HAVE_SSL
976#define SHA256_LENGTH 32
1010mysqlnd_caching_sha2_public_encrypt(
MYSQLND_CONN_DATA * conn, mysqlnd_rsa_t server_public_key,
size_t passwd_len,
unsigned char **crypted,
char *xor_str)
1012 size_t server_public_key_len = (size_t) EVP_PKEY_size(server_public_key);
1014 DBG_ENTER(
"mysqlnd_caching_sha2_public_encrypt");
1020 if (server_public_key_len <= passwd_len + 41) {
1022 EVP_PKEY_free(server_public_key);
1024 DBG_ERR(
"password is too long");
1028 *crypted =
emalloc(server_public_key_len);
1029 EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new(server_public_key,
NULL);
1030 if (!ctx || EVP_PKEY_encrypt_init(ctx) <= 0 ||
1031 EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_OAEP_PADDING) <= 0 ||
1032 EVP_PKEY_encrypt(ctx, *crypted, &server_public_key_len, (
zend_uchar *) xor_str, passwd_len + 1) <= 0) {
1033 DBG_ERR(
"encrypt failed");
1034 server_public_key_len = 0;
1036 EVP_PKEY_CTX_free(ctx);
1037 EVP_PKEY_free(server_public_key);
1046mysqlnd_caching_sha2_public_encrypt(
MYSQLND_CONN_DATA * conn, mysqlnd_rsa_t server_public_key,
size_t passwd_len,
unsigned char **crypted,
char *xor_str)
1048 DWORD server_public_key_len = passwd_len;
1049 BCRYPT_OAEP_PADDING_INFO padding_info;
1051 DBG_ENTER(
"mysqlnd_caching_sha2_public_encrypt");
1053 ZeroMemory(&padding_info,
sizeof padding_info);
1054 padding_info.pszAlgId = BCRYPT_SHA1_ALGORITHM;
1055 if (BCryptEncrypt((BCRYPT_KEY_HANDLE) server_public_key, xor_str, passwd_len + 1, &padding_info,
1056 NULL, 0,
NULL, 0, &server_public_key_len, BCRYPT_PAD_OAEP)) {
1065 if ((
size_t) server_public_key_len <= passwd_len + 41) {
1067 BCryptDestroyKey((BCRYPT_KEY_HANDLE) server_public_key);
1069 DBG_ERR(
"password is too long");
1073 *crypted =
emalloc(server_public_key_len);
1074 if (BCryptEncrypt((BCRYPT_KEY_HANDLE) server_public_key, xor_str, passwd_len + 1, &padding_info,
1075 NULL, 0, *crypted, server_public_key_len, &server_public_key_len, BCRYPT_PAD_OAEP)) {
1076 BCryptDestroyKey((BCRYPT_KEY_HANDLE) server_public_key);
1079 BCryptDestroyKey((BCRYPT_KEY_HANDLE) server_public_key);
1089 size_t * auth_data_len,
1091 const size_t passwd_len,
zend_uchar * auth_plugin_data,
const size_t auth_plugin_data_len,
1098 DBG_ENTER(
"mysqlnd_caching_sha2_get_auth_data");
1099 DBG_INF_FMT(
"salt(%zu)=[%.*s]", auth_plugin_data_len, (
int) auth_plugin_data_len, auth_plugin_data);
1104 DBG_ERR_FMT(
"The server sent wrong length for scramble %zu. Expected %u", auth_plugin_data_len,
SCRAMBLE_LENGTH);
1108 DBG_INF(
"First auth step: send hashed password");
1110 if (passwd && passwd_len) {
1111 ret = malloc(SHA256_LENGTH + 1);
1112 *auth_data_len = SHA256_LENGTH;
1114 ret[SHA256_LENGTH] =
'\0';
1115 DBG_INF_FMT(
"hash(%zu)=[%.*s]", *auth_data_len, (
int) *auth_data_len,
ret);
1131 DBG_ENTER(
"mysqlnd_cached_sha2_get_key");
1132 DBG_INF_FMT(
"options_s256_pk=[%s] MYSQLND_G(sha256_server_public_key)=[%s]",
1135 if (!fname || fname[0] ==
'\0') {
1140 DBG_INF(
"requesting the public key from the server");
1146 DBG_ERR_FMT(
"Error while sending public key request packet");
1147 php_error(
E_WARNING,
"Error while sending public key request packet. PID=%d", getpid());
1152 DBG_ERR_FMT(
"Error while receiving public key");
1164 DBG_INF_FMT(
"ret=%p",
ret);
1168 "caching_sha2_server_public_key is not set for the connection or as mysqlnd.sha256_server_public_key");
1169 DBG_ERR(
"server_public_key is not set");
1173 DBG_INF_FMT(
"Key in a file. [%s]", fname);
1179 DBG_INF(
"Successfully loaded");
1180 DBG_INF_FMT(
"Public key: %*.s", (
int)
ZSTR_LEN(key_str),
ZSTR_VAL(key_str));
1181 zend_string_release(key_str);
1194 const zend_uchar * auth_plugin_data,
const size_t auth_plugin_data_len,
1195 unsigned char **crypted,
1196 const char *
const passwd,
1197 const size_t passwd_len)
1199 mysqlnd_rsa_t server_public_key = mysqlnd_caching_sha2_get_key(conn);
1201 DBG_ENTER(
"mysqlnd_caching_sha2_get_and_use_key(");
1203 if (server_public_key) {
1204 int server_public_key_len;
1206 char *xor_str =
do_alloca(passwd_len + 1, use_heap);
1207 memcpy(xor_str, passwd, passwd_len);
1208 xor_str[passwd_len] =
'\0';
1209 mysqlnd_xor_string(xor_str, passwd_len, (
char *) auth_plugin_data,
SCRAMBLE_LENGTH);
1210 server_public_key_len = mysqlnd_caching_sha2_public_encrypt(conn, server_public_key, passwd_len, crypted, xor_str);
1230 const zend_uchar * auth_plugin_data,
const size_t auth_plugin_data_len,
1231 const char *
const passwd,
1232 const size_t passwd_len,
1233 char **new_auth_protocol,
size_t *new_auth_protocol_len,
1234 zend_uchar **new_auth_protocol_data,
size_t *new_auth_protocol_data_len
1237 DBG_ENTER(
"mysqlnd_caching_sha2_handle_server_response");
1240 if (passwd_len == 0) {
1241 DBG_INF(
"empty password fast path");
1254 DBG_ERR_FMT(
"ERROR:%u [SQLSTATE:%s] %s", result_packet.
error_no, result_packet.
sqlstate, result_packet.
error);
1259 DBG_INF(
"auth switch response");
1266 DBG_INF(
"fast path succeeded");
1269 if (is_secure_transport(conn)) {
1270 DBG_INF(
"fast path failed, doing full auth via secure transport");
1275 DBG_INF(
"fast path failed, doing full auth via insecure transport");
1276 result_packet.
password_len = mysqlnd_caching_sha2_get_and_use_key(conn, auth_plugin_data, auth_plugin_data_len, &result_packet.
password, passwd, passwd_len);
1300 "auth_plugin_caching_sha2_password",
1304 "Johannes Schlüter <johannes.schlueter@php.net>",
1314 mysqlnd_caching_sha2_get_auth_data,
1315 mysqlnd_caching_sha2_handle_server_response
1327#ifdef MYSQLND_HAVE_SSL
sha1(string $string, bool $binary=false)
zend_ffi_ctype_name_buf buf
PHP_HASH_API void PHP_SHA256Final(unsigned char digest[32], PHP_SHA256_CTX *context)
PHP_HASH_API void PHP_SHA256Update(PHP_SHA256_CTX *context, const unsigned char *input, size_t inputLen)
enum entity_charset charset
#define PHP_MYSQLND_VERSION
PHPAPI unsigned int mysqlnd_plugin_register_ex(struct st_mysqlnd_plugin_header *plugin)
#define MYSQLND_PLUGIN_API_VERSION
char * sha256_server_public_key
#define MYSQLND_VERSION_ID
PHPAPI const MYSQLND_CHARSET * mysqlnd_find_charset_nr(const unsigned int charsetno)
PHPAPI const MYSQLND_CHARSET * mysqlnd_find_charset_name(const char *const charsetname)
#define mnd_pemalloc(size, pers)
#define mnd_pestrndup(ptr, size, pers)
#define mnd_pestrdup(ptr, pers)
#define mnd_sprintf_free(p)
#define mnd_sprintf(p, mx_len, fmt,...)
#define mnd_emalloc(size)
#define mnd_pefree(ptr, pers)
void php_mysqlnd_scramble(zend_uchar *const buffer, const zend_uchar *const scramble, const zend_uchar *const password, const size_t password_len)
enum_func_status mysqlnd_connect_run_authentication(MYSQLND_CONN_DATA *const conn, const char *const user, const char *const passwd, const char *const db, const size_t db_len, const size_t passwd_len, const MYSQLND_STRING authentication_plugin_data, const char *const authentication_protocol, const unsigned int charset_no, const size_t server_capabilities, const MYSQLND_SESSION_OPTIONS *const session_options, const zend_ulong mysql_flags)
void mysqlnd_register_builtin_authentication_plugins(void)
enum_func_status mysqlnd_run_authentication(MYSQLND_CONN_DATA *const conn, const char *const user, const char *const passwd, const size_t passwd_len, const char *const db, const size_t db_len, const MYSQLND_STRING auth_plugin_data, const char *const auth_protocol, const unsigned int charset_no, const MYSQLND_SESSION_OPTIONS *const session_options, const zend_ulong mysql_flags, const bool silent, const bool is_change_user)
enum_func_status mysqlnd_auth_handshake(MYSQLND_CONN_DATA *conn, const char *const user, const char *const passwd, const size_t passwd_len, const char *const db, const size_t db_len, const MYSQLND_SESSION_OPTIONS *const session_options, const zend_ulong mysql_flags, const unsigned int server_charset_no, const bool use_full_blown_auth_packet, const char *const auth_protocol, struct st_mysqlnd_authentication_plugin *auth_plugin, const zend_uchar *const orig_auth_plugin_data, const size_t orig_auth_plugin_data_len, const zend_uchar *const auth_plugin_data, const size_t auth_plugin_data_len, char **switch_to_auth_protocol, size_t *const switch_to_auth_protocol_len, zend_uchar **switch_to_auth_protocol_data, size_t *const switch_to_auth_protocol_data_len)
enum_func_status mysqlnd_auth_change_user(MYSQLND_CONN_DATA *const conn, const char *const user, const size_t user_len, const char *const passwd, const size_t passwd_len, const char *const db, const size_t db_len, const bool silent, const bool use_full_blown_auth_packet, const char *const auth_protocol, struct st_mysqlnd_authentication_plugin *auth_plugin, const zend_uchar *const orig_auth_plugin_data, const size_t orig_auth_plugin_data_len, const zend_uchar *const auth_plugin_data, const size_t auth_plugin_data_len, char **switch_to_auth_protocol, size_t *const switch_to_auth_protocol_len, zend_uchar **switch_to_auth_protocol_data, size_t *const switch_to_auth_protocol_data_len)
PHPAPI const char *const mysqlnd_server_gone
#define SET_CONNECTION_STATE(state_struct, s)
#define UPSERT_STATUS_RESET(status)
#define DBG_RETURN(value)
#define CR_NOT_IMPLEMENTED
#define CR_MALFORMED_PACKET
#define CR_SERVER_GONE_ERROR
@ MYSQLND_OPT_AUTH_PROTOCOL
#define MYSQLND_DEFAULT_AUTH_PROTOCOL
#define CLIENT_CONNECT_ATTRS
enum func_status enum_func_status
struct st_mysqlnd_connection_data MYSQLND_CONN_DATA
struct st_mysqlnd_string MYSQLND_STRING
struct st_mysqlnd_protocol_frame_codec_data MYSQLND_PFC_DATA
#define COPY_CLIENT_ERROR(dest, source)
struct st_mysqlnd_charset MYSQLND_CHARSET
#define SET_CLIENT_ERROR(info, err_no, sqlstate, error)
struct st_mysqlnd_session_options MYSQLND_SESSION_OPTIONS
#define PACKET_FREE(packet)
struct st_mysqlnd_packet_sha256_pk_request MYSQLND_PACKET_SHA256_PK_REQUEST
#define PACKET_WRITE(conn, packet)
struct st_mysqlnd_packet_cached_sha2_result MYSQLND_PACKET_CACHED_SHA2_RESULT
struct st_mysqlnd_packet_ok MYSQLND_PACKET_OK
struct st_mysqlnd_packet_sha256_pk_request_response MYSQLND_PACKET_SHA256_PK_REQUEST_RESPONSE
struct st_mysqlnd_packet_auth MYSQLND_PACKET_AUTH
struct st_mysqlnd_packet_change_auth_response MYSQLND_PACKET_CHANGE_AUTH_RESPONSE
struct st_mysqlnd_packet_auth_response MYSQLND_PACKET_AUTH_RESPONSE
#define PACKET_READ(conn, packet)
struct st_mysqlnd_packet_chg_user_resp MYSQLND_PACKET_CHG_USER_RESPONSE
unsigned const char * end
#define PHP_SHA256Init(ctx)
struct _php_stream php_stream
#define PHP_STREAM_COPY_ALL
#define php_stream_close(stream)
#define php_stream_copy_to_mem(src, maxlen, persistent)
#define php_stream_open_wrapper(path, mode, options, opened)
PHPAPI void PHP_SHA1Final(unsigned char digest[20], PHP_SHA1_CTX *context)
PHPAPI void PHP_SHA1Update(PHP_SHA1_CTX *context, const unsigned char *input, size_t inputLen)
#define PHP_SHA1Init(ctx)
const php_stream_ops * ops
func_auth_plugin__handle_server_response handle_server_response
struct st_mysqlnd_authentication_plugin::@100167212302147031331007123040307330105264201161 methods
func_auth_plugin__get_auth_data get_auth_data
MYSQLND_SESSION_OPTIONS * options
MYSQLND_UPSERT_STATUS * upsert_status
zend_ulong server_capabilities
MYSQLND_STRING authentication_plugin_data
MYSQLND_PROTOCOL_PAYLOAD_DECODER_FACTORY * payload_decoder_factory
MYSQLND_ERROR_INFO * error_info
const MYSQLND_CHARSET * charset
MYSQLND_PFC * protocol_frame_codec
MYSQLND_CONNECTION_STATE state
MYSQLND_STRING last_message
char sqlstate[MYSQLND_SQLSTATE_LENGTH+1]
zend_uchar * new_auth_protocol_data
size_t new_auth_protocol_data_len
size_t new_auth_protocol_len
char error[MYSQLND_ERRMSG_SIZE+1]
char sqlstate[MYSQLND_SQLSTATE_LENGTH+1]
bool is_change_user_packet
const zend_uchar * auth_data
const char * auth_plugin_name
zend_uchar * new_auth_protocol_data
size_t new_auth_protocol_data_len
size_t new_auth_protocol_len
char sqlstate[MYSQLND_SQLSTATE_LENGTH+1]
char error[MYSQLND_ERRMSG_SIZE+1]
const zend_uchar * auth_data
size_t new_auth_protocol_data_len
size_t new_auth_protocol_len
MYSQLND_ERROR_INFO error_info
zend_uchar * new_auth_protocol_data
bool server_asked_323_auth
char * sha256_server_public_key
struct st_mysqlnd_protocol_frame_codec_data * data
unsigned int max_allowed_packet
struct st_mysqlnd_vio_data * data
ZEND_API char *ZEND_FASTCALL zend_strndup(const char *s, size_t length)
strcmp(string $string1, string $string2)
zend_string_release_ex(func->internal_function.function_name, 0)
struct _zend_string zend_string
#define ALLOCA_FLAG(name)
#define do_alloca(p, use_heap)
#define free_alloca(p, use_heap)