]> granicus.if.org Git - php/commitdiff
MNDR:
authorAndrey Hristov <andrey@php.net>
Tue, 10 Nov 2015 13:25:06 +0000 (14:25 +0100)
committerAndrey Hristov <andrey@php.net>
Thu, 12 Nov 2015 15:19:16 +0000 (16:19 +0100)
- move things out of mysqlnd_priv.h

28 files changed:
ext/mysqlnd/mysqlnd.c
ext/mysqlnd/mysqlnd.h
ext/mysqlnd/mysqlnd_alloc.c
ext/mysqlnd/mysqlnd_alloc.h
ext/mysqlnd/mysqlnd_auth.c
ext/mysqlnd/mysqlnd_auth.h [new file with mode: 0644]
ext/mysqlnd/mysqlnd_block_alloc.c
ext/mysqlnd/mysqlnd_block_alloc.h
ext/mysqlnd/mysqlnd_charset.c
ext/mysqlnd/mysqlnd_charset.h
ext/mysqlnd/mysqlnd_commands.c
ext/mysqlnd/mysqlnd_connection.h [new file with mode: 0644]
ext/mysqlnd/mysqlnd_debug.c
ext/mysqlnd/mysqlnd_debug.h
ext/mysqlnd/mysqlnd_driver.c
ext/mysqlnd/mysqlnd_enum_n_def.h
ext/mysqlnd/mysqlnd_libmysql_compat.h
ext/mysqlnd/mysqlnd_plugin.h [new file with mode: 0644]
ext/mysqlnd/mysqlnd_priv.h
ext/mysqlnd/mysqlnd_protocol_frame_codec.c
ext/mysqlnd/mysqlnd_ps.c
ext/mysqlnd/mysqlnd_ps.h [new file with mode: 0644]
ext/mysqlnd/mysqlnd_ps_codec.c
ext/mysqlnd/mysqlnd_result.c
ext/mysqlnd/mysqlnd_result_meta.c
ext/mysqlnd/mysqlnd_statistics.c
ext/mysqlnd/mysqlnd_statistics.h
ext/mysqlnd/mysqlnd_wireprotocol.c

index 4be40ff75d722db3a32ecf8611383c5cfc2937c0..2c9a554a9eec41e3f2511eb72242905ccbd5aebf 100644 (file)
 
 #include "php.h"
 #include "mysqlnd.h"
+#include "mysqlnd_connection.h"
 #include "mysqlnd_vio.h"
 #include "mysqlnd_protocol_frame_codec.h"
+#include "mysqlnd_auth.h"
 #include "mysqlnd_wireprotocol.h"
 #include "mysqlnd_priv.h"
 #include "mysqlnd_result.h"
 
 extern MYSQLND_CHARSET *mysqlnd_charsets;
 
-PHPAPI const char * const mysqlnd_old_passwd  = "mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. "
-"Please use an administration tool to reset your password with the command SET PASSWORD = PASSWORD('your_existing_password'). This will "
-"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 "
-"flag from your my.cnf file";
-
 PHPAPI const char * const mysqlnd_server_gone = "MySQL server has gone away";
 PHPAPI const char * const mysqlnd_out_of_sync = "Commands out of sync; you can't run this command now";
 PHPAPI const char * const mysqlnd_out_of_memory = "Out of memory";
@@ -417,36 +414,6 @@ MYSQLND_METHOD(mysqlnd_conn_data, end_psession)(MYSQLND_CONN_DATA * conn)
 /* }}} */
 
 
-/* {{{ mysqlnd_switch_to_ssl_if_needed */
-static enum_func_status
-mysqlnd_switch_to_ssl_if_needed(
-                       MYSQLND_CONN_DATA * conn,
-                       unsigned int charset_no,
-                       size_t server_capabilities,
-                       const MYSQLND_SESSION_OPTIONS * const session_options,
-                       zend_ulong mysql_flags)
-{
-       enum_func_status ret = FAIL;
-       const MYSQLND_CHARSET * charset;
-       DBG_ENTER("mysqlnd_switch_to_ssl_if_needed");
-
-       if (session_options->charset_name && (charset = mysqlnd_find_charset_name(session_options->charset_name))) {
-               charset_no      = charset->nr;
-       }
-
-       {
-               size_t client_capabilities = mysql_flags;
-               struct st_mysqlnd_protocol_command * command = conn->command_factory(COM_ENABLE_SSL, conn, client_capabilities, server_capabilities, charset_no);
-               if (command) {
-                       ret = command->run(command);
-                       command->free_command(command);
-               }
-       }
-       DBG_RETURN(ret);
-}
-/* }}} */
-
-
 /* {{{ mysqlnd_conn_data::fetch_auth_plugin_by_name */
 static struct st_mysqlnd_authentication_plugin *
 MYSQLND_METHOD(mysqlnd_conn_data, fetch_auth_plugin_by_name)(const char * const requested_protocol)
