]> granicus.if.org Git - php/commitdiff
MNDR :
authorAndrey Hristov <andrey@php.net>
Fri, 2 Oct 2015 12:08:59 +0000 (14:08 +0200)
committerAndrey Hristov <andrey@php.net>
Thu, 12 Nov 2015 15:19:16 +0000 (16:19 +0100)
- Rename MYSQLND_OPTIONS to MYSQLND_SESSION_OPTIONS
- Rename MYSQLND_NET_OPTIONS to MYSQLND_IO_OPTIONS

ext/mysqlnd/mysqlnd.c
ext/mysqlnd/mysqlnd_auth.c
ext/mysqlnd/mysqlnd_priv.h
ext/mysqlnd/mysqlnd_structs.h

index 6d4232dbd5aaf2fe4b808b008ca4219763aaffcc..e2596d385e67650a3c1e93ac9bd293a68632528a 100644 (file)
@@ -439,7 +439,7 @@ static enum_func_status
 mysqlnd_switch_to_ssl_if_needed(
                        MYSQLND_CONN_DATA * conn,
                        const MYSQLND_PACKET_GREET * const greet_packet,
-                       const MYSQLND_OPTIONS * const options,
+                       const MYSQLND_SESSION_OPTIONS * const session_options,
                        zend_ulong mysql_flags)
 {
        enum_func_status ret = FAIL;
@@ -481,7 +481,7 @@ mysqlnd_switch_to_ssl_if_needed(
        auth_packet->client_flags = mysql_flags;
        auth_packet->max_packet_size = MYSQLND_ASSEMBLED_PACKET_MAX_SIZE;
 
-       if (options->charset_name && (charset = mysqlnd_find_charset_name(options->charset_name))) {
+       if (session_options->charset_name && (charset = mysqlnd_find_charset_name(session_options->charset_name))) {
                auth_packet->charset_no = charset->nr;
        } else {
                auth_packet->charset_no = greet_packet->charset_no;
@@ -562,7 +562,7 @@ mysqlnd_run_authentication(
                        const size_t auth_plugin_data_len,
                        const char * const auth_protocol,
                        unsigned int charset_no,
-                       const MYSQLND_OPTIONS * const options,
+                       const MYSQLND_SESSION_OPTIONS * const session_options,
                        zend_ulong mysql_flags,
                        zend_bool silent,
                        zend_bool is_change_user
@@ -627,12 +627,13 @@ mysqlnd_run_authentication(
                        /* 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, options, &conn->net->data->options, mysql_flags);
+                                                                                                  plugin_data, plugin_data_len, session_options,
+                                                                                                  &conn->net->data->options, 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, options, mysql_flags,
+                               ret = mysqlnd_auth_handshake(conn, user, passwd, passwd_len, db, db_len, session_options, mysql_flags,
                                                                                        charset_no,
                                                                                        first_call,
                                                                                        requested_protocol,
@@ -694,18 +695,18 @@ mysqlnd_connect_run_authentication(
                        size_t db_len,
                        size_t passwd_len,
                        const MYSQLND_PACKET_GREET * const greet_packet,
-                       const MYSQLND_OPTIONS * const options,
+                       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, greet_packet, options, mysql_flags);
+       ret = mysqlnd_switch_to_ssl_if_needed(conn, greet_packet, session_options, mysql_flags);
        if (PASS == ret) {
                ret = mysqlnd_run_authentication(conn, user, passwd, passwd_len, db, db_len,
                                                                                 greet_packet->auth_plugin_data, greet_packet->auth_plugin_data_len, greet_packet->auth_protocol,
-                                                                                greet_packet->charset_no, options, mysql_flags, FALSE /*silent*/, FALSE/*is_change*/);
+                                                                                greet_packet->charset_no, session_options, mysql_flags, FALSE /*silent*/, FALSE/*is_change*/);
        }
        DBG_RETURN(ret);
 }
index e4632496f92ba32399fa2f109fa9be9ae9f7f63f..ac15bf66df1330990d709c9af3ef99156462619d 100644 (file)
@@ -36,7 +36,7 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
                                                          const size_t passwd_len,
                                                          const char * const db,
                                                          const size_t db_len,
-                                                         const MYSQLND_OPTIONS * const options,
+                                                         const MYSQLND_SESSION_OPTIONS * const session_options,
                                                          zend_ulong mysql_flags,
                                                          unsigned int server_charset_no,
                                                          zend_bool use_full_blown_auth_packet,
@@ -83,8 +83,8 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
                auth_packet = conn->protocol->m.get_auth_packet(conn->protocol, FALSE);
 
                auth_packet->client_flags = mysql_flags;
-               auth_packet->max_packet_size = options->max_allowed_packet;
-               if (options->charset_name && (charset = mysqlnd_find_charset_name(options->charset_name))) {
+               auth_packet->max_packet_size = session_options->max_allowed_packet;
+               if (session_options->charset_name && (charset = mysqlnd_find_charset_name(session_options->charset_name))) {
                        auth_packet->charset_no = charset->nr;
                } else {
                        auth_packet->charset_no = server_charset_no;
@@ -359,8 +359,8 @@ mysqlnd_native_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self
                                                                  size_t * auth_data_len,
                                                                  MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd,
                                                                  const size_t passwd_len, zend_uchar * auth_plugin_data, size_t auth_plugin_data_len,
-                                                                 const MYSQLND_OPTIONS * const options,
-                                                                 const MYSQLND_NET_OPTIONS * const net_options,
+                                                                 const MYSQLND_SESSION_OPTIONS * const session_options,
+                                                                 const MYSQLND_IO_OPTIONS * const io_options,
                                                                  zend_ulong mysql_flags
                                                                 )
 {
@@ -419,8 +419,8 @@ mysqlnd_pam_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self,
                                                           size_t * auth_data_len,
                                                           MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd,
                                                           const size_t passwd_len, zend_uchar * auth_plugin_data, size_t auth_plugin_data_len,
-                                                          const MYSQLND_OPTIONS * const options,
-                                                          const MYSQLND_NET_OPTIONS * const net_options,
+                                                          const MYSQLND_SESSION_OPTIONS * const session_options,
+                                                          const MYSQLND_IO_OPTIONS * const io_options,
                                                           zend_ulong mysql_flags
                                                          )
 {
@@ -480,18 +480,18 @@ mysqlnd_xor_string(char * dst, const size_t dst_len, const char * xor_str, const
 /* {{{ mysqlnd_sha256_get_rsa_key */
 static RSA *
 mysqlnd_sha256_get_rsa_key(MYSQLND_CONN_DATA * conn,
-                                                  const MYSQLND_OPTIONS * const options,
-                                                  const MYSQLND_NET_OPTIONS * const net_options
+                                                  const MYSQLND_SESSION_OPTIONS * const session_options,
+                                                  const MYSQLND_IO_OPTIONS * const io_options
                                                  )
 {
        RSA * ret = NULL;
-       const char * fname = (net_options->sha256_server_public_key && net_options->sha256_server_public_key[0] != '\0')?
-                                                               net_options->sha256_server_public_key:
+       const char * fname = (io_options->sha256_server_public_key && io_options->sha256_server_public_key[0] != '\0')?
+                                                               io_options->sha256_server_public_key:
                                                                MYSQLND_G(sha256_server_public_key);
        php_stream * stream;
        DBG_ENTER("mysqlnd_sha256_get_rsa_key");
        DBG_INF_FMT("options_s256_pk=[%s] MYSQLND_G(sha256_server_public_key)=[%s]",
-                                net_options->sha256_server_public_key? net_options->sha256_server_public_key:"n/a",
+                                io_options->sha256_server_public_key? io_options->sha256_server_public_key:"n/a",
                                 MYSQLND_G(sha256_server_public_key)? MYSQLND_G(sha256_server_public_key):"n/a");
        if (!fname || fname[0] == '\0') {
                MYSQLND_PACKET_SHA256_PK_REQUEST * pk_req_packet = NULL;
@@ -569,8 +569,8 @@ mysqlnd_sha256_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self
                                                                  size_t * auth_data_len,
                                                                  MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd,
                                                                  const size_t passwd_len, zend_uchar * auth_plugin_data, size_t auth_plugin_data_len,
-                                                                 const MYSQLND_OPTIONS * const options,
-                                                                 const MYSQLND_NET_OPTIONS * const net_options,
+                                                                 const MYSQLND_SESSION_OPTIONS * const session_options,
+                                                                 const MYSQLND_IO_OPTIONS * const io_options,
                                                                  zend_ulong mysql_flags
                                                                 )
 {
@@ -588,7 +588,7 @@ mysqlnd_sha256_auth_get_auth_data(struct st_mysqlnd_authentication_plugin * self
                memcpy(ret, passwd, passwd_len);
        } else {
                *auth_data_len = 0;
-               server_public_key = mysqlnd_sha256_get_rsa_key(conn, options, net_options);
+               server_public_key = mysqlnd_sha256_get_rsa_key(conn, session_options, io_options);
 
                if (server_public_key) {
                        int server_public_key_len;
index 683670f307ab1638f0f0eda061470a162234b896..2a78dd48b663eb8da2ff9a9e65efe0832f39ec34 100644 (file)
@@ -208,7 +208,7 @@ mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn,
                                                const size_t passwd_len,
                                                const char * const db,
                                                const size_t db_len,
-                                               const MYSQLND_OPTIONS * const options,
+                                               const MYSQLND_SESSION_OPTIONS * const session_options,
                                                zend_ulong mysql_flags,
                                                unsigned int server_charset_no,
                                                zend_bool use_full_blown_auth_packet,
index c01f5f9034e2bb7b96d9c746cb0c90f8da7a41a4..ef7ce41c23a7f1bf786e6021a33fa56848548ec5 100644 (file)
@@ -156,7 +156,7 @@ typedef struct st_mysqlnd_infile
        void    (*local_infile_end)(void *ptr);
 } MYSQLND_INFILE;
 
-typedef struct st_mysqlnd_options
+typedef struct st_mysqlnd_session_options
 {
        ulong           flags;
 
@@ -175,9 +175,9 @@ typedef struct st_mysqlnd_options
          in the memory which can crash external code. Feel free to reuse these.
        */
        HashTable       * connect_attr;
+       char            * unused1;
+       char            * unused2;
        char            * unused3;
-       char            * unused4;
-       char            * unused5;
 
        enum_mysqlnd_protocol_type protocol;
 
@@ -188,9 +188,9 @@ typedef struct st_mysqlnd_options
 #ifdef MYSQLND_STRING_TO_INT_CONVERSION
        zend_bool       int_and_float_native;
 #endif
-} MYSQLND_OPTIONS;
+} MYSQLND_SESSION_OPTIONS;
 
-typedef struct st_mysqlnd_net_options
+typedef struct st_mysqlnd_io_options
 {
        /* timeouts */
        unsigned int timeout_connect;
@@ -216,12 +216,7 @@ typedef struct st_mysqlnd_net_options
        uint64_t        flags;
 
        char *          sha256_server_public_key;
-
-       char *          unused1;
-       char *          unused2;
-       char *          unused3;
-       char *          unused4;
-} MYSQLND_NET_OPTIONS;
+} MYSQLND_IO_OPTIONS;
 
 
 
@@ -866,7 +861,7 @@ struct st_mysqlnd_net_data
 #else
        zend_uchar                      unused_pad1;
 #endif
-       MYSQLND_NET_OPTIONS     options;
+       MYSQLND_IO_OPTIONS      options;
 
        unsigned int            refcount;
 
@@ -969,8 +964,8 @@ struct st_mysqlnd_connection_data
        unsigned int    field_count;
 
        /* options */
-       MYSQLND_OPTIONS * options;
-       MYSQLND_OPTIONS options_impl;
+       MYSQLND_SESSION_OPTIONS * options;
+       MYSQLND_SESSION_OPTIONS options_impl;
 
        /* stats */
        MYSQLND_STATS   * stats;
@@ -1225,8 +1220,8 @@ typedef zend_uchar * (*func_auth_plugin__get_auth_data)(struct st_mysqlnd_authen
                                                                                                                size_t * auth_data_len,
                                                                                                                MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd,
                                                                                                                const size_t passwd_len, zend_uchar * auth_plugin_data, size_t auth_plugin_data_len,
-                                                                                                               const MYSQLND_OPTIONS * const options,
-                                                                                                               const MYSQLND_NET_OPTIONS * const net_options, zend_ulong mysql_flags
+                                                                                                               const MYSQLND_SESSION_OPTIONS * const session_options,
+                                                                                                               const MYSQLND_IO_OPTIONS * const io_options, zend_ulong mysql_flags
                                                                                                                );
 
 struct st_mysqlnd_authentication_plugin