Lines Matching refs:conn
37 MYSQLND_CONN_DATA * const conn, in mysqlnd_run_authentication() argument
77 …struct st_mysqlnd_authentication_plugin * auth_plugin = conn->m->fetch_auth_plugin_by_name(request… in mysqlnd_run_authentication()
86 SET_CLIENT_ERROR(conn->error_info, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, msg); in mysqlnd_run_authentication()
102 mysqlnd_set_persistent_string(&conn->authentication_plugin_data, NULL, 0, conn->persistent); in mysqlnd_run_authentication()
103 conn->authentication_plugin_data.l = plugin_data_len; in mysqlnd_run_authentication()
104 …conn->authentication_plugin_data.s = mnd_pemalloc(conn->authentication_plugin_data.l, conn->persis… in mysqlnd_run_authentication()
105 memcpy(conn->authentication_plugin_data.s, plugin_data, plugin_data_len); in mysqlnd_run_authentication()
111 NULL, &scrambled_data_len, conn, user, passwd, in mysqlnd_run_authentication()
113 session_options, conn->protocol_frame_codec->data, in mysqlnd_run_authentication()
117 if (conn->error_info->error_no) { in mysqlnd_run_authentication()
121 …ret = mysqlnd_auth_handshake(conn, user, passwd, passwd_len, db, db_len, session_options, mysql_fl… in mysqlnd_run_authentication()
131 ret = mysqlnd_auth_change_user(conn, user, strlen(user), passwd, passwd_len, db, db_len, silent, in mysqlnd_run_authentication()
155 DBG_INF_FMT("conn->error_info->error_no = %d", conn->error_info->error_no); in mysqlnd_run_authentication()
156 } while (ret == FAIL && conn->error_info->error_no == 0 && switch_to_auth_protocol != NULL); in mysqlnd_run_authentication()
160 conn->m->set_client_option(conn, MYSQLND_OPT_AUTH_PROTOCOL, requested_protocol); in mysqlnd_run_authentication()
177 mysqlnd_switch_to_ssl_if_needed(MYSQLND_CONN_DATA * const conn, in mysqlnd_switch_to_ssl_if_needed() argument
193 ret = conn->command->enable_ssl(conn, client_capabilities, server_capabilities, charset_no); in mysqlnd_switch_to_ssl_if_needed()
203 MYSQLND_CONN_DATA * const conn, in mysqlnd_connect_run_authentication() argument
220 …ret = mysqlnd_switch_to_ssl_if_needed(conn, charset_no, server_capabilities, session_options, mysq… in mysqlnd_connect_run_authentication()
222 ret = mysqlnd_run_authentication(conn, user, passwd, passwd_len, db, db_len, in mysqlnd_connect_run_authentication()
233 mysqlnd_auth_handshake(MYSQLND_CONN_DATA * conn, in mysqlnd_auth_handshake() argument
261 conn->payload_decoder_factory->m.init_auth_response_packet(&auth_resp_packet); in mysqlnd_auth_handshake()
266 conn->payload_decoder_factory->m.init_change_auth_response_packet(&change_auth_resp_packet); in mysqlnd_auth_handshake()
271 if (!PACKET_WRITE(conn, &change_auth_resp_packet)) { in mysqlnd_auth_handshake()
272 SET_CONNECTION_STATE(&conn->state, CONN_QUIT_SENT); in mysqlnd_auth_handshake()
273 SET_CLIENT_ERROR(conn->error_info, CR_SERVER_GONE_ERROR, UNKNOWN_SQLSTATE, mysqlnd_server_gone); in mysqlnd_auth_handshake()
281 conn->payload_decoder_factory->m.init_auth_packet(&auth_packet); in mysqlnd_auth_handshake()
300 if (conn->server_capabilities & CLIENT_CONNECT_ATTRS) { in mysqlnd_auth_handshake()
301 auth_packet.connect_attr = conn->options->connect_attr; in mysqlnd_auth_handshake()
304 if (!PACKET_WRITE(conn, &auth_packet)) { in mysqlnd_auth_handshake()
310 conn->charset = mysqlnd_find_charset_nr(auth_packet.charset_no); in mysqlnd_auth_handshake()
317 if (FAIL == auth_plugin->methods.handle_server_response(auth_plugin, conn, in mysqlnd_auth_handshake()
325 if (FAIL == PACKET_READ(conn, &auth_resp_packet) || auth_resp_packet.response_code >= 0xFE) { in mysqlnd_auth_handshake()
330 SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, mysqlnd_old_passwd); in mysqlnd_auth_handshake()
345 …strlcpy(conn->error_info->sqlstate, auth_resp_packet.sqlstate, sizeof(conn->error_info->sqlstate)); in mysqlnd_auth_handshake()
348 …SET_CLIENT_ERROR(conn->error_info, auth_resp_packet.error_no, UNKNOWN_SQLSTATE, auth_resp_packet.e… in mysqlnd_auth_handshake()
353 mysqlnd_set_string(&conn->last_message, auth_resp_packet.message, auth_resp_packet.message_len); in mysqlnd_auth_handshake()
364 mysqlnd_auth_change_user(MYSQLND_CONN_DATA * const conn, in mysqlnd_auth_change_user() argument
386 const MYSQLND_CHARSET * old_cs = conn->charset; in mysqlnd_auth_change_user()
391 conn->payload_decoder_factory->m.init_change_user_response_packet(&chg_user_resp); in mysqlnd_auth_change_user()
396 conn->payload_decoder_factory->m.init_change_auth_response_packet(&change_auth_resp_packet); in mysqlnd_auth_change_user()
401 if (!PACKET_WRITE(conn, &change_auth_resp_packet)) { in mysqlnd_auth_change_user()
402 SET_CONNECTION_STATE(&conn->state, CONN_QUIT_SENT); in mysqlnd_auth_change_user()
403 SET_CLIENT_ERROR(conn->error_info, CR_SERVER_GONE_ERROR, UNKNOWN_SQLSTATE, mysqlnd_server_gone); in mysqlnd_auth_change_user()
412 conn->payload_decoder_factory->m.init_auth_packet(&auth_packet); in mysqlnd_auth_change_user()
424 if (conn->server_capabilities & CLIENT_CONNECT_ATTRS) { in mysqlnd_auth_change_user()
425 auth_packet.connect_attr = conn->options->connect_attr; in mysqlnd_auth_change_user()
428 if (conn->m->get_server_version(conn) >= 50123) { in mysqlnd_auth_change_user()
429 auth_packet.charset_no = conn->charset->nr; in mysqlnd_auth_change_user()
432 if (!PACKET_WRITE(conn, &auth_packet)) { in mysqlnd_auth_change_user()
433 SET_CONNECTION_STATE(&conn->state, CONN_QUIT_SENT); in mysqlnd_auth_change_user()
434 SET_CLIENT_ERROR(conn->error_info, CR_SERVER_GONE_ERROR, UNKNOWN_SQLSTATE, mysqlnd_server_gone); in mysqlnd_auth_change_user()
443 if (FAIL == auth_plugin->methods.handle_server_response(auth_plugin, conn, in mysqlnd_auth_change_user()
451 ret = PACKET_READ(conn, &chg_user_resp); in mysqlnd_auth_change_user()
452 COPY_CLIENT_ERROR(conn->error_info, chg_user_resp.error_info); in mysqlnd_auth_change_user()
458 SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, mysqlnd_old_passwd); in mysqlnd_auth_change_user()
473 if (conn->error_info->error_no) { in mysqlnd_auth_change_user()
480 if (conn->m->get_server_version(conn) > 50113L &&conn->m->get_server_version(conn) < 50118L) { in mysqlnd_auth_change_user()
483 conn->payload_decoder_factory->m.init_ok_packet(&redundant_error_packet); in mysqlnd_auth_change_user()
484 PACKET_READ(conn, &redundant_error_packet); in mysqlnd_auth_change_user()
486 …("Server is " ZEND_ULONG_FMT ", buggy, sends two ERR messages", conn->m->get_server_version(conn)); in mysqlnd_auth_change_user()
490 ZEND_ASSERT(conn->username.s != user && conn->password.s != passwd); in mysqlnd_auth_change_user()
491 mysqlnd_set_persistent_string(&conn->username, user, user_len, conn->persistent); in mysqlnd_auth_change_user()
492 mysqlnd_set_persistent_string(&conn->password, passwd, passwd_len, conn->persistent); in mysqlnd_auth_change_user()
494 mysqlnd_set_string(&conn->last_message, NULL, 0); in mysqlnd_auth_change_user()
495 UPSERT_STATUS_RESET(conn->upsert_status); in mysqlnd_auth_change_user()
497 if (conn->m->get_server_version(conn) < 50123) { in mysqlnd_auth_change_user()
498 ret = conn->m->set_charset(conn, old_cs->name); in mysqlnd_auth_change_user()
503 SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, mysqlnd_old_passwd); in mysqlnd_auth_change_user()
561 MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd, in mysqlnd_native_auth_get_auth_data() argument
575 …SET_CLIENT_ERROR(conn->error_info, CR_MALFORMED_PACKET, UNKNOWN_SQLSTATE, "The server sent wrong l… in mysqlnd_native_auth_get_auth_data()
622 MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd, in mysqlnd_pam_auth_get_auth_data() argument
702 mysqlnd_sha256_public_encrypt(MYSQLND_CONN_DATA * conn, mysqlnd_rsa_t server_public_key, size_t pas… in mysqlnd_sha256_public_encrypt() argument
716 SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, "password is too long"); in mysqlnd_sha256_public_encrypt()
782 mysqlnd_sha256_public_encrypt(MYSQLND_CONN_DATA * conn, mysqlnd_rsa_t server_public_key, size_t pas… in mysqlnd_sha256_public_encrypt() argument
805 SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, "password is too long"); in mysqlnd_sha256_public_encrypt()
826 mysqlnd_sha256_get_rsa_key(MYSQLND_CONN_DATA * conn, in mysqlnd_sha256_get_rsa_key() argument
846 conn->payload_decoder_factory->m.init_sha256_pk_request_packet(&pk_req_packet); in mysqlnd_sha256_get_rsa_key()
847 conn->payload_decoder_factory->m.init_sha256_pk_request_response_packet(&pk_resp_packet); in mysqlnd_sha256_get_rsa_key()
849 if (! PACKET_WRITE(conn, &pk_req_packet)) { in mysqlnd_sha256_get_rsa_key()
852 SET_CONNECTION_STATE(&conn->state, CONN_QUIT_SENT); in mysqlnd_sha256_get_rsa_key()
855 if (FAIL == PACKET_READ(conn, &pk_resp_packet) || NULL == pk_resp_packet.public_key) { in mysqlnd_sha256_get_rsa_key()
858 SET_CONNECTION_STATE(&conn->state, CONN_QUIT_SENT); in mysqlnd_sha256_get_rsa_key()
871 SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, in mysqlnd_sha256_get_rsa_key()
899 MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd, in mysqlnd_sha256_auth_get_auth_data() argument
912 if (conn->vio->data->ssl) { in mysqlnd_sha256_auth_get_auth_data()
923 server_public_key = mysqlnd_sha256_get_rsa_key(conn, session_options, pfc_data); in mysqlnd_sha256_auth_get_auth_data()
934 ret = mysqlnd_sha256_public_encrypt(conn, server_public_key, passwd_len, auth_data_len, xor_str); in mysqlnd_sha256_auth_get_auth_data()
1010 mysqlnd_caching_sha2_public_encrypt(MYSQLND_CONN_DATA * conn, mysqlnd_rsa_t server_public_key, size… in mysqlnd_caching_sha2_public_encrypt() argument
1023 SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, "password is too long"); in mysqlnd_caching_sha2_public_encrypt()
1046 mysqlnd_caching_sha2_public_encrypt(MYSQLND_CONN_DATA * conn, mysqlnd_rsa_t server_public_key, size… in mysqlnd_caching_sha2_public_encrypt() argument
1068 SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, "password is too long"); in mysqlnd_caching_sha2_public_encrypt()
1090 MYSQLND_CONN_DATA * conn, const char * const user, const char * const passwd, in mysqlnd_caching_sha2_get_auth_data() argument
1103 …SET_CLIENT_ERROR(conn->error_info, CR_MALFORMED_PACKET, UNKNOWN_SQLSTATE, "The server sent wrong l… in mysqlnd_caching_sha2_get_auth_data()
1123 mysqlnd_caching_sha2_get_key(MYSQLND_CONN_DATA *conn) in mysqlnd_caching_sha2_get_key() argument
1126 const MYSQLND_PFC_DATA * const pfc_data = conn->protocol_frame_codec->data; in mysqlnd_caching_sha2_get_key()
1141 conn->payload_decoder_factory->m.init_cached_sha2_result_packet(&req_packet); in mysqlnd_caching_sha2_get_key()
1142 conn->payload_decoder_factory->m.init_sha256_pk_request_response_packet(&pk_resp_packet); in mysqlnd_caching_sha2_get_key()
1145 if (! PACKET_WRITE(conn, &req_packet)) { in mysqlnd_caching_sha2_get_key()
1148 SET_CONNECTION_STATE(&conn->state, CONN_QUIT_SENT); in mysqlnd_caching_sha2_get_key()
1151 if (FAIL == PACKET_READ(conn, &pk_resp_packet) || NULL == pk_resp_packet.public_key) { in mysqlnd_caching_sha2_get_key()
1154 SET_CONNECTION_STATE(&conn->state, CONN_QUIT_SENT); in mysqlnd_caching_sha2_get_key()
1167 SET_CLIENT_ERROR(conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, in mysqlnd_caching_sha2_get_key()
1193 mysqlnd_caching_sha2_get_and_use_key(MYSQLND_CONN_DATA *conn, in mysqlnd_caching_sha2_get_and_use_key() argument
1199 mysqlnd_rsa_t server_public_key = mysqlnd_caching_sha2_get_key(conn); in mysqlnd_caching_sha2_get_and_use_key()
1210 …server_public_key_len = mysqlnd_caching_sha2_public_encrypt(conn, server_public_key, passwd_len, c… in mysqlnd_caching_sha2_get_and_use_key()
1218 static int is_secure_transport(MYSQLND_CONN_DATA *conn) { in is_secure_transport() argument
1219 if (conn->vio->data->ssl) { in is_secure_transport()
1223 return strcmp(conn->vio->data->stream->ops->label, "unix_socket") == 0; in is_secure_transport()
1229 MYSQLND_CONN_DATA * conn, in mysqlnd_caching_sha2_handle_server_response() argument
1245 conn->payload_decoder_factory->m.init_cached_sha2_result_packet(&result_packet); in mysqlnd_caching_sha2_handle_server_response()
1246 if (FAIL == PACKET_READ(conn, &result_packet)) { in mysqlnd_caching_sha2_handle_server_response()
1253 strlcpy(conn->error_info->sqlstate, result_packet.sqlstate, sizeof(conn->error_info->sqlstate)); in mysqlnd_caching_sha2_handle_server_response()
1256 … SET_CLIENT_ERROR(conn->error_info, result_packet.error_no, UNKNOWN_SQLSTATE, result_packet.error); in mysqlnd_caching_sha2_handle_server_response()
1269 if (is_secure_transport(conn)) { in mysqlnd_caching_sha2_handle_server_response()
1273 PACKET_WRITE(conn, &result_packet); in mysqlnd_caching_sha2_handle_server_response()
1276 …result_packet.password_len = mysqlnd_caching_sha2_get_and_use_key(conn, auth_plugin_data, auth_plu… in mysqlnd_caching_sha2_handle_server_response()
1277 PACKET_WRITE(conn, &result_packet); in mysqlnd_caching_sha2_handle_server_response()
1287 SET_CLIENT_ERROR(conn->error_info, CR_NOT_IMPLEMENTED, UNKNOWN_SQLSTATE, msg); in mysqlnd_caching_sha2_handle_server_response()