@@ -465,172 +432,6 @@ MYSQLND_METHOD(mysqlnd_conn_data, fetch_auth_plugin_by_name)(const char * const
 /* }}} */
 
 
-/* {{{ mysqlnd_run_authentication */
-static enum_func_status
-mysqlnd_run_authentication(
-                       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_STRING auth_plugin_data,
-                       const char * const auth_protocol,
-                       unsigned int charset_no,
-                       const MYSQLND_SESSION_OPTIONS * const session_options,
-                       zend_ulong mysql_flags,
-                       zend_bool silent,
-                       zend_bool is_change_user
-                       )
-{
-       enum_func_status ret = FAIL;
-       zend_bool first_call = TRUE;
-
-       char * switch_to_auth_protocol = NULL;
-       size_t switch_to_auth_protocol_len = 0;
-       char * requested_protocol = NULL;
-       zend_uchar * plugin_data;
-       size_t plugin_data_len;
-
-       DBG_ENTER("mysqlnd_run_authentication");
-
-       plugin_data_len = auth_plugin_data.l;
-       plugin_data = mnd_emalloc(plugin_data_len + 1);
-       if (!plugin_data) {
-               goto end;
-       }
-       memcpy(plugin_data, auth_plugin_data.s, plugin_data_len);
-       plugin_data[plugin_data_len] = '\0';
-
-       requested_protocol = mnd_pestrdup(auth_protocol? auth_protocol : MYSQLND_DEFAULT_AUTH_PROTOCOL, FALSE);
-       if (!requested_protocol) {
-               goto end;
-       }
-
-       do {
-               struct st_mysqlnd_authentication_plugin * auth_plugin = conn->m->fetch_auth_plugin_by_name(requested_protocol);
-
-               if (!auth_plugin) {
-                       php_error_docref(NULL, E_WARNING, "The server requested authentication method unknown to the client [%s]", requested_protocol);
-                       SET_CLIENT_ERROR(conn->error_info, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, "The server requested authentication method unknown to the client");
-                       goto end;
-               }
-               DBG_INF("plugin found");
-
-               {
-                       zend_uchar * switch_to_auth_protocol_data = NULL;
-                       size_t switch_to_auth_protocol_data_len = 0;
-                       zend_uchar * scrambled_data = NULL;
-                       size_t scrambled_data_len = 0;
-
-                       switch_to_auth_protocol = NULL;
-                       switch_to_auth_protocol_len = 0;
-
-                       if (conn->authentication_plugin_data.s) {
-                               mnd_pefree(conn->authentication_plugin_data.s, conn->persistent);
-                               conn->authentication_plugin_data.s = NULL;
-                       }
-                       conn->authentication_plugin_data.l = plugin_data_len;
-                       conn->authentication_plugin_data.s = mnd_pemalloc(conn->authentication_plugin_data.l, conn->persistent);
-                       if (!conn->authentication_plugin_data.s) {
-                               SET_OOM_ERROR(conn->error_info);
-                               goto end;
-                       }
-                       memcpy(conn->authentication_plugin_data.s, plugin_data, plugin_data_len);
-
-                       DBG_INF_FMT("salt(%d)=[%.*s]", plugin_data_len, plugin_data_len, plugin_data);
-                       /* The data should be allocated with malloc() */
-                       scrambled_data =
-                               auth_plugin->methods.get_auth_data(NULL, &scrambled_data_len, conn, user, passwd, passwd_len,
-                                                                                                  plugin_data, plugin_data_len, session_options,
-                                                                                                  conn->protocol_frame_codec->data, mysql_flags);
-                       if (conn->error_info->error_no) {
-                               goto end;
-                       }
-                       if (FALSE == is_change_user) {
-                               ret = mysqlnd_auth_handshake(conn, user, passwd, passwd_len, db, db_len, session_options, mysql_flags,
-                                                                                       charset_no,
-                                                                                       first_call,
-                                                                                       requested_protocol,
-                                                                                       scrambled_data, scrambled_data_len,
-                                                                                       &switch_to_auth_protocol, &switch_to_auth_protocol_len,
-                                                                                       &switch_to_auth_protocol_data, &switch_to_auth_protocol_data_len
-                                                                                       );
-                       } else {
-                               ret = mysqlnd_auth_change_user(conn, user, strlen(user), passwd, passwd_len, db, db_len, silent,
-                                                                                          first_call,
-                                                                                          requested_protocol,
-                                                                                          scrambled_data, scrambled_data_len,
-                                                                                          &switch_to_auth_protocol, &switch_to_auth_protocol_len,
-                                                                                          &switch_to_auth_protocol_data, &switch_to_auth_protocol_data_len
-                                                                                         );
-                       }
-                       first_call = FALSE;
-                       free(scrambled_data);
-
-                       DBG_INF_FMT("switch_to_auth_protocol=%s", switch_to_auth_protocol? switch_to_auth_protocol:"n/a");
-                       if (requested_protocol && switch_to_auth_protocol) {
-                               mnd_efree(requested_protocol);
-                               requested_protocol = switch_to_auth_protocol;
-                       }
-
-                       if (plugin_data) {
-                               mnd_efree(plugin_data);
-                       }
-                       plugin_data_len = switch_to_auth_protocol_data_len;
-                       plugin_data = switch_to_auth_protocol_data;
-               }
-               DBG_INF_FMT("conn->error_info->error_no = %d", conn->error_info->error_no);
-       } while (ret == FAIL && conn->error_info->error_no == 0 && switch_to_auth_protocol != NULL);
-
-       if (ret == PASS) {
-               DBG_INF_FMT("saving requested_protocol=%s", requested_protocol);
-               conn->m->set_client_option(conn, MYSQLND_OPT_AUTH_PROTOCOL, requested_protocol);
-       }
-end:
-       if (plugin_data) {
-               mnd_efree(plugin_data);
-       }
-       if (requested_protocol) {
-               mnd_efree(requested_protocol);
-       }
-
-       DBG_RETURN(ret);
-}
-/* }}} */
-
-
-/* {{{ mysqlnd_connect_run_authentication */
-enum_func_status
-mysqlnd_connect_run_authentication(
-                       MYSQLND_CONN_DATA * conn,
-                       const char * const user,
-                       const char * const passwd,
-                       const char * const db,
-                       size_t db_len,
-                       size_t passwd_len,
-                       MYSQLND_STRING authentication_plugin_data,
-                       const char * const authentication_protocol,
-                       const unsigned int charset_no,
-                       size_t server_capabilities,
-                       const MYSQLND_SESSION_OPTIONS * const session_options,
-                       zend_ulong mysql_flags
-                       )
-{
-       enum_func_status ret = FAIL;
-       DBG_ENTER("mysqlnd_connect_run_authentication");
-
-       ret = mysqlnd_switch_to_ssl_if_needed(conn, charset_no, server_capabilities, session_options, mysql_flags);
-       if (PASS == ret) {
-               ret = mysqlnd_run_authentication(conn, user, passwd, passwd_len, db, db_len,
-                                                                                authentication_plugin_data, authentication_protocol,
-                                                                                charset_no, session_options, mysql_flags, FALSE /*silent*/, FALSE/*is_change*/);
-       }
-       DBG_RETURN(ret);
-}
-/* }}} */
-
-
 /* {{{ mysqlnd_conn_data::execute_init_commands */
 static enum_func_status
 MYSQLND_METHOD(mysqlnd_conn_data, execute_init_commands)(MYSQLND_CONN_DATA * conn)
@@ -685,7 +486,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, get_updated_connect_flags)(MYSQLND_CONN_DATA *
                mysql_flags &= ~CLIENT_COMPRESS;
        }
 #else
