Lines Matching refs:packet
34 #define PACKET_READ_HEADER_AND_BODY(packet, conn, buf, buf_size, packet_type_as_text, packet_type) \ argument
37 …if (FAIL == mysqlnd_read_header((conn)->net, &((packet)->header), (conn)->stats, ((conn)->error_in…
44 if ((buf_size) < (packet)->header.size) { \
46 (buf_size), (packet)->header.size, (packet)->header.size - (buf_size)); \
49 …if (FAIL == conn->net->data->m.receive_ex((conn)->net, (buf), (packet)->header.size, (conn)->stats…
57 MYSQLND_HEADER_SIZE + (packet)->header.size, \
64 if ((size_t)(p - begin) > packet->header.size) { \
129 php_mysqlnd_net_field_length(zend_uchar **packet) in php_mysqlnd_net_field_length() argument
131 register zend_uchar *p= (zend_uchar *)*packet; in php_mysqlnd_net_field_length()
134 (*packet)++; in php_mysqlnd_net_field_length()
140 (*packet)++; in php_mysqlnd_net_field_length()
143 (*packet) += 3; in php_mysqlnd_net_field_length()
146 (*packet) += 4; in php_mysqlnd_net_field_length()
149 (*packet) += 9; in php_mysqlnd_net_field_length()
159 php_mysqlnd_net_field_length_ll(zend_uchar **packet) in php_mysqlnd_net_field_length_ll() argument
161 register zend_uchar *p = (zend_uchar *)*packet; in php_mysqlnd_net_field_length_ll()
164 (*packet)++; in php_mysqlnd_net_field_length_ll()
170 (*packet)++; in php_mysqlnd_net_field_length_ll()
173 (*packet) += 3; in php_mysqlnd_net_field_length_ll()
176 (*packet) += 4; in php_mysqlnd_net_field_length_ll()
179 (*packet) += 9; in php_mysqlnd_net_field_length_ll()
188 php_mysqlnd_net_store_length(zend_uchar *packet, uint64_t length) in php_mysqlnd_net_store_length() argument
191 *packet = (zend_uchar) length; in php_mysqlnd_net_store_length()
192 return packet + 1; in php_mysqlnd_net_store_length()
196 *packet++ = 252; in php_mysqlnd_net_store_length()
197 int2store(packet,(unsigned int) length); in php_mysqlnd_net_store_length()
198 return packet + 2; in php_mysqlnd_net_store_length()
202 *packet++ = 253; in php_mysqlnd_net_store_length()
203 int3store(packet,(zend_ulong) length); in php_mysqlnd_net_store_length()
204 return packet + 3; in php_mysqlnd_net_store_length()
206 *packet++ = 254; in php_mysqlnd_net_store_length()
207 int8store(packet, length); in php_mysqlnd_net_store_length()
208 return packet + 8; in php_mysqlnd_net_store_length()
326 MYSQLND_PACKET_GREET *packet= (MYSQLND_PACKET_GREET *) _packet; in php_mysqlnd_greet_read() local
330 PACKET_READ_HEADER_AND_BODY(packet, conn, buf, sizeof(buf), "greeting", PROT_GREET_PACKET); in php_mysqlnd_greet_read()
333 packet->auth_plugin_data = packet->intern_auth_plugin_data; in php_mysqlnd_greet_read()
334 packet->auth_plugin_data_len = sizeof(packet->intern_auth_plugin_data); in php_mysqlnd_greet_read()
336 if (packet->header.size < sizeof(buf)) { in php_mysqlnd_greet_read()
341 buf[packet->header.size] = '\0'; in php_mysqlnd_greet_read()
344 packet->protocol_version = uint1korr(p); in php_mysqlnd_greet_read()
348 if (ERROR_MARKER == packet->protocol_version) { in php_mysqlnd_greet_read()
349 php_mysqlnd_read_error_from_line(p, packet->header.size - 1, in php_mysqlnd_greet_read()
350 packet->error, sizeof(packet->error), in php_mysqlnd_greet_read()
351 &packet->error_no, packet->sqlstate in php_mysqlnd_greet_read()
358 if (packet->error_no == 1040) { in php_mysqlnd_greet_read()
359 memcpy(packet->sqlstate, "08004", MYSQLND_SQLSTATE_LENGTH); in php_mysqlnd_greet_read()
364 packet->server_version = estrdup((char *)p); in php_mysqlnd_greet_read()
365 p+= strlen(packet->server_version) + 1; /* eat the '\0' */ in php_mysqlnd_greet_read()
368 packet->thread_id = uint4korr(p); in php_mysqlnd_greet_read()
372 memcpy(packet->auth_plugin_data, p, SCRAMBLE_LENGTH_323); in php_mysqlnd_greet_read()
380 packet->server_capabilities = uint2korr(p); in php_mysqlnd_greet_read()
384 packet->charset_no = uint1korr(p); in php_mysqlnd_greet_read()
388 packet->server_status = uint2korr(p); in php_mysqlnd_greet_read()
397 if ((size_t) (p - buf) < packet->header.size) { in php_mysqlnd_greet_read()
399 memcpy(packet->auth_plugin_data + SCRAMBLE_LENGTH_323, p, SCRAMBLE_LENGTH - SCRAMBLE_LENGTH_323); in php_mysqlnd_greet_read()
403 packet->pre41 = TRUE; in php_mysqlnd_greet_read()
407 if ((size_t) (p - buf) < packet->header.size) { in php_mysqlnd_greet_read()
412 packet->server_capabilities |= uint2korr(pad_start) << 16; in php_mysqlnd_greet_read()
414 packet->auth_plugin_data_len = uint1korr(pad_start + 2); in php_mysqlnd_greet_read()
415 if (packet->auth_plugin_data_len > SCRAMBLE_LENGTH) { in php_mysqlnd_greet_read()
417 zend_uchar * new_auth_plugin_data = emalloc(packet->auth_plugin_data_len); in php_mysqlnd_greet_read()
422 memcpy(new_auth_plugin_data, packet->auth_plugin_data, SCRAMBLE_LENGTH); in php_mysqlnd_greet_read()
424 … memcpy(new_auth_plugin_data + SCRAMBLE_LENGTH, p, packet->auth_plugin_data_len - SCRAMBLE_LENGTH); in php_mysqlnd_greet_read()
425 p+= (packet->auth_plugin_data_len - SCRAMBLE_LENGTH); in php_mysqlnd_greet_read()
426 packet->auth_plugin_data = new_auth_plugin_data; in php_mysqlnd_greet_read()
430 if (packet->server_capabilities & CLIENT_PLUGIN_AUTH) { in php_mysqlnd_greet_read()
433 packet->auth_protocol = estrdup((char *)p); in php_mysqlnd_greet_read()
434 p+= strlen(packet->auth_protocol) + 1; /* eat the '\0' */ in php_mysqlnd_greet_read()
438 packet->protocol_version, packet->server_version, packet->thread_id); in php_mysqlnd_greet_read()
441 packet->server_capabilities, packet->charset_no, packet->server_status, in php_mysqlnd_greet_read()
442 packet->auth_protocol? packet->auth_protocol:"n/a", packet->auth_plugin_data_len); in php_mysqlnd_greet_read()
446 DBG_ERR_FMT("GREET packet %d bytes shorter than expected", p - begin - packet->header.size); in php_mysqlnd_greet_read()
448 p - begin - packet->header.size); in php_mysqlnd_greet_read()
487 MYSQLND_PACKET_AUTH * packet= (MYSQLND_PACKET_AUTH *) _packet; in php_mysqlnd_auth_write() local
491 if (!packet->is_change_user_packet) { in php_mysqlnd_auth_write()
492 int4store(p, packet->client_flags); in php_mysqlnd_auth_write()
495 int4store(p, packet->max_packet_size); in php_mysqlnd_auth_write()
498 int1store(p, packet->charset_no); in php_mysqlnd_auth_write()
505 if (packet->send_auth_data || packet->is_change_user_packet) { in php_mysqlnd_auth_write()
506 len = MIN(strlen(packet->user), MYSQLND_MAX_ALLOWED_USER_LEN); in php_mysqlnd_auth_write()
507 memcpy(p, packet->user, len); in php_mysqlnd_auth_write()
512 if (packet->auth_data == NULL) { in php_mysqlnd_auth_write()
513 packet->auth_data_len = 0; in php_mysqlnd_auth_write()
515 if (packet->auth_data_len > 0xFF) { in php_mysqlnd_auth_write()
523 int1store(p, packet->auth_data_len); in php_mysqlnd_auth_write()
526 if (sizeof(buffer) < (packet->auth_data_len + (p - buffer))) { in php_mysqlnd_auth_write()
530 if (packet->auth_data_len) { in php_mysqlnd_auth_write()
531 memcpy(p, packet->auth_data, packet->auth_data_len); in php_mysqlnd_auth_write()
532 p+= packet->auth_data_len; in php_mysqlnd_auth_write()
535 if (packet->db) { in php_mysqlnd_auth_write()
537 size_t real_db_len = MIN(MYSQLND_MAX_ALLOWED_DB_LEN, packet->db_len); in php_mysqlnd_auth_write()
538 memcpy(p, packet->db, real_db_len); in php_mysqlnd_auth_write()
541 } else if (packet->is_change_user_packet) { in php_mysqlnd_auth_write()
546 if (packet->is_change_user_packet) { in php_mysqlnd_auth_write()
547 if (packet->charset_no) { in php_mysqlnd_auth_write()
548 int2store(p, packet->charset_no); in php_mysqlnd_auth_write()
553 if (packet->auth_plugin_name) { in php_mysqlnd_auth_write()
554 size_t len = MIN(strlen(packet->auth_plugin_name), sizeof(buffer) - (p - buffer) - 1); in php_mysqlnd_auth_write()
555 memcpy(p, packet->auth_plugin_name, len); in php_mysqlnd_auth_write()
560 if (packet->connect_attr && zend_hash_num_elements(packet->connect_attr)) { in php_mysqlnd_auth_write()
565 zend_hash_internal_pointer_reset_ex(packet->connect_attr, &pos_value); in php_mysqlnd_auth_write()
566 …while (SUCCESS == zend_hash_get_current_data_ex(packet->connect_attr, (void **)&entry_value, &pos_… in php_mysqlnd_auth_write()
572 …if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(packet->connect_attr, &s_key, &s_len, &num_… in php_mysqlnd_auth_write()
585 ZEND_HASH_FOREACH_STR_KEY_VAL(packet->connect_attr, key, entry_value) { in php_mysqlnd_auth_write()
601 zend_hash_internal_pointer_reset_ex(packet->connect_attr, &pos_value); in php_mysqlnd_auth_write()
602 …while (SUCCESS == zend_hash_get_current_data_ex(packet->connect_attr, (void **)&entry_value, &pos_… in php_mysqlnd_auth_write()
607 …if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(packet->connect_attr, &s_key, &s_len, &num_… in php_mysqlnd_auth_write()
623 ZEND_HASH_FOREACH_STR_KEY_VAL(packet->connect_attr, key, entry_value) { in php_mysqlnd_auth_write()
644 if (packet->is_change_user_packet) { in php_mysqlnd_auth_write()
647 packet->silent, TRUE)) { in php_mysqlnd_auth_write()
686 register MYSQLND_PACKET_AUTH_RESPONSE * packet= (MYSQLND_PACKET_AUTH_RESPONSE *) _packet; in php_mysqlnd_auth_response_read() local
692 PACKET_READ_HEADER_AND_BODY(packet, conn, buf, buf_len, "OK", PROT_OK_PACKET); in php_mysqlnd_auth_response_read()
699 buf[packet->header.size] = '\0'; in php_mysqlnd_auth_response_read()
702 packet->response_code = uint1korr(p); in php_mysqlnd_auth_response_read()
706 if (ERROR_MARKER == packet->response_code) { in php_mysqlnd_auth_response_read()
707 php_mysqlnd_read_error_from_line(p, packet->header.size - 1, in php_mysqlnd_auth_response_read()
708 packet->error, sizeof(packet->error), in php_mysqlnd_auth_response_read()
709 &packet->error_no, packet->sqlstate in php_mysqlnd_auth_response_read()
713 if (0xFE == packet->response_code) { in php_mysqlnd_auth_response_read()
715 if (packet->header.size > (size_t) (p - buf)) { in php_mysqlnd_auth_response_read()
716 packet->new_auth_protocol = mnd_pestrdup((char *)p, FALSE); in php_mysqlnd_auth_response_read()
717 packet->new_auth_protocol_len = strlen(packet->new_auth_protocol); in php_mysqlnd_auth_response_read()
718 p+= packet->new_auth_protocol_len + 1; /* +1 for the \0 */ in php_mysqlnd_auth_response_read()
720 packet->new_auth_protocol_data_len = packet->header.size - (size_t) (p - buf); in php_mysqlnd_auth_response_read()
721 if (packet->new_auth_protocol_data_len) { in php_mysqlnd_auth_response_read()
722 packet->new_auth_protocol_data = mnd_emalloc(packet->new_auth_protocol_data_len); in php_mysqlnd_auth_response_read()
723 memcpy(packet->new_auth_protocol_data, p, packet->new_auth_protocol_data_len); in php_mysqlnd_auth_response_read()
725 DBG_INF_FMT("The server requested switching auth plugin to : %s", packet->new_auth_protocol); in php_mysqlnd_auth_response_read()
726 …_INF_FMT("Server salt : [%d][%.*s]", packet->new_auth_protocol_data_len, packet->new_auth_protocol… in php_mysqlnd_auth_response_read()
730 packet->affected_rows = php_mysqlnd_net_field_length_ll(&p); in php_mysqlnd_auth_response_read()
733 packet->last_insert_id = php_mysqlnd_net_field_length_ll(&p); in php_mysqlnd_auth_response_read()
736 packet->server_status = uint2korr(p); in php_mysqlnd_auth_response_read()
740 packet->warning_count = uint2korr(p); in php_mysqlnd_auth_response_read()
745 if (packet->header.size > (size_t) (p - buf) && (i = php_mysqlnd_net_field_length(&p))) { in php_mysqlnd_auth_response_read()
746 packet->message_len = MIN(i, buf_len - (p - begin)); in php_mysqlnd_auth_response_read()
747 packet->message = mnd_pestrndup((char *)p, packet->message_len, FALSE); in php_mysqlnd_auth_response_read()
749 packet->message = NULL; in php_mysqlnd_auth_response_read()
750 packet->message_len = 0; in php_mysqlnd_auth_response_read()
754 packet->affected_rows, packet->last_insert_id, packet->server_status, in php_mysqlnd_auth_response_read()
755 packet->warning_count); in php_mysqlnd_auth_response_read()
760 DBG_ERR_FMT("OK packet %d bytes shorter than expected", p - begin - packet->header.size); in php_mysqlnd_auth_response_read()
762 p - begin - packet->header.size); in php_mysqlnd_auth_response_read()
800 MYSQLND_PACKET_CHANGE_AUTH_RESPONSE *packet= (MYSQLND_PACKET_CHANGE_AUTH_RESPONSE *) _packet; in php_mysqlnd_change_auth_response_write() local
801 …uffer = conn->net->cmd_buffer.length >= packet->auth_data_len? conn->net->cmd_buffer.buffer : mnd_… in php_mysqlnd_change_auth_response_write()
806 if (packet->auth_data_len) { in php_mysqlnd_change_auth_response_write()
807 memcpy(p, packet->auth_data, packet->auth_data_len); in php_mysqlnd_change_auth_response_write()
808 p+= packet->auth_data_len; in php_mysqlnd_change_auth_response_write()
849 register MYSQLND_PACKET_OK *packet= (MYSQLND_PACKET_OK *) _packet; in php_mysqlnd_ok_read() local
853 PACKET_READ_HEADER_AND_BODY(packet, conn, buf, buf_len, "OK", PROT_OK_PACKET); in php_mysqlnd_ok_read()
857 packet->field_count = uint1korr(p); in php_mysqlnd_ok_read()
861 if (ERROR_MARKER == packet->field_count) { in php_mysqlnd_ok_read()
862 php_mysqlnd_read_error_from_line(p, packet->header.size - 1, in php_mysqlnd_ok_read()
863 packet->error, sizeof(packet->error), in php_mysqlnd_ok_read()
864 &packet->error_no, packet->sqlstate in php_mysqlnd_ok_read()
870 packet->affected_rows = php_mysqlnd_net_field_length_ll(&p); in php_mysqlnd_ok_read()
873 packet->last_insert_id = php_mysqlnd_net_field_length_ll(&p); in php_mysqlnd_ok_read()
876 packet->server_status = uint2korr(p); in php_mysqlnd_ok_read()
880 packet->warning_count = uint2korr(p); in php_mysqlnd_ok_read()
885 if (packet->header.size > (size_t) (p - buf) && (i = php_mysqlnd_net_field_length(&p))) { in php_mysqlnd_ok_read()
886 packet->message_len = MIN(i, buf_len - (p - begin)); in php_mysqlnd_ok_read()
887 packet->message = mnd_pestrndup((char *)p, packet->message_len, FALSE); in php_mysqlnd_ok_read()
889 packet->message = NULL; in php_mysqlnd_ok_read()
890 packet->message_len = 0; in php_mysqlnd_ok_read()
894 packet->affected_rows, packet->last_insert_id, packet->server_status, in php_mysqlnd_ok_read()
895 packet->warning_count); in php_mysqlnd_ok_read()
901 DBG_ERR_FMT("OK packet %d bytes shorter than expected", p - begin - packet->header.size); in php_mysqlnd_ok_read()
903 p - begin - packet->header.size); in php_mysqlnd_ok_read()
935 MYSQLND_PACKET_EOF *packet= (MYSQLND_PACKET_EOF *) _packet; in php_mysqlnd_eof_read() local
943 PACKET_READ_HEADER_AND_BODY(packet, conn, buf, buf_len, "EOF", PROT_EOF_PACKET); in php_mysqlnd_eof_read()
947 packet->field_count = uint1korr(p); in php_mysqlnd_eof_read()
951 if (ERROR_MARKER == packet->field_count) { in php_mysqlnd_eof_read()
952 php_mysqlnd_read_error_from_line(p, packet->header.size - 1, in php_mysqlnd_eof_read()
953 packet->error, sizeof(packet->error), in php_mysqlnd_eof_read()
954 &packet->error_no, packet->sqlstate in php_mysqlnd_eof_read()
964 if (packet->header.size > 1) { in php_mysqlnd_eof_read()
965 packet->warning_count = uint2korr(p); in php_mysqlnd_eof_read()
969 packet->server_status = uint2korr(p); in php_mysqlnd_eof_read()
973 packet->warning_count = 0; in php_mysqlnd_eof_read()
974 packet->server_status = 0; in php_mysqlnd_eof_read()
980 packet->field_count, packet->server_status, packet->warning_count); in php_mysqlnd_eof_read()
984 DBG_ERR_FMT("EOF packet %d bytes shorter than expected", p - begin - packet->header.size); in php_mysqlnd_eof_read()
986 p - begin - packet->header.size); in php_mysqlnd_eof_read()
1007 MYSQLND_PACKET_COMMAND * packet= (MYSQLND_PACKET_COMMAND *) _packet; in php_mysqlnd_cmd_write() local
1027 net->data->m.consume_uneaten_data(net, packet->command); in php_mysqlnd_cmd_write()
1030 if (!packet->argument || !packet->arg_len) { in php_mysqlnd_cmd_write()
1033 int1store(buffer + MYSQLND_HEADER_SIZE, packet->command); in php_mysqlnd_cmd_write()
1036 size_t tmp_len = packet->arg_len + 1 + MYSQLND_HEADER_SIZE; in php_mysqlnd_cmd_write()
1044 int1store(p, packet->command); in php_mysqlnd_cmd_write()
1047 memcpy(p, packet->argument, packet->arg_len); in php_mysqlnd_cmd_write()
1090 MYSQLND_PACKET_RSET_HEADER *packet= (MYSQLND_PACKET_RSET_HEADER *) _packet; in php_mysqlnd_rset_header_read() local
1094 …PACKET_READ_HEADER_AND_BODY(packet, conn, buf, buf_len, "resultset header", PROT_RSET_HEADER_PACKE… in php_mysqlnd_rset_header_read()
1105 php_mysqlnd_read_error_from_line(p, packet->header.size - 1, in php_mysqlnd_rset_header_read()
1106 packet->error_info.error, sizeof(packet->error_info.error), in php_mysqlnd_rset_header_read()
1107 &packet->error_info.error_no, packet->error_info.sqlstate in php_mysqlnd_rset_header_read()
1113 packet->field_count = php_mysqlnd_net_field_length(&p); in php_mysqlnd_rset_header_read()
1116 switch (packet->field_count) { in php_mysqlnd_rset_header_read()
1126 len = packet->header.size - 1; in php_mysqlnd_rset_header_read()
1127 packet->info_or_local_file = mnd_emalloc(len + 1); in php_mysqlnd_rset_header_read()
1128 if (packet->info_or_local_file) { in php_mysqlnd_rset_header_read()
1129 memcpy(packet->info_or_local_file, p, len); in php_mysqlnd_rset_header_read()
1130 packet->info_or_local_file[len] = '\0'; in php_mysqlnd_rset_header_read()
1131 packet->info_or_local_file_len = len; in php_mysqlnd_rset_header_read()
1139 packet->affected_rows = php_mysqlnd_net_field_length_ll(&p); in php_mysqlnd_rset_header_read()
1142 packet->last_insert_id = php_mysqlnd_net_field_length_ll(&p); in php_mysqlnd_rset_header_read()
1145 packet->server_status = uint2korr(p); in php_mysqlnd_rset_header_read()
1149 packet->warning_count = uint2korr(p); in php_mysqlnd_rset_header_read()
1153 if (packet->header.size > (size_t) (p - buf) && (len = php_mysqlnd_net_field_length(&p))) { in php_mysqlnd_rset_header_read()
1154 packet->info_or_local_file = mnd_emalloc(len + 1); in php_mysqlnd_rset_header_read()
1155 if (packet->info_or_local_file) { in php_mysqlnd_rset_header_read()
1156 memcpy(packet->info_or_local_file, p, len); in php_mysqlnd_rset_header_read()
1157 packet->info_or_local_file[len] = '\0'; in php_mysqlnd_rset_header_read()
1158 packet->info_or_local_file_len = len; in php_mysqlnd_rset_header_read()
1165 packet->affected_rows, packet->last_insert_id, in php_mysqlnd_rset_header_read()
1166 packet->server_status, packet->warning_count); in php_mysqlnd_rset_header_read()
1177 DBG_ERR_FMT("RSET_HEADER packet %d bytes shorter than expected", p - begin - packet->header.size); in php_mysqlnd_rset_header_read()
1179 p - begin - packet->header.size); in php_mysqlnd_rset_header_read()
1224 MYSQLND_PACKET_RES_FIELD *packet = (MYSQLND_PACKET_RES_FIELD *) _packet; in php_mysqlnd_rset_field_read() local
1236 PACKET_READ_HEADER_AND_BODY(packet, conn, buf, buf_len, "field", PROT_RSET_FLD_PACKET); in php_mysqlnd_rset_field_read()
1238 if (packet->skip_parsing) { in php_mysqlnd_rset_field_read()
1247 php_mysqlnd_read_error_from_line(p, packet->header.size - 1, in php_mysqlnd_rset_field_read()
1248 packet->error_info.error, sizeof(packet->error_info.error), in php_mysqlnd_rset_field_read()
1249 &packet->error_info.error_no, packet->error_info.sqlstate in php_mysqlnd_rset_field_read()
1251 DBG_ERR_FMT("Server error : (%u) %s", packet->error_info.error_no, packet->error_info.error); in php_mysqlnd_rset_field_read()
1253 } else if (EODATA_MARKER == *p && packet->header.size < 8) { in php_mysqlnd_rset_field_read()
1256 packet->stupid_list_fields_eof = TRUE; in php_mysqlnd_rset_field_read()
1260 meta = packet->metadata; in php_mysqlnd_rset_field_read()
1330 if (packet->header.size > (size_t) (p - buf) && in php_mysqlnd_rset_field_read()
1335 DBG_INF_FMT("Def found, length %lu, persistent=%u", len, packet->persistent_alloc); in php_mysqlnd_rset_field_read()
1336 meta->def = mnd_pemalloc(len + 1, packet->persistent_alloc); in php_mysqlnd_rset_field_read()
1347 root_ptr = meta->root = mnd_pemalloc(total_len, packet->persistent_alloc); in php_mysqlnd_rset_field_read()
1356 meta->sname = zend_string_init(meta->name, meta->name_length, packet->persistent_alloc); in php_mysqlnd_rset_field_read()
1399 DBG_INF_FMT("allocing root. persistent=%u", packet->persistent_alloc); in php_mysqlnd_rset_field_read()
1412 DBG_ERR_FMT("RSET field packet %d bytes shorter than expected", p - begin - packet->header.size); in php_mysqlnd_rset_field_read()
1414 "shorter than expected", p - begin - packet->header.size); in php_mysqlnd_rset_field_read()
1819 MYSQLND_PACKET_ROW *packet= (MYSQLND_PACKET_ROW *) _packet; in php_mysqlnd_rowp_read() local
1825 if (!packet->binary_protocol && packet->bit_fields_count) { in php_mysqlnd_rowp_read()
1827 post_alloc_for_bit_fields = packet->bit_fields_total_len + packet->bit_fields_count; in php_mysqlnd_rowp_read()
1830 …ret = php_mysqlnd_read_row_ex(conn, packet->result_set_memory_pool, &packet->row_buffer, &data_siz… in php_mysqlnd_rowp_read()
1831 packet->persistent_alloc, post_alloc_for_bit_fields in php_mysqlnd_rowp_read()
1837 MYSQLND_HEADER_SIZE + packet->header.size, in php_mysqlnd_rowp_read()
1850 packet->header.size = data_size; in php_mysqlnd_rowp_read()
1851 packet->row_buffer->app = data_size; in php_mysqlnd_rowp_read()
1853 if (ERROR_MARKER == (*(p = packet->row_buffer->ptr))) { in php_mysqlnd_rowp_read()
1861 packet->error_info.error, in php_mysqlnd_rowp_read()
1862 sizeof(packet->error_info.error), in php_mysqlnd_rowp_read()
1863 &packet->error_info.error_no, in php_mysqlnd_rowp_read()
1864 packet->error_info.sqlstate in php_mysqlnd_rowp_read()
1867 packet->eof = TRUE; in php_mysqlnd_rowp_read()
1870 packet->warning_count = uint2korr(p); in php_mysqlnd_rowp_read()
1872 packet->server_status = uint2korr(p); in php_mysqlnd_rowp_read()
1874 DBG_INF_FMT("server_status=%u warning_count=%u", packet->server_status, packet->warning_count); in php_mysqlnd_rowp_read()
1878 packet->binary_protocol? STAT_ROWS_FETCHED_FROM_SERVER_PS: in php_mysqlnd_rowp_read()
1881 packet->eof = FALSE; in php_mysqlnd_rowp_read()
1884 if (!packet->skip_extraction) { in php_mysqlnd_rowp_read()
1885 if (!packet->fields) { in php_mysqlnd_rowp_read()
1897 packet->fields = mnd_pecalloc(packet->field_count, sizeof(zval), in php_mysqlnd_rowp_read()
1898 packet->persistent_alloc); in php_mysqlnd_rowp_read()
1902 packet->binary_protocol? STAT_ROWS_SKIPPED_PS: in php_mysqlnd_rowp_read()
1945 MYSQLND_PACKET_STATS *packet= (MYSQLND_PACKET_STATS *) _packet; in php_mysqlnd_stats_read() local
1951 PACKET_READ_HEADER_AND_BODY(packet, conn, buf, buf_len, "statistics", PROT_STATS_PACKET); in php_mysqlnd_stats_read()
1953 packet->message = mnd_emalloc(packet->header.size + 1); in php_mysqlnd_stats_read()
1954 memcpy(packet->message, buf, packet->header.size); in php_mysqlnd_stats_read()
1955 packet->message[packet->header.size] = '\0'; in php_mysqlnd_stats_read()
1956 packet->message_len = packet->header.size; in php_mysqlnd_stats_read()
1993 MYSQLND_PACKET_PREPARE_RESPONSE *packet= (MYSQLND_PACKET_PREPARE_RESPONSE *) _packet; in php_mysqlnd_prepare_read() local
1997 PACKET_READ_HEADER_AND_BODY(packet, conn, buf, buf_len, "prepare", PROT_PREPARE_RESP_PACKET); in php_mysqlnd_prepare_read()
2000 data_size = packet->header.size; in php_mysqlnd_prepare_read()
2001 packet->error_code = uint1korr(p); in php_mysqlnd_prepare_read()
2005 if (ERROR_MARKER == packet->error_code) { in php_mysqlnd_prepare_read()
2007 packet->error_info.error, in php_mysqlnd_prepare_read()
2008 sizeof(packet->error_info.error), in php_mysqlnd_prepare_read()
2009 &packet->error_info.error_no, in php_mysqlnd_prepare_read()
2010 packet->error_info.sqlstate in php_mysqlnd_prepare_read()
2023 packet->stmt_id = uint4korr(p); in php_mysqlnd_prepare_read()
2028 packet->field_count = uint2korr(p); in php_mysqlnd_prepare_read()
2032 packet->param_count = uint2korr(p); in php_mysqlnd_prepare_read()
2041 packet->warning_count = uint2korr(p); in php_mysqlnd_prepare_read()
2045 packet->stmt_id, packet->field_count, packet->param_count); in php_mysqlnd_prepare_read()
2051 DBG_ERR_FMT("PREPARE packet %d bytes shorter than expected", p - begin - packet->header.size); in php_mysqlnd_prepare_read()
2053 p - begin - packet->header.size); in php_mysqlnd_prepare_read()
2080 MYSQLND_PACKET_CHG_USER_RESPONSE *packet= (MYSQLND_PACKET_CHG_USER_RESPONSE *) _packet; in php_mysqlnd_chg_user_read() local
2084 …PACKET_READ_HEADER_AND_BODY(packet, conn, buf, buf_len, "change user response", PROT_CHG_USER_RESP… in php_mysqlnd_chg_user_read()
2093 packet->response_code = uint1korr(p); in php_mysqlnd_chg_user_read()
2096 …if (packet->header.size == 1 && buf[0] == EODATA_MARKER && packet->server_capabilities & CLIENT_SE… in php_mysqlnd_chg_user_read()
2098 packet->server_asked_323_auth = TRUE; in php_mysqlnd_chg_user_read()
2102 if (ERROR_MARKER == packet->response_code) { in php_mysqlnd_chg_user_read()
2103 php_mysqlnd_read_error_from_line(p, packet->header.size - 1, in php_mysqlnd_chg_user_read()
2104 packet->error_info.error, in php_mysqlnd_chg_user_read()
2105 sizeof(packet->error_info.error), in php_mysqlnd_chg_user_read()
2106 &packet->error_info.error_no, in php_mysqlnd_chg_user_read()
2107 packet->error_info.sqlstate in php_mysqlnd_chg_user_read()
2111 if (packet->response_code == 0xFE && packet->header.size > (size_t) (p - buf)) { in php_mysqlnd_chg_user_read()
2112 packet->new_auth_protocol = mnd_pestrdup((char *)p, FALSE); in php_mysqlnd_chg_user_read()
2113 packet->new_auth_protocol_len = strlen(packet->new_auth_protocol); in php_mysqlnd_chg_user_read()
2114 p+= packet->new_auth_protocol_len + 1; /* +1 for the \0 */ in php_mysqlnd_chg_user_read()
2115 packet->new_auth_protocol_data_len = packet->header.size - (size_t) (p - buf); in php_mysqlnd_chg_user_read()
2116 if (packet->new_auth_protocol_data_len) { in php_mysqlnd_chg_user_read()
2117 packet->new_auth_protocol_data = mnd_emalloc(packet->new_auth_protocol_data_len); in php_mysqlnd_chg_user_read()
2118 memcpy(packet->new_auth_protocol_data, p, packet->new_auth_protocol_data_len); in php_mysqlnd_chg_user_read()
2120 DBG_INF_FMT("The server requested switching auth plugin to : %s", packet->new_auth_protocol); in php_mysqlnd_chg_user_read()
2121 …DBG_INF_FMT("Server salt : [%*s]", packet->new_auth_protocol_data_len, packet->new_auth_protocol_d… in php_mysqlnd_chg_user_read()
2126 DBG_ERR_FMT("CHANGE_USER packet %d bytes shorter than expected", p - begin - packet->header.size); in php_mysqlnd_chg_user_read()
2128 p - begin - packet->header.size); in php_mysqlnd_chg_user_read()
2197 …MYSQLND_PACKET_SHA256_PK_REQUEST_RESPONSE * packet= (MYSQLND_PACKET_SHA256_PK_REQUEST_RESPONSE *) … in php_mysqlnd_sha256_pk_request_response_read() local
2202 …PACKET_READ_HEADER_AND_BODY(packet, conn, buf, sizeof(buf), "SHA256_PK_REQUEST_RESPONSE", PROT_SHA… in php_mysqlnd_sha256_pk_request_response_read()
2208 packet->public_key_len = packet->header.size - (p - buf); in php_mysqlnd_sha256_pk_request_response_read()
2209 packet->public_key = mnd_emalloc(packet->public_key_len + 1); in php_mysqlnd_sha256_pk_request_response_read()
2210 memcpy(packet->public_key, p, packet->public_key_len); in php_mysqlnd_sha256_pk_request_response_read()
2211 packet->public_key[packet->public_key_len] = '\0'; in php_mysqlnd_sha256_pk_request_response_read()
2216 DBG_ERR_FMT("OK packet %d bytes shorter than expected", p - begin - packet->header.size); in php_mysqlnd_sha256_pk_request_response_read()
2218 p - begin - packet->header.size); in php_mysqlnd_sha256_pk_request_response_read()
2344 …struct st_mysqlnd_packet_greet * packet = mnd_pecalloc(1, packet_methods[PROT_GREET_PACKET].struct… in MYSQLND_METHOD() local
2346 if (packet) { in MYSQLND_METHOD()
2347 packet->header.m = &packet_methods[PROT_GREET_PACKET]; in MYSQLND_METHOD()
2348 packet->header.persistent = persistent; in MYSQLND_METHOD()
2350 DBG_RETURN(packet); in MYSQLND_METHOD()
2359 …struct st_mysqlnd_packet_auth * packet = mnd_pecalloc(1, packet_methods[PROT_AUTH_PACKET].struct_s… in MYSQLND_METHOD() local
2361 if (packet) { in MYSQLND_METHOD()
2362 packet->header.m = &packet_methods[PROT_AUTH_PACKET]; in MYSQLND_METHOD()
2363 packet->header.persistent = persistent; in MYSQLND_METHOD()
2365 DBG_RETURN(packet); in MYSQLND_METHOD()
2374 …struct st_mysqlnd_packet_auth_response * packet = mnd_pecalloc(1, packet_methods[PROT_AUTH_RESP_PA… in MYSQLND_METHOD() local
2376 if (packet) { in MYSQLND_METHOD()
2377 packet->header.m = &packet_methods[PROT_AUTH_RESP_PACKET]; in MYSQLND_METHOD()
2378 packet->header.persistent = persistent; in MYSQLND_METHOD()
2380 DBG_RETURN(packet); in MYSQLND_METHOD()
2389 …struct st_mysqlnd_packet_change_auth_response * packet = mnd_pecalloc(1, packet_methods[PROT_CHANG… in MYSQLND_METHOD() local
2391 if (packet) { in MYSQLND_METHOD()
2392 packet->header.m = &packet_methods[PROT_CHANGE_AUTH_RESP_PACKET]; in MYSQLND_METHOD()
2393 packet->header.persistent = persistent; in MYSQLND_METHOD()
2395 DBG_RETURN(packet); in MYSQLND_METHOD()
2404 …struct st_mysqlnd_packet_ok * packet = mnd_pecalloc(1, packet_methods[PROT_OK_PACKET].struct_size,… in MYSQLND_METHOD() local
2406 if (packet) { in MYSQLND_METHOD()
2407 packet->header.m = &packet_methods[PROT_OK_PACKET]; in MYSQLND_METHOD()
2408 packet->header.persistent = persistent; in MYSQLND_METHOD()
2410 DBG_RETURN(packet); in MYSQLND_METHOD()
2419 …struct st_mysqlnd_packet_eof * packet = mnd_pecalloc(1, packet_methods[PROT_EOF_PACKET].struct_siz… in MYSQLND_METHOD() local
2421 if (packet) { in MYSQLND_METHOD()
2422 packet->header.m = &packet_methods[PROT_EOF_PACKET]; in MYSQLND_METHOD()
2423 packet->header.persistent = persistent; in MYSQLND_METHOD()
2425 DBG_RETURN(packet); in MYSQLND_METHOD()
2434 …struct st_mysqlnd_packet_command * packet = mnd_pecalloc(1, packet_methods[PROT_CMD_PACKET].struct… in MYSQLND_METHOD() local
2436 if (packet) { in MYSQLND_METHOD()
2437 packet->header.m = &packet_methods[PROT_CMD_PACKET]; in MYSQLND_METHOD()
2438 packet->header.persistent = persistent; in MYSQLND_METHOD()
2440 DBG_RETURN(packet); in MYSQLND_METHOD()
2449 …struct st_mysqlnd_packet_rset_header * packet = mnd_pecalloc(1, packet_methods[PROT_RSET_HEADER_PA… in MYSQLND_METHOD() local
2451 if (packet) { in MYSQLND_METHOD()
2452 packet->header.m = &packet_methods[PROT_RSET_HEADER_PACKET]; in MYSQLND_METHOD()
2453 packet->header.persistent = persistent; in MYSQLND_METHOD()
2455 DBG_RETURN(packet); in MYSQLND_METHOD()
2464 …struct st_mysqlnd_packet_res_field * packet = mnd_pecalloc(1, packet_methods[PROT_RSET_FLD_PACKET]… in MYSQLND_METHOD() local
2466 if (packet) { in MYSQLND_METHOD()
2467 packet->header.m = &packet_methods[PROT_RSET_FLD_PACKET]; in MYSQLND_METHOD()
2468 packet->header.persistent = persistent; in MYSQLND_METHOD()
2470 DBG_RETURN(packet); in MYSQLND_METHOD()
2479 …struct st_mysqlnd_packet_row * packet = mnd_pecalloc(1, packet_methods[PROT_ROW_PACKET].struct_siz… in MYSQLND_METHOD() local
2481 if (packet) { in MYSQLND_METHOD()
2482 packet->header.m = &packet_methods[PROT_ROW_PACKET]; in MYSQLND_METHOD()
2483 packet->header.persistent = persistent; in MYSQLND_METHOD()
2485 DBG_RETURN(packet); in MYSQLND_METHOD()
2494 …struct st_mysqlnd_packet_stats * packet = mnd_pecalloc(1, packet_methods[PROT_STATS_PACKET].struct… in MYSQLND_METHOD() local
2496 if (packet) { in MYSQLND_METHOD()
2497 packet->header.m = &packet_methods[PROT_STATS_PACKET]; in MYSQLND_METHOD()
2498 packet->header.persistent = persistent; in MYSQLND_METHOD()
2500 DBG_RETURN(packet); in MYSQLND_METHOD()
2509 …struct st_mysqlnd_packet_prepare_response * packet = mnd_pecalloc(1, packet_methods[PROT_PREPARE_R… in MYSQLND_METHOD() local
2511 if (packet) { in MYSQLND_METHOD()
2512 packet->header.m = &packet_methods[PROT_PREPARE_RESP_PACKET]; in MYSQLND_METHOD()
2513 packet->header.persistent = persistent; in MYSQLND_METHOD()
2515 DBG_RETURN(packet); in MYSQLND_METHOD()
2524 …struct st_mysqlnd_packet_chg_user_resp * packet = mnd_pecalloc(1, packet_methods[PROT_CHG_USER_RES… in MYSQLND_METHOD() local
2526 if (packet) { in MYSQLND_METHOD()
2527 packet->header.m = &packet_methods[PROT_CHG_USER_RESP_PACKET]; in MYSQLND_METHOD()
2528 packet->header.persistent = persistent; in MYSQLND_METHOD()
2530 DBG_RETURN(packet); in MYSQLND_METHOD()
2539 …struct st_mysqlnd_packet_sha256_pk_request * packet = mnd_pecalloc(1, packet_methods[PROT_SHA256_P… in MYSQLND_METHOD() local
2541 if (packet) { in MYSQLND_METHOD()
2542 packet->header.m = &packet_methods[PROT_SHA256_PK_REQUEST_PACKET]; in MYSQLND_METHOD()
2543 packet->header.persistent = persistent; in MYSQLND_METHOD()
2545 DBG_RETURN(packet); in MYSQLND_METHOD()
2554 …struct st_mysqlnd_packet_sha256_pk_request_response * packet = mnd_pecalloc(1, packet_methods[PROT… in MYSQLND_METHOD() local
2556 if (packet) { in MYSQLND_METHOD()
2557 packet->header.m = &packet_methods[PROT_SHA256_PK_REQUEST_RESPONSE_PACKET]; in MYSQLND_METHOD()
2558 packet->header.persistent = persistent; in MYSQLND_METHOD()
2560 DBG_RETURN(packet); in MYSQLND_METHOD()