Lines Matching refs:packet

28 	if (UNEXPECTED((size_t)(p - begin) > packet->header.size)) { \
94 php_mysqlnd_net_field_length(const zend_uchar **packet) in php_mysqlnd_net_field_length() argument
96 register const zend_uchar *p= (const zend_uchar *)*packet; in php_mysqlnd_net_field_length()
99 (*packet)++; in php_mysqlnd_net_field_length()
105 (*packet)++; in php_mysqlnd_net_field_length()
108 (*packet) += 3; in php_mysqlnd_net_field_length()
111 (*packet) += 4; in php_mysqlnd_net_field_length()
114 (*packet) += 9; in php_mysqlnd_net_field_length()
124 php_mysqlnd_net_field_length_ll(const zend_uchar **packet) in php_mysqlnd_net_field_length_ll() argument
126 register const zend_uchar *p = (zend_uchar *)*packet; in php_mysqlnd_net_field_length_ll()
129 (*packet)++; in php_mysqlnd_net_field_length_ll()
135 (*packet)++; in php_mysqlnd_net_field_length_ll()
138 (*packet) += 3; in php_mysqlnd_net_field_length_ll()
141 (*packet) += 4; in php_mysqlnd_net_field_length_ll()
144 (*packet) += 9; in php_mysqlnd_net_field_length_ll()
153 php_mysqlnd_net_store_length(zend_uchar *packet, const uint64_t length) in php_mysqlnd_net_store_length() argument
156 *packet = (zend_uchar) length; in php_mysqlnd_net_store_length()
157 return packet + 1; in php_mysqlnd_net_store_length()
161 *packet++ = 252; in php_mysqlnd_net_store_length()
162 int2store(packet,(unsigned int) length); in php_mysqlnd_net_store_length()
163 return packet + 2; in php_mysqlnd_net_store_length()
167 *packet++ = 253; in php_mysqlnd_net_store_length()
168 int3store(packet,(zend_ulong) length); in php_mysqlnd_net_store_length()
169 return packet + 3; in php_mysqlnd_net_store_length()
171 *packet++ = 254; in php_mysqlnd_net_store_length()
172 int8store(packet, length); in php_mysqlnd_net_store_length()
173 return packet + 8; in php_mysqlnd_net_store_length()
330 MYSQLND_PACKET_GREET *packet= (MYSQLND_PACKET_GREET *) _packet; in php_mysqlnd_greet_read() local
339 …if (FAIL == mysqlnd_read_packet_header_and_body(&(packet->header), pfc, vio, stats, error_info, co… in php_mysqlnd_greet_read()
344 packet->authentication_plugin_data.s = packet->intern_auth_plugin_data; in php_mysqlnd_greet_read()
345 packet->authentication_plugin_data.l = sizeof(packet->intern_auth_plugin_data); in php_mysqlnd_greet_read()
347 if (packet->header.size < sizeof(buf)) { in php_mysqlnd_greet_read()
352 buf[packet->header.size] = '\0'; in php_mysqlnd_greet_read()
355 packet->protocol_version = uint1korr(p); in php_mysqlnd_greet_read()
359 if (ERROR_MARKER == packet->protocol_version) { in php_mysqlnd_greet_read()
360 php_mysqlnd_read_error_from_line(p, packet->header.size - 1, in php_mysqlnd_greet_read()
361 packet->error, sizeof(packet->error), in php_mysqlnd_greet_read()
362 &packet->error_no, packet->sqlstate in php_mysqlnd_greet_read()
369 if (packet->error_no == 1040) { in php_mysqlnd_greet_read()
370 memcpy(packet->sqlstate, "08004", MYSQLND_SQLSTATE_LENGTH); in php_mysqlnd_greet_read()
381 packet->server_version = estrdup((char *)p); in php_mysqlnd_greet_read()
382 p+= strlen(packet->server_version) + 1; /* eat the '\0' */ in php_mysqlnd_greet_read()
385 packet->thread_id = uint4korr(p); in php_mysqlnd_greet_read()
389 memcpy(packet->authentication_plugin_data.s, p, SCRAMBLE_LENGTH_323); in php_mysqlnd_greet_read()
397 packet->server_capabilities = uint2korr(p); in php_mysqlnd_greet_read()
400 DBG_INF_FMT("4.1 server_caps=%u\n", (uint32_t) packet->server_capabilities); in php_mysqlnd_greet_read()
402 packet->charset_no = uint1korr(p); in php_mysqlnd_greet_read()
406 packet->server_status = uint2korr(p); in php_mysqlnd_greet_read()
415 if ((size_t) (p - buf) < packet->header.size) { in php_mysqlnd_greet_read()
417 …memcpy(packet->authentication_plugin_data.s + SCRAMBLE_LENGTH_323, p, SCRAMBLE_LENGTH - SCRAMBLE_L… in php_mysqlnd_greet_read()
421 packet->pre41 = TRUE; in php_mysqlnd_greet_read()
425 if ((size_t) (p - buf) < packet->header.size) { in php_mysqlnd_greet_read()
431 packet->server_capabilities |= ((uint32_t) uint2korr(pad_start)) << 16; in php_mysqlnd_greet_read()
433 packet->authentication_plugin_data.l = uint1korr(pad_start + 2); in php_mysqlnd_greet_read()
434 if (packet->authentication_plugin_data.l > SCRAMBLE_LENGTH) { in php_mysqlnd_greet_read()
436 char * new_auth_plugin_data = emalloc(packet->authentication_plugin_data.l); in php_mysqlnd_greet_read()
439 memcpy(new_auth_plugin_data, packet->authentication_plugin_data.s, SCRAMBLE_LENGTH); in php_mysqlnd_greet_read()
441 …memcpy(new_auth_plugin_data + SCRAMBLE_LENGTH, p, packet->authentication_plugin_data.l - SCRAMBLE_… in php_mysqlnd_greet_read()
442 p+= (packet->authentication_plugin_data.l - SCRAMBLE_LENGTH); in php_mysqlnd_greet_read()
443 packet->authentication_plugin_data.s = new_auth_plugin_data; in php_mysqlnd_greet_read()
447 if (packet->server_capabilities & CLIENT_PLUGIN_AUTH) { in php_mysqlnd_greet_read()
450 packet->auth_protocol = estrdup((char *)p); in php_mysqlnd_greet_read()
451 p+= strlen(packet->auth_protocol) + 1; /* eat the '\0' */ in php_mysqlnd_greet_read()
455 packet->protocol_version, packet->server_version, packet->thread_id); in php_mysqlnd_greet_read()
458 packet->server_capabilities, packet->charset_no, packet->server_status, in php_mysqlnd_greet_read()
459 packet->auth_protocol? packet->auth_protocol:"n/a", packet->authentication_plugin_data.l); in php_mysqlnd_greet_read()
463 DBG_ERR_FMT("GREET packet %d bytes shorter than expected", p - begin - packet->header.size); in php_mysqlnd_greet_read()
465 p - begin - packet->header.size); in php_mysqlnd_greet_read()
501 MYSQLND_PACKET_AUTH * packet= (MYSQLND_PACKET_AUTH *) _packet; in php_mysqlnd_auth_write() local
510 if (!packet->is_change_user_packet) { in php_mysqlnd_auth_write()
511 int4store(p, packet->client_flags); in php_mysqlnd_auth_write()
514 int4store(p, packet->max_packet_size); in php_mysqlnd_auth_write()
517 int1store(p, packet->charset_no); in php_mysqlnd_auth_write()
524 if (packet->send_auth_data || packet->is_change_user_packet) { in php_mysqlnd_auth_write()
525 len = MIN(strlen(packet->user), MYSQLND_MAX_ALLOWED_USER_LEN); in php_mysqlnd_auth_write()
526 memcpy(p, packet->user, len); in php_mysqlnd_auth_write()
531 if (packet->auth_data == NULL) { in php_mysqlnd_auth_write()
532 packet->auth_data_len = 0; in php_mysqlnd_auth_write()
534 if (packet->auth_data_len > 0xFF) { in php_mysqlnd_auth_write()
542 int1store(p, (int8_t)packet->auth_data_len); in php_mysqlnd_auth_write()
545 if (sizeof(buffer) < (packet->auth_data_len + (p - buffer))) { in php_mysqlnd_auth_write()
549 if (packet->auth_data_len) { in php_mysqlnd_auth_write()
550 memcpy(p, packet->auth_data, packet->auth_data_len); in php_mysqlnd_auth_write()
551 p+= packet->auth_data_len; in php_mysqlnd_auth_write()
554 if (packet->db_len > 0) { in php_mysqlnd_auth_write()
556 size_t real_db_len = MIN(MYSQLND_MAX_ALLOWED_DB_LEN, packet->db_len); in php_mysqlnd_auth_write()
557 memcpy(p, packet->db, real_db_len); in php_mysqlnd_auth_write()
560 } else if (packet->is_change_user_packet) { in php_mysqlnd_auth_write()
565 if (packet->is_change_user_packet) { in php_mysqlnd_auth_write()
566 if (packet->charset_no) { in php_mysqlnd_auth_write()
567 int2store(p, packet->charset_no); in php_mysqlnd_auth_write()
572 if (packet->auth_plugin_name) { in php_mysqlnd_auth_write()
573 len = MIN(strlen(packet->auth_plugin_name), sizeof(buffer) - (p - buffer) - 1); in php_mysqlnd_auth_write()
574 memcpy(p, packet->auth_plugin_name, len); in php_mysqlnd_auth_write()
579 if (packet->connect_attr && zend_hash_num_elements(packet->connect_attr)) { in php_mysqlnd_auth_write()
585 ZEND_HASH_FOREACH_STR_KEY_VAL(packet->connect_attr, key, entry_value) { in php_mysqlnd_auth_write()
603 ZEND_HASH_FOREACH_STR_KEY_VAL(packet->connect_attr, key, entry_value) { in php_mysqlnd_auth_write()
623 if (packet->is_change_user_packet) { in php_mysqlnd_auth_write()
626 const unsigned int silent = packet->silent; in php_mysqlnd_auth_write()
651 register MYSQLND_PACKET_AUTH_RESPONSE * packet= (MYSQLND_PACKET_AUTH_RESPONSE *) _packet; in php_mysqlnd_auth_response_read() local
667 …if (FAIL == mysqlnd_read_packet_header_and_body(&(packet->header), pfc, vio, stats, error_info, co… in php_mysqlnd_auth_response_read()
676 buf[packet->header.size] = '\0'; in php_mysqlnd_auth_response_read()
679 packet->response_code = uint1korr(p); in php_mysqlnd_auth_response_read()
683 if (ERROR_MARKER == packet->response_code) { in php_mysqlnd_auth_response_read()
684 php_mysqlnd_read_error_from_line(p, packet->header.size - 1, in php_mysqlnd_auth_response_read()
685 packet->error, sizeof(packet->error), in php_mysqlnd_auth_response_read()
686 &packet->error_no, packet->sqlstate in php_mysqlnd_auth_response_read()
690 if (0xFE == packet->response_code) { in php_mysqlnd_auth_response_read()
692 if (packet->header.size > (size_t) (p - buf)) { in php_mysqlnd_auth_response_read()
693 packet->new_auth_protocol = mnd_pestrdup((char *)p, FALSE); in php_mysqlnd_auth_response_read()
694 packet->new_auth_protocol_len = strlen(packet->new_auth_protocol); in php_mysqlnd_auth_response_read()
695 p+= packet->new_auth_protocol_len + 1; /* +1 for the \0 */ in php_mysqlnd_auth_response_read()
697 packet->new_auth_protocol_data_len = packet->header.size - (size_t) (p - buf); in php_mysqlnd_auth_response_read()
698 if (packet->new_auth_protocol_data_len) { in php_mysqlnd_auth_response_read()
699 packet->new_auth_protocol_data = mnd_emalloc(packet->new_auth_protocol_data_len); in php_mysqlnd_auth_response_read()
700 memcpy(packet->new_auth_protocol_data, p, packet->new_auth_protocol_data_len); in php_mysqlnd_auth_response_read()
702 DBG_INF_FMT("The server requested switching auth plugin to : %s", packet->new_auth_protocol); in php_mysqlnd_auth_response_read()
703 …_INF_FMT("Server salt : [%d][%.*s]", packet->new_auth_protocol_data_len, packet->new_auth_protocol… in php_mysqlnd_auth_response_read()
708 packet->affected_rows = php_mysqlnd_net_field_length_ll(&p); in php_mysqlnd_auth_response_read()
711 packet->last_insert_id = php_mysqlnd_net_field_length_ll(&p); in php_mysqlnd_auth_response_read()
714 packet->server_status = uint2korr(p); in php_mysqlnd_auth_response_read()
718 packet->warning_count = uint2korr(p); in php_mysqlnd_auth_response_read()
723 if (packet->header.size > (size_t) (p - buf) && (net_len = php_mysqlnd_net_field_length(&p))) { in php_mysqlnd_auth_response_read()
724 packet->message_len = MIN(net_len, buf_len - (p - begin)); in php_mysqlnd_auth_response_read()
725 packet->message = mnd_pestrndup((char *)p, packet->message_len, FALSE); in php_mysqlnd_auth_response_read()
727 packet->message = NULL; in php_mysqlnd_auth_response_read()
728 packet->message_len = 0; in php_mysqlnd_auth_response_read()
732 packet->affected_rows, packet->last_insert_id, packet->server_status, in php_mysqlnd_auth_response_read()
733 packet->warning_count); in php_mysqlnd_auth_response_read()
738 DBG_ERR_FMT("OK packet %d bytes shorter than expected", p - begin - packet->header.size); in php_mysqlnd_auth_response_read()
740 p - begin - packet->header.size); in php_mysqlnd_auth_response_read()
774 MYSQLND_PACKET_CHANGE_AUTH_RESPONSE *packet= (MYSQLND_PACKET_CHANGE_AUTH_RESPONSE *) _packet; in php_mysqlnd_change_auth_response_write() local
780 size_t total_packet_size = packet->auth_data_len + MYSQLND_HEADER_SIZE; in php_mysqlnd_change_auth_response_write()
786 if (packet->auth_data_len) { in php_mysqlnd_change_auth_response_write()
787 memcpy(p, packet->auth_data, packet->auth_data_len); in php_mysqlnd_change_auth_response_write()
788 p+= packet->auth_data_len; in php_mysqlnd_change_auth_response_write()
815 register MYSQLND_PACKET_OK *packet= (MYSQLND_PACKET_OK *) _packet; in php_mysqlnd_ok_read() local
830 …if (FAIL == mysqlnd_read_packet_header_and_body(&(packet->header), pfc, vio, stats, error_info, co… in php_mysqlnd_ok_read()
836 packet->field_count = uint1korr(p); in php_mysqlnd_ok_read()
840 if (ERROR_MARKER == packet->field_count) { in php_mysqlnd_ok_read()
841 php_mysqlnd_read_error_from_line(p, packet->header.size - 1, in php_mysqlnd_ok_read()
842 packet->error, sizeof(packet->error), in php_mysqlnd_ok_read()
843 &packet->error_no, packet->sqlstate in php_mysqlnd_ok_read()
848 packet->affected_rows = php_mysqlnd_net_field_length_ll(&p); in php_mysqlnd_ok_read()
851 packet->last_insert_id = php_mysqlnd_net_field_length_ll(&p); in php_mysqlnd_ok_read()
854 packet->server_status = uint2korr(p); in php_mysqlnd_ok_read()
858 packet->warning_count = uint2korr(p); in php_mysqlnd_ok_read()
863 if (packet->header.size > (size_t) (p - buf) && (net_len = php_mysqlnd_net_field_length(&p))) { in php_mysqlnd_ok_read()
864 packet->message_len = MIN(net_len, buf_len - (p - begin)); in php_mysqlnd_ok_read()
865 packet->message = mnd_pestrndup((char *)p, packet->message_len, FALSE); in php_mysqlnd_ok_read()
867 packet->message = NULL; in php_mysqlnd_ok_read()
868 packet->message_len = 0; in php_mysqlnd_ok_read()
872 packet->affected_rows, packet->last_insert_id, packet->server_status, in php_mysqlnd_ok_read()
873 packet->warning_count); in php_mysqlnd_ok_read()
879 DBG_ERR_FMT("OK packet %d bytes shorter than expected", p - begin - packet->header.size); in php_mysqlnd_ok_read()
881 p - begin - packet->header.size); in php_mysqlnd_ok_read()
910 MYSQLND_PACKET_EOF *packet= (MYSQLND_PACKET_EOF *) _packet; in php_mysqlnd_eof_read() local
923 …if (FAIL == mysqlnd_read_packet_header_and_body(&(packet->header), pfc, vio, stats, error_info, co… in php_mysqlnd_eof_read()
929 packet->field_count = uint1korr(p); in php_mysqlnd_eof_read()
933 if (ERROR_MARKER == packet->field_count) { in php_mysqlnd_eof_read()
934 php_mysqlnd_read_error_from_line(p, packet->header.size - 1, in php_mysqlnd_eof_read()
935 packet->error, sizeof(packet->error), in php_mysqlnd_eof_read()
936 &packet->error_no, packet->sqlstate in php_mysqlnd_eof_read()
946 if (packet->header.size > 1) { in php_mysqlnd_eof_read()
947 packet->warning_count = uint2korr(p); in php_mysqlnd_eof_read()
951 packet->server_status = uint2korr(p); in php_mysqlnd_eof_read()
955 packet->warning_count = 0; in php_mysqlnd_eof_read()
956 packet->server_status = 0; in php_mysqlnd_eof_read()
962 packet->field_count, packet->server_status, packet->warning_count); in php_mysqlnd_eof_read()
966 DBG_ERR_FMT("EOF packet %d bytes shorter than expected", p - begin - packet->header.size); in php_mysqlnd_eof_read()
968 p - begin - packet->header.size); in php_mysqlnd_eof_read()
978 MYSQLND_PACKET_COMMAND * packet= (MYSQLND_PACKET_COMMAND *) _packet; in php_mysqlnd_cmd_write() local
996 vio->data->m.consume_uneaten_data(vio, packet->command); in php_mysqlnd_cmd_write()
999 if (!packet->argument.s || !packet->argument.l) { in php_mysqlnd_cmd_write()
1002 int1store(buffer + MYSQLND_HEADER_SIZE, packet->command); in php_mysqlnd_cmd_write()
1005 size_t tmp_len = packet->argument.l + 1 + MYSQLND_HEADER_SIZE; in php_mysqlnd_cmd_write()
1013 int1store(p, packet->command); in php_mysqlnd_cmd_write()
1016 memcpy(p, packet->argument.s, packet->argument.l); in php_mysqlnd_cmd_write()
1037 MYSQLND_PACKET_RSET_HEADER * packet= (MYSQLND_PACKET_RSET_HEADER *) _packet; in php_mysqlnd_rset_header_read() local
1052 …if (FAIL == mysqlnd_read_packet_header_and_body(&(packet->header), pfc, vio, stats, error_info, co… in php_mysqlnd_rset_header_read()
1065 php_mysqlnd_read_error_from_line(p, packet->header.size - 1, in php_mysqlnd_rset_header_read()
1066 packet->error_info.error, sizeof(packet->error_info.error), in php_mysqlnd_rset_header_read()
1067 &packet->error_info.error_no, packet->error_info.sqlstate in php_mysqlnd_rset_header_read()
1072 packet->field_count = php_mysqlnd_net_field_length(&p); in php_mysqlnd_rset_header_read()
1075 switch (packet->field_count) { in php_mysqlnd_rset_header_read()
1085 len = packet->header.size - 1; in php_mysqlnd_rset_header_read()
1086 packet->info_or_local_file.s = mnd_emalloc(len + 1); in php_mysqlnd_rset_header_read()
1087 if (packet->info_or_local_file.s) { in php_mysqlnd_rset_header_read()
1088 memcpy(packet->info_or_local_file.s, p, len); in php_mysqlnd_rset_header_read()
1089 packet->info_or_local_file.s[len] = '\0'; in php_mysqlnd_rset_header_read()
1090 packet->info_or_local_file.l = len; in php_mysqlnd_rset_header_read()
1098 packet->affected_rows = php_mysqlnd_net_field_length_ll(&p); in php_mysqlnd_rset_header_read()
1101 packet->last_insert_id = php_mysqlnd_net_field_length_ll(&p); in php_mysqlnd_rset_header_read()
1104 packet->server_status = uint2korr(p); in php_mysqlnd_rset_header_read()
1108 packet->warning_count = uint2korr(p); in php_mysqlnd_rset_header_read()
1112 if (packet->header.size > (size_t) (p - buf) && (len = php_mysqlnd_net_field_length(&p))) { in php_mysqlnd_rset_header_read()
1113 packet->info_or_local_file.s = mnd_emalloc(len + 1); in php_mysqlnd_rset_header_read()
1114 if (packet->info_or_local_file.s) { in php_mysqlnd_rset_header_read()
1115 memcpy(packet->info_or_local_file.s, p, len); in php_mysqlnd_rset_header_read()
1116 packet->info_or_local_file.s[len] = '\0'; in php_mysqlnd_rset_header_read()
1117 packet->info_or_local_file.l = len; in php_mysqlnd_rset_header_read()
1124 packet->affected_rows, packet->last_insert_id, in php_mysqlnd_rset_header_read()
1125 packet->server_status, packet->warning_count); in php_mysqlnd_rset_header_read()
1136 DBG_ERR_FMT("RSET_HEADER packet %d bytes shorter than expected", p - begin - packet->header.size); in php_mysqlnd_rset_header_read()
1138 p - begin - packet->header.size); in php_mysqlnd_rset_header_read()
1179 MYSQLND_PACKET_RES_FIELD *packet = (MYSQLND_PACKET_RES_FIELD *) _packet; in php_mysqlnd_rset_field_read() local
1196 …if (FAIL == mysqlnd_read_packet_header_and_body(&(packet->header), pfc, vio, stats, error_info, co… in php_mysqlnd_rset_field_read()
1200 if (packet->skip_parsing) { in php_mysqlnd_rset_field_read()
1209 php_mysqlnd_read_error_from_line(p, packet->header.size - 1, in php_mysqlnd_rset_field_read()
1210 packet->error_info.error, sizeof(packet->error_info.error), in php_mysqlnd_rset_field_read()
1211 &packet->error_info.error_no, packet->error_info.sqlstate in php_mysqlnd_rset_field_read()
1213 DBG_ERR_FMT("Server error : (%u) %s", packet->error_info.error_no, packet->error_info.error); in php_mysqlnd_rset_field_read()
1215 } else if (EODATA_MARKER == *p && packet->header.size < 8) { in php_mysqlnd_rset_field_read()
1222 meta = packet->metadata; in php_mysqlnd_rset_field_read()
1237 if ((size_t)((p - begin) + 12) > packet->header.size) { in php_mysqlnd_rset_field_read()
1277 if (packet->header.size > (size_t) (p - buf) && in php_mysqlnd_rset_field_read()
1283 meta->def = packet->memory_pool->get_chunk(packet->memory_pool, len + 1); in php_mysqlnd_rset_field_read()
1290 root_ptr = meta->root = packet->memory_pool->get_chunk(packet->memory_pool, total_len); in php_mysqlnd_rset_field_read()
1349 DBG_ERR_FMT("RSET field packet %d bytes shorter than expected", p - begin - packet->header.size); in php_mysqlnd_rset_field_read()
1351 "shorter than expected", p - begin - packet->header.size); in php_mysqlnd_rset_field_read()
1725 MYSQLND_PACKET_ROW *packet = (MYSQLND_PACKET_ROW *) _packet; in php_mysqlnd_rowp_read() local
1726 MYSQLND_ERROR_INFO * error_info = &packet->error_info; in php_mysqlnd_rowp_read()
1737 packet->result_set_memory_pool, &packet->row_buffer, &data_size); in php_mysqlnd_rowp_read()
1742 MYSQLND_HEADER_SIZE + packet->header.size, in php_mysqlnd_rowp_read()
1755 packet->header.size = data_size; in php_mysqlnd_rowp_read()
1756 packet->row_buffer.size = data_size; in php_mysqlnd_rowp_read()
1758 if (ERROR_MARKER == (*(p = packet->row_buffer.ptr))) { in php_mysqlnd_rowp_read()
1766 packet->error_info.error, in php_mysqlnd_rowp_read()
1767 sizeof(packet->error_info.error), in php_mysqlnd_rowp_read()
1768 &packet->error_info.error_no, in php_mysqlnd_rowp_read()
1769 packet->error_info.sqlstate in php_mysqlnd_rowp_read()
1772 packet->eof = TRUE; in php_mysqlnd_rowp_read()
1775 packet->warning_count = uint2korr(p); in php_mysqlnd_rowp_read()
1777 packet->server_status = uint2korr(p); in php_mysqlnd_rowp_read()
1779 DBG_INF_FMT("server_status=%u warning_count=%u", packet->server_status, packet->warning_count); in php_mysqlnd_rowp_read()
1783 packet->binary_protocol? STAT_ROWS_FETCHED_FROM_SERVER_PS: in php_mysqlnd_rowp_read()
1786 packet->eof = FALSE; in php_mysqlnd_rowp_read()
1789 if (!packet->skip_extraction) { in php_mysqlnd_rowp_read()
1790 if (!packet->fields) { in php_mysqlnd_rowp_read()
1802 packet->fields = mnd_ecalloc(packet->field_count, sizeof(zval)); in php_mysqlnd_rowp_read()
1806 packet->binary_protocol? STAT_ROWS_SKIPPED_PS: in php_mysqlnd_rowp_read()
1845 MYSQLND_PACKET_STATS *packet= (MYSQLND_PACKET_STATS *) _packet; in php_mysqlnd_stats_read() local
1856 …if (FAIL == mysqlnd_read_packet_header_and_body(&(packet->header), pfc, vio, stats, error_info, co… in php_mysqlnd_stats_read()
1860 packet->message.s = mnd_emalloc(packet->header.size + 1); in php_mysqlnd_stats_read()
1861 memcpy(packet->message.s, buf, packet->header.size); in php_mysqlnd_stats_read()
1862 packet->message.s[packet->header.size] = '\0'; in php_mysqlnd_stats_read()
1863 packet->message.l = packet->header.size; in php_mysqlnd_stats_read()
1891 MYSQLND_PACKET_PREPARE_RESPONSE *packet= (MYSQLND_PACKET_PREPARE_RESPONSE *) _packet; in php_mysqlnd_prepare_read() local
1906 …if (FAIL == mysqlnd_read_packet_header_and_body(&(packet->header), pfc, vio, stats, error_info, co… in php_mysqlnd_prepare_read()
1911 data_size = packet->header.size; in php_mysqlnd_prepare_read()
1912 packet->error_code = uint1korr(p); in php_mysqlnd_prepare_read()
1916 if (ERROR_MARKER == packet->error_code) { in php_mysqlnd_prepare_read()
1918 packet->error_info.error, in php_mysqlnd_prepare_read()
1919 sizeof(packet->error_info.error), in php_mysqlnd_prepare_read()
1920 &packet->error_info.error_no, in php_mysqlnd_prepare_read()
1921 packet->error_info.sqlstate in php_mysqlnd_prepare_read()
1934 packet->stmt_id = uint4korr(p); in php_mysqlnd_prepare_read()
1939 packet->field_count = uint2korr(p); in php_mysqlnd_prepare_read()
1943 packet->param_count = uint2korr(p); in php_mysqlnd_prepare_read()
1952 packet->warning_count = uint2korr(p); in php_mysqlnd_prepare_read()
1956 packet->stmt_id, packet->field_count, packet->param_count); in php_mysqlnd_prepare_read()
1962 DBG_ERR_FMT("PREPARE packet %d bytes shorter than expected", p - begin - packet->header.size); in php_mysqlnd_prepare_read()
1964 p - begin - packet->header.size); in php_mysqlnd_prepare_read()
1974 MYSQLND_PACKET_CHG_USER_RESPONSE *packet= (MYSQLND_PACKET_CHG_USER_RESPONSE *) _packet; in php_mysqlnd_chg_user_read() local
1988 …if (FAIL == mysqlnd_read_packet_header_and_body(&(packet->header), pfc, vio, stats, error_info, co… in php_mysqlnd_chg_user_read()
1999 packet->response_code = uint1korr(p); in php_mysqlnd_chg_user_read()
2002 …if (packet->header.size == 1 && buf[0] == EODATA_MARKER && (packet->server_capabilities & CLIENT_S… in php_mysqlnd_chg_user_read()
2004 packet->server_asked_323_auth = TRUE; in php_mysqlnd_chg_user_read()
2008 if (ERROR_MARKER == packet->response_code) { in php_mysqlnd_chg_user_read()
2009 php_mysqlnd_read_error_from_line(p, packet->header.size - 1, in php_mysqlnd_chg_user_read()
2010 packet->error_info.error, in php_mysqlnd_chg_user_read()
2011 sizeof(packet->error_info.error), in php_mysqlnd_chg_user_read()
2012 &packet->error_info.error_no, in php_mysqlnd_chg_user_read()
2013 packet->error_info.sqlstate in php_mysqlnd_chg_user_read()
2017 if (packet->response_code == 0xFE && packet->header.size > (size_t) (p - buf)) { in php_mysqlnd_chg_user_read()
2018 packet->new_auth_protocol = mnd_pestrdup((char *)p, FALSE); in php_mysqlnd_chg_user_read()
2019 packet->new_auth_protocol_len = strlen(packet->new_auth_protocol); in php_mysqlnd_chg_user_read()
2020 p+= packet->new_auth_protocol_len + 1; /* +1 for the \0 */ in php_mysqlnd_chg_user_read()
2021 packet->new_auth_protocol_data_len = packet->header.size - (size_t) (p - buf); in php_mysqlnd_chg_user_read()
2022 if (packet->new_auth_protocol_data_len) { in php_mysqlnd_chg_user_read()
2023 packet->new_auth_protocol_data = mnd_emalloc(packet->new_auth_protocol_data_len); in php_mysqlnd_chg_user_read()
2024 memcpy(packet->new_auth_protocol_data, p, packet->new_auth_protocol_data_len); in php_mysqlnd_chg_user_read()
2026 DBG_INF_FMT("The server requested switching auth plugin to : %s", packet->new_auth_protocol); in php_mysqlnd_chg_user_read()
2027 …DBG_INF_FMT("Server salt : [%*s]", packet->new_auth_protocol_data_len, packet->new_auth_protocol_d… in php_mysqlnd_chg_user_read()
2032 DBG_ERR_FMT("CHANGE_USER packet %d bytes shorter than expected", p - begin - packet->header.size); in php_mysqlnd_chg_user_read()
2034 p - begin - packet->header.size); in php_mysqlnd_chg_user_read()
2088 …MYSQLND_PACKET_SHA256_PK_REQUEST_RESPONSE * packet= (MYSQLND_PACKET_SHA256_PK_REQUEST_RESPONSE *) … in php_mysqlnd_sha256_pk_request_response_read() local
2101 …if (FAIL == mysqlnd_read_packet_header_and_body(&(packet->header), pfc, vio, stats, error_info, co… in php_mysqlnd_sha256_pk_request_response_read()
2109 packet->public_key_len = packet->header.size - (p - buf); in php_mysqlnd_sha256_pk_request_response_read()
2110 packet->public_key = mnd_emalloc(packet->public_key_len + 1); in php_mysqlnd_sha256_pk_request_response_read()
2111 memcpy(packet->public_key, p, packet->public_key_len); in php_mysqlnd_sha256_pk_request_response_read()
2112 packet->public_key[packet->public_key_len] = '\0'; in php_mysqlnd_sha256_pk_request_response_read()
2117 DBG_ERR_FMT("OK packet %d bytes shorter than expected", p - begin - packet->header.size); in php_mysqlnd_sha256_pk_request_response_read()
2119 p - begin - packet->header.size); in php_mysqlnd_sha256_pk_request_response_read()
2141 MYSQLND_PACKET_CACHED_SHA2_RESULT * packet= (MYSQLND_PACKET_CACHED_SHA2_RESULT *) _packet; in php_mysqlnd_cached_sha2_result_write() local
2147 zend_uchar *buffer = do_alloca(MYSQLND_HEADER_SIZE + packet->password_len + 1, use_heap); in php_mysqlnd_cached_sha2_result_write()
2152 if (packet->request == 1) { in php_mysqlnd_cached_sha2_result_write()
2156 if (packet->password_len != 0) { in php_mysqlnd_cached_sha2_result_write()
2157 memcpy(buffer + MYSQLND_HEADER_SIZE, packet->password, packet->password_len); in php_mysqlnd_cached_sha2_result_write()
2159 sent = pfc->data->m.send(pfc, vio, buffer, packet->password_len, stats, error_info); in php_mysqlnd_cached_sha2_result_write()
2169 MYSQLND_PACKET_CACHED_SHA2_RESULT * packet= (MYSQLND_PACKET_CACHED_SHA2_RESULT *) _packet; in php_mysqlnd_cached_sha2_result_read() local
2180 …if (FAIL == mysqlnd_read_packet_header_and_body(&(packet->header), pfc, vio, stats, error_info, co… in php_mysqlnd_cached_sha2_result_read()
2185 packet->response_code = uint1korr(p); in php_mysqlnd_cached_sha2_result_read()
2189 if (ERROR_MARKER == packet->response_code) { in php_mysqlnd_cached_sha2_result_read()
2190 php_mysqlnd_read_error_from_line(p, packet->header.size - 1, in php_mysqlnd_cached_sha2_result_read()
2191 packet->error, sizeof(packet->error), in php_mysqlnd_cached_sha2_result_read()
2192 &packet->error_no, packet->sqlstate in php_mysqlnd_cached_sha2_result_read()
2196 if (0xFE == packet->response_code) { in php_mysqlnd_cached_sha2_result_read()
2198 if (packet->header.size > (size_t) (p - buf)) { in php_mysqlnd_cached_sha2_result_read()
2199 packet->new_auth_protocol = mnd_pestrdup((char *)p, FALSE); in php_mysqlnd_cached_sha2_result_read()
2200 packet->new_auth_protocol_len = strlen(packet->new_auth_protocol); in php_mysqlnd_cached_sha2_result_read()
2201 p+= packet->new_auth_protocol_len + 1; /* +1 for the \0 */ in php_mysqlnd_cached_sha2_result_read()
2203 packet->new_auth_protocol_data_len = packet->header.size - (size_t) (p - buf); in php_mysqlnd_cached_sha2_result_read()
2204 if (packet->new_auth_protocol_data_len) { in php_mysqlnd_cached_sha2_result_read()
2205 packet->new_auth_protocol_data = mnd_emalloc(packet->new_auth_protocol_data_len); in php_mysqlnd_cached_sha2_result_read()
2206 memcpy(packet->new_auth_protocol_data, p, packet->new_auth_protocol_data_len); in php_mysqlnd_cached_sha2_result_read()
2208 DBG_INF_FMT("The server requested switching auth plugin to : %s", packet->new_auth_protocol); in php_mysqlnd_cached_sha2_result_read()
2209 …_INF_FMT("Server salt : [%d][%.*s]", packet->new_auth_protocol_data_len, packet->new_auth_protocol… in php_mysqlnd_cached_sha2_result_read()
2214 if (0x1 != packet->response_code) { in php_mysqlnd_cached_sha2_result_read()
2215 DBG_ERR_FMT("Unexpected response code %d", packet->response_code); in php_mysqlnd_cached_sha2_result_read()
2219 packet->response_code = uint1korr(p); in php_mysqlnd_cached_sha2_result_read()
2223 packet->result = uint1korr(p); in php_mysqlnd_cached_sha2_result_read()
2229 DBG_ERR_FMT("OK packet %d bytes shorter than expected", p - begin - packet->header.size); in php_mysqlnd_cached_sha2_result_read()
2231 p - begin - packet->header.size); in php_mysqlnd_cached_sha2_result_read()
2325 MYSQLND_METHOD(mysqlnd_protocol, init_greet_packet)(struct st_mysqlnd_packet_greet *packet) in MYSQLND_METHOD()
2328 memset(packet, 0, sizeof(*packet)); in MYSQLND_METHOD()
2329 packet->header.m = &packet_methods[PROT_GREET_PACKET]; in MYSQLND_METHOD()
2337 MYSQLND_METHOD(mysqlnd_protocol, init_auth_packet)(struct st_mysqlnd_packet_auth *packet) in MYSQLND_METHOD()
2340 memset(packet, 0, sizeof(*packet)); in MYSQLND_METHOD()
2341 packet->header.m = &packet_methods[PROT_AUTH_PACKET]; in MYSQLND_METHOD()
2349 …METHOD(mysqlnd_protocol, init_auth_response_packet)(struct st_mysqlnd_packet_auth_response *packet) in MYSQLND_METHOD()
2352 memset(packet, 0, sizeof(*packet)); in MYSQLND_METHOD()
2353 packet->header.m = &packet_methods[PROT_AUTH_RESP_PACKET]; in MYSQLND_METHOD()
2361 …_protocol, init_change_auth_response_packet)(struct st_mysqlnd_packet_change_auth_response *packet) in MYSQLND_METHOD()
2364 memset(packet, 0, sizeof(*packet)); in MYSQLND_METHOD()
2365 packet->header.m = &packet_methods[PROT_CHANGE_AUTH_RESP_PACKET]; in MYSQLND_METHOD()
2373 MYSQLND_METHOD(mysqlnd_protocol, init_ok_packet)(struct st_mysqlnd_packet_ok *packet) in MYSQLND_METHOD()
2376 memset(packet, 0, sizeof(*packet)); in MYSQLND_METHOD()
2377 packet->header.m = &packet_methods[PROT_OK_PACKET]; in MYSQLND_METHOD()
2385 MYSQLND_METHOD(mysqlnd_protocol, init_eof_packet)(struct st_mysqlnd_packet_eof *packet) in MYSQLND_METHOD()
2388 memset(packet, 0, sizeof(*packet)); in MYSQLND_METHOD()
2389 packet->header.m = &packet_methods[PROT_EOF_PACKET]; in MYSQLND_METHOD()
2397 MYSQLND_METHOD(mysqlnd_protocol, init_command_packet)(struct st_mysqlnd_packet_command *packet) in MYSQLND_METHOD()
2400 memset(packet, 0, sizeof(*packet)); in MYSQLND_METHOD()
2401 packet->header.m = &packet_methods[PROT_CMD_PACKET]; in MYSQLND_METHOD()
2409 …LND_METHOD(mysqlnd_protocol, init_rset_header_packet)(struct st_mysqlnd_packet_rset_header *packet) in MYSQLND_METHOD()
2412 memset(packet, 0, sizeof(*packet)); in MYSQLND_METHOD()
2413 packet->header.m = &packet_methods[PROT_RSET_HEADER_PACKET]; in MYSQLND_METHOD()
2421 …QLND_METHOD(mysqlnd_protocol, init_result_field_packet)(struct st_mysqlnd_packet_res_field *packet) in MYSQLND_METHOD()
2424 memset(packet, 0, sizeof(*packet)); in MYSQLND_METHOD()
2425 packet->header.m = &packet_methods[PROT_RSET_FLD_PACKET]; in MYSQLND_METHOD()
2433 MYSQLND_METHOD(mysqlnd_protocol, init_row_packet)(struct st_mysqlnd_packet_row *packet) in MYSQLND_METHOD()
2436 memset(packet, 0, sizeof(*packet)); in MYSQLND_METHOD()
2437 packet->header.m = &packet_methods[PROT_ROW_PACKET]; in MYSQLND_METHOD()
2445 MYSQLND_METHOD(mysqlnd_protocol, init_stats_packet)(struct st_mysqlnd_packet_stats *packet) in MYSQLND_METHOD()
2448 memset(packet, 0, sizeof(*packet)); in MYSQLND_METHOD()
2449 packet->header.m = &packet_methods[PROT_STATS_PACKET]; in MYSQLND_METHOD()
2457 …(mysqlnd_protocol, init_prepare_response_packet)(struct st_mysqlnd_packet_prepare_response *packet) in MYSQLND_METHOD()
2460 memset(packet, 0, sizeof(*packet)); in MYSQLND_METHOD()
2461 packet->header.m = &packet_methods[PROT_PREPARE_RESP_PACKET]; in MYSQLND_METHOD()
2469 …mysqlnd_protocol, init_change_user_response_packet)(struct st_mysqlnd_packet_chg_user_resp *packet) in MYSQLND_METHOD()
2472 memset(packet, 0, sizeof(*packet)); in MYSQLND_METHOD()
2473 packet->header.m = &packet_methods[PROT_CHG_USER_RESP_PACKET]; in MYSQLND_METHOD()
2481 …ysqlnd_protocol, init_sha256_pk_request_packet)(struct st_mysqlnd_packet_sha256_pk_request *packet) in MYSQLND_METHOD()
2484 memset(packet, 0, sizeof(*packet)); in MYSQLND_METHOD()
2485 packet->header.m = &packet_methods[PROT_SHA256_PK_REQUEST_PACKET]; in MYSQLND_METHOD()
2493 …nit_sha256_pk_request_response_packet)(struct st_mysqlnd_packet_sha256_pk_request_response *packet) in MYSQLND_METHOD()
2496 memset(packet, 0, sizeof(*packet)); in MYSQLND_METHOD()
2497 packet->header.m = &packet_methods[PROT_SHA256_PK_REQUEST_RESPONSE_PACKET]; in MYSQLND_METHOD()
2504 …qlnd_protocol, init_cached_sha2_result_packet)(struct st_mysqlnd_packet_cached_sha2_result *packet) in MYSQLND_METHOD()
2507 memset(packet, 0, sizeof(*packet)); in MYSQLND_METHOD()
2508 packet->header.m = &packet_methods[PROT_CACHED_SHA2_RESULT_PACKET]; in MYSQLND_METHOD()