-       if (pfc && pfc->data->flags & MYSQLND_NET_FLAG_USE_COMPRESSION) {
+       if (pfc && pfc->data->flags & MYSQLND_PROTOCOL_FLAG_USE_COMPRESSION) {
                mysql_flags |= CLIENT_COMPRESS;
        }
 #endif
index 58a3aef164b0ba751785adec2b2bbaaa7cbdfda3..a622c27b576be3dce501b66e123cade4ea9c389c 100644 (file)
@@ -61,6 +61,7 @@
 #include "mysqlnd_enum_n_def.h"
 #include "mysqlnd_structs.h"
 
+#define MYSQLND_STR_W_LEN(str)  str, (sizeof(str) - 1)
 
 /* Library related */
 PHPAPI void mysqlnd_library_init(void);
index c28044ca7f0b49552ac151ea172721b150a56b6a..db1d0a22b7893becfb2797886c8c11cc87dcaba7 100644 (file)
@@ -12,8 +12,7 @@
   | obtain it through the world-wide-web, please send a note to          |
   | license@php.net so we can mail you a copy immediately.               |
   +----------------------------------------------------------------------+
-  | Authors: Georg Richter <georg@mysql.com>                             |
-  |          Andrey Hristov <andrey@mysql.com>                           |
+  | Authors: Andrey Hristov <andrey@mysql.com>                           |
   |          Ulf Wendel <uwendel@mysql.com>                              |
   +----------------------------------------------------------------------+
 */
index 958aff893405e4edaef663c07c136aabd68b295c..6cac245c7da44a74bdaf45b8d0a253e255aab3b1 100644 (file)
   | obtain it through the world-wide-web, please send a note to          |
   | license@php.net so we can mail you a copy immediately.               |
   +----------------------------------------------------------------------+
-  | Authors: Georg Richter <georg@mysql.com>                             |
-  |          Andrey Hristov <andrey@mysql.com>                           |
+  | Authors: Andrey Hristov <andrey@mysql.com>                           |
   |          Ulf Wendel <uwendel@mysql.com>                              |
   +----------------------------------------------------------------------+
 */
 
-/* $Id: mysqlnd_debug.h 306938 2011-01-01 02:17:06Z felipe $ */
-/* $Id: mysqlnd_debug.h 306938 2011-01-01 02:17:06Z felipe $ */
-
 #ifndef MYSQLND_ALLOC_H
 #define MYSQLND_ALLOC_H
 
index e7d44becc335c620a7bd52726409d3e7525018e2..fb70884df8983401f9eb1b902cd85d5150f1a316 100644 (file)
   | obtain it through the world-wide-web, please send a note to          |
   | license@php.net so we can mail you a copy immediately.               |
   +----------------------------------------------------------------------+
-  | Authors: Georg Richter <georg@mysql.com>                             |
-  |          Andrey Hristov <andrey@mysql.com>                           |
+  | Authors: Andrey Hristov <andrey@mysql.com>                           |
   |          Ulf Wendel <uwendel@mysql.com>                              |
+  |          Georg Richter <georg@mysql.com>                             |
   +----------------------------------------------------------------------+
 */
 
 #include "php.h"
 #include "mysqlnd.h"
 #include "mysqlnd_structs.h"
+#include "mysqlnd_auth.h"
 #include "mysqlnd_wireprotocol.h"
+#include "mysqlnd_connection.h"
 #include "mysqlnd_priv.h"
 #include "mysqlnd_charset.h"
 #include "mysqlnd_debug.h"
 
+static const char * const mysqlnd_old_passwd  = "mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. "
+"Please use an administration tool to reset your password with the command SET PASSWORD = PASSWORD('your_existing_password'). This will "
+"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 "
+"flag from your my.cnf file";
+
+
+/* {{{ mysqlnd_run_authentication */
+enum_func_status
+mysqlnd_run_authentication(
+                       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_STRING auth_plugin_data,
+                       const char * const auth_protocol,
+                       unsigned int charset_no,
+                       const MYSQLND_SESSION_OPTIONS * const session_options,
+                       zend_ulong mysql_flags,
+                       zend_bool silent,
+                       zend_bool is_change_user
+                       )
+{
+       enum_func_status ret = FAIL;
+       zend_bool first_call = TRUE;
+
+       char * switch_to_auth_protocol = NULL;
+       size_t switch_to_auth_protocol_len = 0;
+       char * requested_protocol = NULL;
+       zend_uchar * plugin_data;
+       size_t plugin_data_len;
+
+       DBG_ENTER("mysqlnd_run_authentication");
+
+       plugin_data_len = auth_plugin_data.l;
+       plugin_data = mnd_emalloc(plugin_data_len + 1);
+       if (!plugin_data) {
+               goto end;
+       }
+       memcpy(plugin_data, auth_plugin_data.s, plugin_data_len);
+       plugin_data[plugin_data_len] = '\0';
+
+       requested_protocol = mnd_pestrdup(auth_protocol? auth_protocol : MYSQLND_DEFAULT_AUTH_PROTOCOL, FALSE);
+       if (!requested_protocol) {
+               goto end;
+       }
+
+       do {
+               struct st_mysqlnd_authentication_plugin * auth_plugin = conn->m->fetch_auth_plugin_by_name(requested_protocol);
+
+               if (!auth_plugin) {
+                       php_error_docref(NULL, E_WARNING, "The server requested authentication method unknown to the client [%s]", requested_protocol);
+                       SET_CLIENT_ERROR(conn->error_info, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, "The server requested authentication method unknown to the client");
+                       goto end;
+               }
+               DBG_INF("plugin found");
+
+               {
+                       zend_uchar * switch_to_auth_protocol_data = NULL;
+                       size_t switch_to_auth_protocol_data_len = 0;
+                       zend_uchar * scrambled_data = NULL;
+                       size_t scrambled_data_len = 0;
+
+                       switch_to_auth_protocol = NULL;
+                       switch_to_auth_protocol_len = 0;
+
+                       if (conn->authentication_plugin_data.s) {
+                               mnd_pefree(conn->authentication_plugin_data.s, conn->persistent);
+                               conn->authentication_plugin_data.s = NULL;
+                       }
+                       conn->authentication_plugin_data.l = plugin_data_len;
+                       conn->authentication_plugin_data.s = mnd_pemalloc(conn->authentication_plugin_data.l, conn->persistent);
+                       if (!conn->authentication_plugin_data.s) {
+                               SET_OOM_ERROR(conn->error_info);
+                               goto end;
+                       }
+                       memcpy(conn->authentication_plugin_data.s, plugin_data, plugin_data_len);
+
+                       DBG_INF_FMT("salt(%d)=[%.*s]", plugin_data_len, plugin_data_len, plugin_data);
+                       /* The data should be allocated with malloc() */
+                       scrambled_data =
+                               auth_plugin->methods.get_auth_data(NULL, &scrambled_data_len, conn, user, passwd, passwd_len,
+                                                                                                  plugin_data, plugin_data_len, session_options,
+                                                                                                  conn->protocol_frame_codec->data, mysql_flags);
+                       if (conn->error_info->error_no) {
+                               goto end;
+                       }
+                       if (FALSE == is_change_user) {
+                               ret = mysqlnd_auth_handshake(conn, user, passwd, passwd_len, db, db_len, session_options, mysql_flags,
+                                                                                       charset_no,
+                                                                                       first_call,
+                                                                                       requested_protocol,
+                                                                                       scrambled_data, scrambled_data_len,
+                                                                                       &switch_to_auth_protocol, &switch_to_auth_protocol_len,
+                                                                                       &switch_to_auth_protocol_data, &switch_to_auth_protocol_data_len
+                                                                                       );
+                       } else {
+                               ret = mysqlnd_auth_change_user(conn, user, strlen(user), passwd, passwd_len, db, db_len, silent,
+                                                                                          first_call,
+                                                                                          requested_protocol,
+                                                                                          scrambled_data, scrambled_data_len,
+                                                                                          &switch_to_auth_protocol, &switch_to_auth_protocol_len,
+                                                                                          &switch_to_auth_protocol_data, &switch_to_auth_protocol_data_len
+                                                                                         );
+                       }
+                       first_call = FALSE;
+                       free(scrambled_data);
+
+                       DBG_INF_FMT("switch_to_auth_protocol=%s", switch_to_auth_protocol? switch_to_auth_protocol:"n/a");
+                       if (requested_protocol && switch_to_auth_protocol) {
+                               mnd_efree(requested_protocol);
+                               requested_protocol = switch_to_auth_protocol;
+                       }
+
+                       if (plugin_data) {
+                               mnd_efree(plugin_data);
+                       }
+                       plugin_data_len = switch_to_auth_protocol_data_len;
+                       plugin_data = switch_to_auth_protocol_data;
+               }
+               DBG_INF_FMT("conn->error_info->error_no = %d", conn->error_info->error_no);
+       } while (ret == FAIL && conn->error_info->error_no == 0 && switch_to_auth_protocol != NULL);
+
+       if (ret == PASS) {
+               DBG_INF_FMT("saving requested_protocol=%s", requested_protocol);
+               conn->m->set_client_option(conn, MYSQLND_OPT_AUTH_PROTOCOL, requested_protocol);
+       }
+end:
+       if (plugin_data) {
+               mnd_efree(plugin_data);
+       }
+       if (requested_protocol) {
+               mnd_efree(requested_protocol);
+       }
+
+       DBG_RETURN(ret);
+}
+/* }}} */
+
+
+/* {{{ mysqlnd_switch_to_ssl_if_needed */
+static enum_func_status
+mysqlnd_switch_to_ssl_if_needed(MYSQLND_CONN_DATA * conn,
+                                                               unsigned int charset_no,
+                                                               size_t server_capabilities,
+                                                               const MYSQLND_SESSION_OPTIONS * const session_options,
+                                                               zend_ulong mysql_flags)
+{
+       enum_func_status ret = FAIL;
+       const MYSQLND_CHARSET * charset;
+       DBG_ENTER("mysqlnd_switch_to_ssl_if_needed");
+
+       if (session_options->charset_name && (charset = mysqlnd_find_charset_name(session_options->charset_name))) {
+               charset_no      = charset->nr;
+       }
+
+       {
+               size_t client_capabilities = mysql_flags;
+               struct st_mysqlnd_protocol_command * command = conn->command_factory(COM_ENABLE_SSL, conn, client_capabilities, server_capabilities, charset_no);
+               if (command) {
+                       ret = command->run(command);
+                       command->free_command(command);
+               }
+       }
+       DBG_RETURN(ret);
+}
+/* }}} */
+
+
+/* {{{ mysqlnd_connect_run_authentication */
+enum_func_status
+mysqlnd_connect_run_authentication(
+                       MYSQLND_CONN_DATA * conn,
+                       const char * const user,
+                       const char * const passwd,
+                       const char * const db,
+                       size_t db_len,
+                       size_t passwd_len,
+                       MYSQLND_STRING authentication_plugin_data,
+                       const char * const authentication_protocol,
+                       const unsigned int charset_no,
+                       size_t server_capabilities,
+                       const MYSQLND_SESSION_OPTIONS * const session_options,
+                       zend_ulong mysql_flags
+                       )
+{
+       enum_func_status ret = FAIL;
+       DBG_ENTER("mysqlnd_connect_run_authentication");
+
+       ret = mysqlnd_switch_to_ssl_if_needed(conn, charset_no, server_capabilities, session_options, mysql_flags);
+       if (PASS == ret) {
+               ret = mysqlnd_run_authentication(conn, user, passwd, passwd_len, db, db_len,
+                                                                                authentication_plugin_data, authentication_protocol,
+                                                                                charset_no, session_options, mysql_flags, FALSE /*silent*/, FALSE/*is_change*/);
+       }
+       DBG_RETURN(ret);
+}
+/* }}} */
+
+
 /* {{{ mysqlnd_auth_handshake */
 enum_func_status
 mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
diff --git a/ext/mysqlnd/mysqlnd_auth.h b/ext/mysqlnd/mysqlnd_auth.h
new file mode 100644 (file)
index 0000000..a54c606
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+  +----------------------------------------------------------------------+
+  | PHP Version 7                                                        |
+  +----------------------------------------------------------------------+
+  | Copyright (c) 2006-2015 The PHP Group                                |
+  +----------------------------------------------------------------------+
+  | This source file is subject to version 3.01 of the PHP license,      |
+  | that is bundled with this package in the file LICENSE, and is        |
+  | available through the world-wide-web at the following url:           |
+  | http://www.php.net/license/3_01.txt                                  |
+  | If you did not receive a copy of the PHP license and are unable to   |
+  | obtain it through the world-wide-web, please send a note to          |
+  | license@php.net so we can mail you a copy immediately.               |
+  +----------------------------------------------------------------------+
+  | Authors: Andrey Hristov <andrey@mysql.com>                           |
+  |          Ulf Wendel <uwendel@mysql.com>                              |
+  +----------------------------------------------------------------------+
+*/
+
+#ifndef MYSQLND_AUTH_H
+#define MYSQLND_AUTH_H
+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,
+                                               zend_ulong mysql_flags,
+                                               unsigned int server_charset_no,
+                                               zend_bool use_full_blown_auth_packet,
+                                               const char * const auth_protocol,
+                                               const zend_uchar * const auth_plugin_data,
+                                               const size_t auth_plugin_data_len,
+                                               char ** switch_to_auth_protocol,
+                                               size_t * switch_to_auth_protocol_len,
+                                               zend_uchar ** switch_to_auth_protocol_data,
+                                               size_t * switch_to_auth_protocol_data_len
+                                               );
+
+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,
+                                               zend_ulong mysql_flags,
+                                               unsigned int server_charset_no,
+                                               zend_bool use_full_blown_auth_packet,
+                                               const char * const auth_protocol,
+                                               const zend_uchar * const auth_plugin_data,
+                                               const size_t auth_plugin_data_len,
+                                               char ** switch_to_auth_protocol,
+                                               size_t * switch_to_auth_protocol_len,
+                                               zend_uchar ** switch_to_auth_protocol_data,
+                                               size_t * 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 zend_bool silent,
+                                                               zend_bool use_full_blown_auth_packet,
+                                                               const char * const auth_protocol,
+                                                               zend_uchar * auth_plugin_data,
+                                                               size_t auth_plugin_data_len,
+                                                               char ** switch_to_auth_protocol,
+                                                               size_t * switch_to_auth_protocol_len,
+                                                               zend_uchar ** switch_to_auth_protocol_data,
+                                                               size_t * switch_to_auth_protocol_data_len
+                                                               );
+
+
+enum_func_status
+mysqlnd_connect_run_authentication(
+                       MYSQLND_CONN_DATA * conn,
+                       const char * const user,
+                       const char * const passwd,
+                       const char * const db,
+                       size_t db_len,
+                       size_t passwd_len,
+                       MYSQLND_STRING authentication_plugin_data,
+                       const char * const authentication_protocol,
+                       const unsigned int charset_no,
+                       size_t server_capabilities,
+                       const MYSQLND_SESSION_OPTIONS * const session_options,
+                       zend_ulong mysql_flags
+                       );
+
+enum_func_status
+mysqlnd_run_authentication(
+                       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_STRING auth_plugin_data,
+                       const char * const auth_protocol,
+                       unsigned int charset_no,
+                       const MYSQLND_SESSION_OPTIONS * const session_options,
+                       zend_ulong mysql_flags,
+                       zend_bool silent,
+                       zend_bool is_change_user
+                       );
+
+#endif /* MYSQLND_AUTH_H */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
index 9a7fdae0f75eb58bfd99d5d484cef2e90583059a..95976fca3e4b2add0c56e193a791afec8d71c15d 100644 (file)
@@ -12,8 +12,7 @@
   | obtain it through the world-wide-web, please send a note to          |
   | license@php.net so we can mail you a copy immediately.               |
   +----------------------------------------------------------------------+
-  | Authors: Georg Richter <georg@mysql.com>                             |
-  |          Andrey Hristov <andrey@mysql.com>                           |
+  | Authors: Andrey Hristov <andrey@mysql.com>                           |
   |          Ulf Wendel <uwendel@mysql.com>                              |
   +----------------------------------------------------------------------+
 */
index 50e4c90512efe7fc447afaa19866dec833686db8..e56eb34cba80af90076576916296efa3af7b89ae 100644 (file)
   | obtain it through the world-wide-web, please send a note to          |
   | license@php.net so we can mail you a copy immediately.               |
   +----------------------------------------------------------------------+
-  | Authors: Georg Richter <georg@mysql.com>                             |
-  |          Andrey Hristov <andrey@mysql.com>                           |
+  | Authors: Andrey Hristov <andrey@mysql.com>                           |
   |          Ulf Wendel <uwendel@mysql.com>                              |
   +----------------------------------------------------------------------+
 */
 
-/* $Id$ */
-
 #ifndef MYSQLND_BLOCK_ALLOC_H
 #define MYSQLND_BLOCK_ALLOC_H
 
index 2bb6fde3d032cf48ae7570382f7fe3e39d010f02..7aa7f2e7ef591740168fdd36bb2270aa62e58465 100644 (file)
@@ -12,9 +12,9 @@
   | obtain it through the world-wide-web, please send a note to          |
   | license@php.net so we can mail you a copy immediately.               |
   +----------------------------------------------------------------------+
-  | Authors: Georg Richter <georg@mysql.com>                             |
-  |          Andrey Hristov <andrey@mysql.com>                           |
+  | Authors: Andrey Hristov <andrey@mysql.com>                           |
   |          Ulf Wendel <uwendel@mysql.com>                              |
+  |          Georg Richter <georg@mysql.com>                             |
   +----------------------------------------------------------------------+
 */
 #include "php.h"
index 8bdad7249e6cfbbac3ebc1891ccbe2d9baf15fe9..59784948f1452c1c26bc73783c0cdd8a9a1221d3 100644 (file)
   | obtain it through the world-wide-web, please send a note to          |
   | license@php.net so we can mail you a copy immediately.               |
   +----------------------------------------------------------------------+
-  | Authors: Georg Richter <georg@mysql.com>                             |
-  |          Andrey Hristov <andrey@mysql.com>                           |
+  | Authors: Andrey Hristov <andrey@mysql.com>                           |
   |          Ulf Wendel <uwendel@mysql.com>                              |
+  |          Georg Richter <georg@mysql.com>                             |
   +----------------------------------------------------------------------+
 */
-
 #ifndef MYSQLND_CHARSET_H
 #define MYSQLND_CHARSET_H
 
index 9b71f360080bac89a3aa796a11e2ec524a56bef5..094f8de46f913246eb9393ed4dad602a71e897d0 100644 (file)
@@ -19,7 +19,9 @@
 
 #include "php.h"
 #include "mysqlnd.h"
+#include "mysqlnd_connection.h"
 #include "mysqlnd_priv.h"
+#include "mysqlnd_auth.h"
 #include "mysqlnd_wireprotocol.h"
 #include "mysqlnd_statistics.h"
 #include "mysqlnd_debug.h"
diff --git a/ext/mysqlnd/mysqlnd_connection.h b/ext/mysqlnd/mysqlnd_connection.h
new file mode 100644 (file)
index 0000000..7036131
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+  +----------------------------------------------------------------------+
+  | PHP Version 7                                                        |
+  +----------------------------------------------------------------------+
+  | Copyright (c) 2006-2015 The PHP Group                                |
+  +----------------------------------------------------------------------+
+  | This source file is subject to version 3.01 of the PHP license,      |
+  | that is bundled with this package in the file LICENSE, and is        |
+  | available through the world-wide-web at the following url:           |
+  | http://www.php.net/license/3_01.txt                                  |
+  | If you did not receive a copy of the PHP license and are unable to   |
+  | obtain it through the world-wide-web, please send a note to          |
+  | license@php.net so we can mail you a copy immediately.               |
+  +----------------------------------------------------------------------+
+  | Authors: Andrey Hristov <andrey@mysql.com>                           |
+  |          Ulf Wendel <uwendel@mysql.com>                              |
+  +----------------------------------------------------------------------+
+*/
+
+#ifndef MYSQLND_CONNECTION_H
+#define MYSQLND_CONNECTION_H
+
+PHPAPI extern const char * const mysqlnd_out_of_sync;
+PHPAPI extern const char * const mysqlnd_server_gone;
+PHPAPI extern const char * const mysqlnd_out_of_memory;
+
+
+void mysqlnd_upsert_status_init(MYSQLND_UPSERT_STATUS * const upsert_status);
+
+#define UPSERT_STATUS_RESET(status)                                                    (status)->m->reset((status))
+
+#define UPSERT_STATUS_GET_SERVER_STATUS(status)                                (status)->server_status
+#define UPSERT_STATUS_SET_SERVER_STATUS(status, server_st)     (status)->server_status = (server_st)
+
+#define UPSERT_STATUS_GET_WARNINGS(status)                                     (status)->warning_count
+#define UPSERT_STATUS_SET_WARNINGS(status, warnings)           (status)->warning_count = (warnings)
+
+#define UPSERT_STATUS_GET_AFFECTED_ROWS(status)                                (status)->affected_rows
+#define UPSERT_STATUS_SET_AFFECTED_ROWS(status, rows)          (status)->affected_rows = (rows)
+#define UPSERT_STATUS_SET_AFFECTED_ROWS_TO_ERROR(status)       (status)->m->set_affected_rows_to_error((status))
+
+#define UPSERT_STATUS_GET_LAST_INSERT_ID(status)                       (status)->last_insert_id
+#define UPSERT_STATUS_SET_LAST_INSERT_ID(status, id)           (status)->last_insert_id = (id)
+
+
+/* Error handling */
+#define SET_NEW_MESSAGE(buf, buf_len, message, len, persistent) \
+       {\
+               if ((buf)) { \
+                       mnd_pefree((buf), (persistent)); \
+               } \
+               if ((message)) { \
+                       (buf) = mnd_pestrndup((message), (len), (persistent)); \
+               } else { \
+                       (buf) = NULL; \
+               } \
+               (buf_len) = (len); \
+       }
+
+#define SET_EMPTY_MESSAGE(buf, buf_len, persistent) \
+       {\
+               if ((buf)) { \
+                       mnd_pefree((buf), (persistent)); \
+                       (buf) = NULL; \
+               } \
+               (buf_len) = 0; \
+       }
+
+
+enum_func_status mysqlnd_error_info_init(MYSQLND_ERROR_INFO * const info, zend_bool persistent);
+
+#define GET_CONNECTION_STATE(state_struct)             (state_struct)->m->get((state_struct))
+#define SET_CONNECTION_STATE(state_struct, s)  (state_struct)->m->set((state_struct), (s))
+
+void mysqlnd_connection_state_init(struct st_mysqlnd_connection_state * const state);
+
+#endif /* MYSQLND_CONNECTION_H */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
index 886a6d8ac6981c2b24b6a27a80bcdef56c4c6ddc..87d8fe35d779f7eb0aeaab3829149d6c20c23e29 100644 (file)
   | obtain it through the world-wide-web, please send a note to          |
   | license@php.net so we can mail you a copy immediately.               |
   +----------------------------------------------------------------------+
-  | Authors: Georg Richter <georg@mysql.com>                             |
-  |          Andrey Hristov <andrey@mysql.com>                           |
+  | Authors: Andrey Hristov <andrey@mysql.com>                           |
   |          Ulf Wendel <uwendel@mysql.com>                              |
   +----------------------------------------------------------------------+
 */
-
-/* $Id$ */
-
 #include "php.h"
 #include "mysqlnd.h"
 #include "mysqlnd_priv.h"
index 1a571435076396873b21e54f2db2dccc38dcbb3b..7354d35a3ca79cf40b24f00639c916c94f81084a 100644 (file)
   | obtain it through the world-wide-web, please send a note to          |
   | license@php.net so we can mail you a copy immediately.               |
   +----------------------------------------------------------------------+
-  | Authors: Georg Richter <georg@mysql.com>                             |
-  |          Andrey Hristov <andrey@mysql.com>                           |
+  | Authors: Andrey Hristov <andrey@mysql.com>                           |
   |          Ulf Wendel <uwendel@mysql.com>                              |
   +----------------------------------------------------------------------+
 */
-
-/* $Id$ */
-
 #ifndef MYSQLND_DEBUG_H
 #define MYSQLND_DEBUG_H
 
@@ -70,6 +66,17 @@ void mysqlnd_debug_trace_plugin_register(void);
 
 PHPAPI MYSQLND_DEBUG * mysqlnd_debug_init(const char * skip_functions[]);
 
+#define MYSQLND_DEBUG_DUMP_TIME                                1
+#define MYSQLND_DEBUG_DUMP_TRACE                       2
+#define MYSQLND_DEBUG_DUMP_PID                         4
+#define MYSQLND_DEBUG_DUMP_LINE                                8
+#define MYSQLND_DEBUG_DUMP_FILE                                16
+#define MYSQLND_DEBUG_DUMP_LEVEL                       32
+#define MYSQLND_DEBUG_APPEND                           64
+#define MYSQLND_DEBUG_FLUSH                                    128
+#define MYSQLND_DEBUG_TRACE_MEMORY_CALLS       256
+#define MYSQLND_DEBUG_PROFILE_CALLS                    512
+
 
 #if defined(__GNUC__) || defined(PHP_WIN32)
 #ifdef PHP_WIN32
index f45ce661bdab90fe817557e64eecd1b776e7c8ef..b79effa338cb342eaf79e004f24028b7fe7e8927 100644 (file)
   |          Georg Richter <georg@mysql.com>                             |
   +----------------------------------------------------------------------+
 */
-
 #include "php.h"
 #include "mysqlnd.h"
 #include "mysqlnd_vio.h"
 #include "mysqlnd_protocol_frame_codec.h"
 #include "mysqlnd_wireprotocol.h"
+#include "mysqlnd_connection.h"
+#include "mysqlnd_ps.h"
+#include "mysqlnd_plugin.h"
 #include "mysqlnd_priv.h"
 #include "mysqlnd_statistics.h"
 #include "mysqlnd_debug.h"
index b4a74fae8321965d769c08cc7a4098bff48902c3..0bde8a969b69380ea715c79b2aab39e9d537c197 100644 (file)
                                CLIENT_PROTOCOL_41 | CLIENT_SECURE_CONNECTION | \
                                CLIENT_MULTI_RESULTS  | CLIENT_LOCAL_FILES | CLIENT_PLUGIN_AUTH)
 
-#define MYSQLND_NET_FLAG_USE_COMPRESSION 1
+#define MYSQLND_PROTOCOL_FLAG_USE_COMPRESSION 1
+
+
+/* Client Error codes */
+#define CR_UNKNOWN_ERROR               2000
+#define CR_CONNECTION_ERROR            2002
+#define CR_SERVER_GONE_ERROR   2006
+#define CR_OUT_OF_MEMORY               2008
+#define CR_SERVER_LOST                 2013
+#define CR_COMMANDS_OUT_OF_SYNC        2014
+#define CR_CANT_FIND_CHARSET   2019
+#define CR_MALFORMED_PACKET            2027
+#define CR_NOT_IMPLEMENTED             2054
+#define CR_NO_PREPARE_STMT             2030
+#define CR_PARAMS_NOT_BOUND            2031
+#define CR_INVALID_PARAMETER_NO        2034
+#define CR_INVALID_BUFFER_USE  2035
+
+#define MYSQLND_EE_FILENOTFOUND         7890
+
+#define UNKNOWN_SQLSTATE               "HY000"
+
+#define MAX_CHARSET_LEN                        32
 
 
 #define TRANS_START_NO_OPT                                             0
index 4685c2c673926d430227bb734a10c5c95e95935c..5a130880df7798b75b52f587d71c05e6035d1b35 100644 (file)
@@ -18,7 +18,6 @@
   +----------------------------------------------------------------------+
 
 */
-
 #ifndef MYSQLND_LIBMYSQL_COMPAT_H
 #define MYSQLND_LIBMYSQL_COMPAT_H
 
diff --git a/ext/mysqlnd/mysqlnd_plugin.h b/ext/mysqlnd/mysqlnd_plugin.h
new file mode 100644 (file)
index 0000000..eab2117
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+  +----------------------------------------------------------------------+
+  | PHP Version 7                                                        |
+  +----------------------------------------------------------------------+
+  | Copyright (c) 2006-2015 The PHP Group                                |
+  +----------------------------------------------------------------------+
+  | This source file is subject to version 3.01 of the PHP license,      |
+  | that is bundled with this package in the file LICENSE, and is        |
+  | available through the world-wide-web at the following url:           |
+  | http://www.php.net/license/3_01.txt                                  |
+  | If you did not receive a copy of the PHP license and are unable to   |
+  | obtain it through the world-wide-web, please send a note to          |
+  | license@php.net so we can mail you a copy immediately.               |
+  +----------------------------------------------------------------------+
+  | Authors: Andrey Hristov <andrey@mysql.com>                           |
+  |          Ulf Wendel <uwendel@mysql.com>                              |
+  +----------------------------------------------------------------------+
+*/
+#ifndef MYSQLND_PLUGIN_H
+#define MYSQLND_PLUGIN_H
+
+
+void mysqlnd_plugin_subsystem_init(void);
+void mysqlnd_plugin_subsystem_end(void);
+
+void mysqlnd_register_builtin_authentication_plugins(void);
+
+void mysqlnd_example_plugin_register(void);
+
+#endif /* MYSQLND_PLUGIN_H */
+
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
index e3bfee5d8c273b9e083ed847c48065459539b0b9..b334577a378246a5baf49c66c663c370b6d59e6c 100644 (file)
   +----------------------------------------------------------------------+
   | Authors: Andrey Hristov <andrey@mysql.com>                           |
   |          Ulf Wendel <uwendel@mysql.com>                              |
-  |          Georg Richter <georg@mysql.com>                             |
   +----------------------------------------------------------------------+
 */
 #ifndef MYSQLND_PRIV_H
 #define MYSQLND_PRIV_H
-
-#ifndef Z_ADDREF_P
-/* PHP 5.2, old GC */
-#define Z_ADDREF_P(pz)                         (++(pz)->refcount)
-#define Z_DELREF_P(pz)                         (--(pz)->refcount)
-#define Z_REFCOUNT_P(pz)                       ((pz)->refcount)
-#define Z_SET_REFCOUNT_P(pz, rc)       ((pz)->refcount = rc)
-#define Z_REFCOUNT_PP(ppz)                     Z_REFCOUNT_P(*(ppz))
-#define Z_DELREF_PP(ppz)                       Z_DELREF_P(*(ppz))
-#endif
-
-#ifdef ZTS
-#include "TSRM.h"
-#endif
-
-#ifndef pestrndup
-#define pestrndup(s, length, persistent) ((persistent)?zend_strndup((s),(length)):estrndup((s),(length)))
-#endif
-
-#define MYSQLND_STR_W_LEN(str)  str, (sizeof(str) - 1)
-
-#define MYSQLND_DEBUG_DUMP_TIME                                1
-#define MYSQLND_DEBUG_DUMP_TRACE                       2
-#define MYSQLND_DEBUG_DUMP_PID                         4
-#define MYSQLND_DEBUG_DUMP_LINE                                8
-#define MYSQLND_DEBUG_DUMP_FILE                                16
-#define MYSQLND_DEBUG_DUMP_LEVEL                       32
-#define MYSQLND_DEBUG_APPEND                           64
-#define MYSQLND_DEBUG_FLUSH                                    128
-#define MYSQLND_DEBUG_TRACE_MEMORY_CALLS       256
-#define MYSQLND_DEBUG_PROFILE_CALLS                    512
-
-
-/* Client Error codes */
-#define CR_UNKNOWN_ERROR               2000
-#define CR_CONNECTION_ERROR            2002
-#define CR_SERVER_GONE_ERROR   2006
-#define CR_OUT_OF_MEMORY               2008
-#define CR_SERVER_LOST                 2013
-#define CR_COMMANDS_OUT_OF_SYNC        2014
-#define CR_CANT_FIND_CHARSET   2019
-#define CR_MALFORMED_PACKET            2027
-#define CR_NOT_IMPLEMENTED             2054
-#define CR_NO_PREPARE_STMT             2030
-#define CR_PARAMS_NOT_BOUND            2031
-#define CR_INVALID_PARAMETER_NO        2034
-#define CR_INVALID_BUFFER_USE  2035
-
-#define MYSQLND_EE_FILENOTFOUND         7890
-
-#define UNKNOWN_SQLSTATE               "HY000"
-
-#define MAX_CHARSET_LEN                        32
-
-void mysqlnd_upsert_status_init(MYSQLND_UPSERT_STATUS * const upsert_status);
-
-#define UPSERT_STATUS_RESET(status)                                                    (status)->m->reset((status))
-
-#define UPSERT_STATUS_GET_SERVER_STATUS(status)                                (status)->server_status
-#define UPSERT_STATUS_SET_SERVER_STATUS(status, server_st)     (status)->server_status = (server_st)
-
-#define UPSERT_STATUS_GET_WARNINGS(status)                                     (status)->warning_count
-#define UPSERT_STATUS_SET_WARNINGS(status, warnings)           (status)->warning_count = (warnings)
-
-#define UPSERT_STATUS_GET_AFFECTED_ROWS(status)                                (status)->affected_rows
-#define UPSERT_STATUS_SET_AFFECTED_ROWS(status, rows)          (status)->affected_rows = (rows)
-#define UPSERT_STATUS_SET_AFFECTED_ROWS_TO_ERROR(status)       (status)->m->set_affected_rows_to_error((status))
-
-#define UPSERT_STATUS_GET_LAST_INSERT_ID(status)                       (status)->last_insert_id
-#define UPSERT_STATUS_SET_LAST_INSERT_ID(status, id)           (status)->last_insert_id = (id)
-
-
-/* Error handling */
-#define SET_NEW_MESSAGE(buf, buf_len, message, len, persistent) \
-       {\
-               if ((buf)) { \
-                       mnd_pefree((buf), (persistent)); \
-               } \
-               if ((message)) { \
-                       (buf) = mnd_pestrndup((message), (len), (persistent)); \
-               } else { \
-                       (buf) = NULL; \
-               } \
-               (buf_len) = (len); \
-       }
-
-#define SET_EMPTY_MESSAGE(buf, buf_len, persistent) \
-       {\
-               if ((buf)) { \
-                       mnd_pefree((buf), (persistent)); \
-                       (buf) = NULL; \
-               } \
-               (buf_len) = 0; \
-       }
-
-
-enum_func_status mysqlnd_error_info_init(MYSQLND_ERROR_INFO * const info, zend_bool persistent);
-
-#define GET_CONNECTION_STATE(state_struct)             (state_struct)->m->get((state_struct))
-#define SET_CONNECTION_STATE(state_struct, s)  (state_struct)->m->set((state_struct), (s))
-
-void mysqlnd_connection_state_init(struct st_mysqlnd_connection_state * const state);
-
-/* PS stuff */
-typedef void (*ps_field_fetch_func)(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_len, zend_uchar ** row);
-struct st_mysqlnd_perm_bind {
-       ps_field_fetch_func func;
-       /* should be signed int */
-       int                                     pack_len;
-       unsigned int            php_type;
-       zend_bool                       is_possibly_blob;
-       zend_bool                       can_ret_as_str_in_uni;
-};
-
-extern struct st_mysqlnd_perm_bind mysqlnd_ps_fetch_functions[MYSQL_TYPE_LAST + 1];
-
-enum_func_status mysqlnd_stmt_fetch_row_buffered(MYSQLND_RES * result, void * param, unsigned int flags, zend_bool * fetched_anything);
-enum_func_status mysqlnd_fetch_stmt_row_cursor(MYSQLND_RES * result, void * param, unsigned int flags, zend_bool * fetched_anything);
-
-
-PHPAPI extern const char * const mysqlnd_old_passwd;
-PHPAPI extern const char * const mysqlnd_out_of_sync;
-PHPAPI extern const char * const mysqlnd_server_gone;
-PHPAPI extern const char * const mysqlnd_out_of_memory;
-
 PHPAPI extern MYSQLND_CLASS_METHOD_TABLE_NAME_FORWARD(mysqlnd_object_factory);
 PHPAPI extern MYSQLND_CLASS_METHOD_TABLE_NAME_FORWARD(mysqlnd_conn);
 PHPAPI extern MYSQLND_CLASS_METHOD_TABLE_NAME_FORWARD(mysqlnd_conn_data);
@@ -157,82 +31,8 @@ PHPAPI extern MYSQLND_CLASS_METHOD_TABLE_NAME_FORWARD(mysqlnd_upsert_status);
 PHPAPI extern MYSQLND_CLASS_METHOD_TABLE_NAME_FORWARD(mysqlnd_error_info);
 
 enum_func_status mysqlnd_handle_local_infile(MYSQLND_CONN_DATA * conn, const char * const filename, zend_bool * is_warning);
-
-
-
-void _mysqlnd_init_ps_subsystem();/* This one is private, mysqlnd_library_init() will call it */
-void _mysqlnd_init_ps_fetch_subsystem();
-
-void ps_fetch_from_1_to_8_bytes(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_len, zend_uchar ** row, unsigned int byte_count);
-
-void mysqlnd_plugin_subsystem_init(void);
-void mysqlnd_plugin_subsystem_end(void);
-
-void mysqlnd_register_builtin_authentication_plugins(void);
-
-void mysqlnd_example_plugin_register(void);
-
-struct st_mysqlnd_packet_greet;
-struct st_mysqlnd_authentication_plugin;
-
-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,
-                                               zend_ulong mysql_flags,
-                                               unsigned int server_charset_no,
-                                               zend_bool use_full_blown_auth_packet,
-                                               const char * const auth_protocol,
-                                               const zend_uchar * const auth_plugin_data,
-                                               const size_t auth_plugin_data_len,
-                                               char ** switch_to_auth_protocol,
-                                               size_t * switch_to_auth_protocol_len,
-                                               zend_uchar ** switch_to_auth_protocol_data,
-                                               size_t * 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 zend_bool silent,
-                                                               zend_bool use_full_blown_auth_packet,
-                                                               const char * const auth_protocol,
-                                                               zend_uchar * auth_plugin_data,
-                                                               size_t auth_plugin_data_len,
-                                                               char ** switch_to_auth_protocol,
-                                                               size_t * switch_to_auth_protocol_len,
-                                                               zend_uchar ** switch_to_auth_protocol_data,
-                                                               size_t * switch_to_auth_protocol_data_len
-                                                               );
-
-enum_func_status
-mysqlnd_connect_run_authentication(
-                       MYSQLND_CONN_DATA * conn,
-                       const char * const user,
-                       const char * const passwd,
-                       const char * const db,
-                       size_t db_len,
-                       size_t passwd_len,
-                       MYSQLND_STRING authentication_plugin_data,
-                       const char * const authentication_protocol,
-                       const unsigned int charset_no,
-                       size_t server_capabilities,
-                       const MYSQLND_SESSION_OPTIONS * const session_options,
-                       zend_ulong mysql_flags
-                       );
-
 #endif /* MYSQLND_PRIV_H */
 
-
 /*
  * Local variables:
  * tab-width: 4
index 2c4d6323420fe8fc1806483a92d014ea4ecd998a..6fb3d8ffa9b64b05fca55ecfdd83801272cda5e7 100644 (file)
@@ -18,6 +18,7 @@
 */
 #include "php.h"
 #include "mysqlnd.h"
+#include "mysqlnd_connection.h"
 #include "mysqlnd_priv.h"
 #include "mysqlnd_wireprotocol.h"
 #include "mysqlnd_statistics.h"
@@ -420,17 +421,16 @@ MYSQLND_METHOD(mysqlnd_pfc, set_client_option)(MYSQLND_PFC * const pfc, enum_mys
        DBG_INF_FMT("option=%u", option);
        switch (option) {
                case MYSQL_OPT_COMPRESS:
-                       pfc->data->flags |= MYSQLND_NET_FLAG_USE_COMPRESSION;
+                       pfc->data->flags |= MYSQLND_PROTOCOL_FLAG_USE_COMPRESSION;
                        break;
-               case MYSQL_SERVER_PUBLIC_KEY:
-                       {
-                               zend_bool pers = pfc->persistent;
-                               if (pfc->data->sha256_server_public_key) {
-                                       mnd_pefree(pfc->data->sha256_server_public_key, pers);
-                               }
-                               pfc->data->sha256_server_public_key = value? mnd_pestrdup(value, pers) : NULL;
-                               break;
+               case MYSQL_SERVER_PUBLIC_KEY: {
+                       const zend_bool pers = pfc->persistent;
+                       if (pfc->data->sha256_server_public_key) {
+                               mnd_pefree(pfc->data->sha256_server_public_key, pers);
                        }
+                       pfc->data->sha256_server_public_key = value? mnd_pestrdup(value, pers) : NULL;
+                       break;
+               }
                default:
                        DBG_RETURN(FAIL);
        }
index d5a9b214bf90688284a0a6e1718c052a5575584f..be15c9b3ed2da03472df4069291835ab2ab3449a 100644 (file)
@@ -20,7 +20,9 @@
 #include "php.h"
 #include "mysqlnd.h"
 #include "mysqlnd_wireprotocol.h"
+#include "mysqlnd_connection.h"
 #include "mysqlnd_priv.h"
+#include "mysqlnd_ps.h"
 #include "mysqlnd_result.h"
 #include "mysqlnd_result_meta.h"
 #include "mysqlnd_statistics.h"
diff --git a/ext/mysqlnd/mysqlnd_ps.h b/ext/mysqlnd/mysqlnd_ps.h
new file mode 100644 (file)
index 0000000..801de6d
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+  +----------------------------------------------------------------------+
+  | PHP Version 7                                                        |
+  +----------------------------------------------------------------------+
+  | Copyright (c) 2006-2015 The PHP Group                                |
+  +----------------------------------------------------------------------+
+  | This source file is subject to version 3.01 of the PHP license,      |
+  | that is bundled with this package in the file LICENSE, and is        |
+  | available through the world-wide-web at the following url:           |
+  | http://www.php.net/license/3_01.txt                                  |
+  | If you did not receive a copy of the PHP license and are unable to   |
+  | obtain it through the world-wide-web, please send a note to          |
+  | license@php.net so we can mail you a copy immediately.               |
+  +----------------------------------------------------------------------+
+  | Authors: Andrey Hristov <andrey@mysql.com>                           |
+  |          Ulf Wendel <uwendel@mysql.com>                              |
+  +----------------------------------------------------------------------+
+*/
+
+#ifndef MYSQLND_PS_H
+#define MYSQLND_PS_H
+
+/* PS stuff */
+typedef void (*ps_field_fetch_func)(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_len, zend_uchar ** row);
+struct st_mysqlnd_perm_bind {
+       ps_field_fetch_func func;
+       /* should be signed int */
+       int                                     pack_len;
+       unsigned int            php_type;
+       zend_bool                       is_possibly_blob;
+       zend_bool                       can_ret_as_str_in_uni;
+};
+
+extern struct st_mysqlnd_perm_bind mysqlnd_ps_fetch_functions[MYSQL_TYPE_LAST + 1];
+
+enum_func_status mysqlnd_stmt_fetch_row_buffered(MYSQLND_RES * result, void * param, unsigned int flags, zend_bool * fetched_anything);
+enum_func_status mysqlnd_fetch_stmt_row_cursor(MYSQLND_RES * result, void * param, unsigned int flags, zend_bool * fetched_anything);
+
+void _mysqlnd_init_ps_subsystem();/* This one is private, mysqlnd_library_init() will call it */
+void _mysqlnd_init_ps_fetch_subsystem();
+
+void ps_fetch_from_1_to_8_bytes(zval * zv, const MYSQLND_FIELD * const field, unsigned int pack_len, zend_uchar ** row, unsigned int byte_count);
+
+#endif /* MYSQLND_PS_H */
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim<600: noet sw=4 ts=4
+ */
index a474caf7303658d632303c016a7eec4decb0d56c..a6ad9ff3e5be1d41e6261a03d95aeeafe231c704 100644 (file)
@@ -22,6 +22,8 @@
 #include "php.h"
 #include "mysqlnd.h"
 #include "mysqlnd_wireprotocol.h"
+#include "mysqlnd_connection.h"
+#include "mysqlnd_ps.h"
 #include "mysqlnd_priv.h"
 #include "mysqlnd_debug.h"
 #include "mysql_float_to_double.h"
index f3f26b43cee432d5b777e47932d2c98be7359af7..62509f58973f4a126c5a66bdd1b8f703f11703e5 100644 (file)
   |          Georg Richter <georg@mysql.com>                             |
   +----------------------------------------------------------------------+
 */
-
-/* $Id$ */
 #include "php.h"
 #include "mysqlnd.h"
 #include "mysqlnd_wireprotocol.h"
 #include "mysqlnd_block_alloc.h"
+#include "mysqlnd_connection.h"
 #include "mysqlnd_priv.h"
 #include "mysqlnd_result.h"
 #include "mysqlnd_result_meta.h"
index bb6133471eebe952ebd12888462acdeb6816f65a..7da6756432aa1eee0aec7a315b3aeb8c76fd2683 100644 (file)
   |          Georg Richter <georg@mysql.com>                             |
   +----------------------------------------------------------------------+
 */
-
-/* $Id$ */
 #include "php.h"
 #include "mysqlnd.h"
+#include "mysqlnd_connection.h"
+#include "mysqlnd_ps.h"
 #include "mysqlnd_priv.h"
 #include "mysqlnd_result.h"
 #include "mysqlnd_wireprotocol.h"
index 6050e38e86e30200b37bc013616137c971d42ae7..bbd2eb0643581429c85e266647be9a6687e5735f 100644 (file)
   | obtain it through the world-wide-web, please send a note to          |
   | license@php.net so we can mail you a copy immediately.               |
   +----------------------------------------------------------------------+
-  | Authors: Georg Richter <georg@mysql.com>                             |
-  |          Andrey Hristov <andrey@mysql.com>                           |
+  | Authors: Andrey Hristov <andrey@mysql.com>                           |
   |          Ulf Wendel <uwendel@mysql.com>                              |
   +----------------------------------------------------------------------+
 */
-
-/* $Id$ */
 #include "php.h"
 #include "mysqlnd.h"
 #include "mysqlnd_priv.h"
@@ -26,9 +23,7 @@
 #include "mysqlnd_debug.h"
 
 
-/* {{{ mysqlnd_stats_values_names
- */
-
+/* {{{ mysqlnd_stats_values_names */
 const MYSQLND_STRING mysqlnd_stats_values_names[STAT_LAST] =
 {
        { MYSQLND_STR_W_LEN("bytes_sent") },
index 19aedf37a283e5549a91d0adda3f32b929574df9..6caf7fab9916b6df7b90bd3e8f0b9672a85eb111 100644 (file)
   | obtain it through the world-wide-web, please send a note to          |
   | license@php.net so we can mail you a copy immediately.               |
   +----------------------------------------------------------------------+
-  | Authors: Georg Richter <georg@mysql.com>                             |
-  |          Andrey Hristov <andrey@mysql.com>                           |
+  | Authors: Andrey Hristov <andrey@mysql.com>                           |
   |          Ulf Wendel <uwendel@mysql.com>                              |
   +----------------------------------------------------------------------+
 */
-
-/* $Id$ */
-
 #ifndef MYSQLND_STATISTICS_H
 #define MYSQLND_STATISTICS_H
 
-
 PHPAPI extern MYSQLND_STATS * mysqlnd_global_stats;
 
 extern const MYSQLND_STRING mysqlnd_stats_values_names[];
index 221b089442599401c8b3d4ae8d83efe56f69c690..868e38305243be3961181f540f6059065defb5a1 100644 (file)
@@ -19,6 +19,8 @@
 */
 #include "php.h"
 #include "mysqlnd.h"
+#include "mysqlnd_connection.h"
+#include "mysqlnd_ps.h"
 #include "mysqlnd_priv.h"
 #include "mysqlnd_wireprotocol.h"
 #include "mysqlnd_statistics.h"