|
36 | 36 | #include <mysql/plugin_validate_password.h> /* validate_password plugin */ |
37 | 37 | #include <mysql/service_my_plugin_log.h> |
38 | 38 | #include "sys_vars.h" |
| 39 | +#include "debug_sync.h" |
39 | 40 | #include <fstream> /* std::fstream */ |
40 | 41 | #include <string> /* std::string */ |
41 | 42 | #include <algorithm> /* for_each */ |
@@ -2195,6 +2196,14 @@ acl_authenticate(THD *thd, enum_server_command command) |
2195 | 2196 | compile_time_assert(MYSQL_USERNAME_LENGTH == USERNAME_LENGTH); |
2196 | 2197 | assert(command == COM_CONNECT || command == COM_CHANGE_USER); |
2197 | 2198 |
|
| 2199 | + mysql_mutex_lock(&thd->LOCK_thd_data); |
| 2200 | + |
| 2201 | + DBUG_EXECUTE_IF("before_server_mpvio_initialize", { |
| 2202 | + DBUG_SET("+d,wait_until_thread_kill"); |
| 2203 | + const char act[] = "now SIGNAL acl_auth_reached"; |
| 2204 | + assert(!debug_sync_set_action(current_thd, STRING_WITH_LEN(act))); |
| 2205 | + }); |
| 2206 | + |
2198 | 2207 | server_mpvio_initialize(thd, &mpvio, &charset_adapter); |
2199 | 2208 | /* |
2200 | 2209 | Clear thd->db as it points to something, that will be freed when |
@@ -2223,6 +2232,7 @@ acl_authenticate(THD *thd, enum_server_command command) |
2223 | 2232 | { |
2224 | 2233 | login_failed_error(&mpvio, mpvio.auth_info.password_used); |
2225 | 2234 | server_mpvio_update_thd(thd, &mpvio); |
| 2235 | + mysql_mutex_unlock(&thd->LOCK_thd_data); |
2226 | 2236 | DBUG_RETURN(1); |
2227 | 2237 | } |
2228 | 2238 |
|
@@ -2265,11 +2275,19 @@ acl_authenticate(THD *thd, enum_server_command command) |
2265 | 2275 | } |
2266 | 2276 | } |
2267 | 2277 |
|
| 2278 | + DBUG_EXECUTE_IF("before_server_mpvio_update_thd", { |
| 2279 | + DBUG_SET("+d,wait_until_thread_kill"); |
| 2280 | + const char act[] = "now SIGNAL acl_auth_reached"; |
| 2281 | + assert(!debug_sync_set_action(current_thd, STRING_WITH_LEN(act))); |
| 2282 | + }); |
| 2283 | + |
2268 | 2284 | server_mpvio_update_thd(thd, &mpvio); |
2269 | 2285 | #ifdef HAVE_PSI_THREAD_INTERFACE |
2270 | 2286 | PSI_THREAD_CALL(set_connection_type)(thd->get_vio_type()); |
2271 | 2287 | #endif /* HAVE_PSI_THREAD_INTERFACE */ |
2272 | 2288 |
|
| 2289 | + mysql_mutex_unlock(&thd->LOCK_thd_data); |
| 2290 | + |
2273 | 2291 | Security_context *sctx= thd->security_context(); |
2274 | 2292 | const ACL_USER *acl_user= mpvio.acl_user; |
2275 | 2293 | bool proxy_check= check_proxy_users && !*mpvio.auth_info.authenticated_as; |
@@ -2451,13 +2469,20 @@ acl_authenticate(THD *thd, enum_server_command command) |
2451 | 2469 | DBUG_RETURN(1); |
2452 | 2470 | } |
2453 | 2471 |
|
2454 | | - if (opt_require_secure_transport && |
2455 | | - !is_secure_transport(thd->active_vio->type)) |
2456 | | - { |
| 2472 | + mysql_mutex_lock(&thd->LOCK_thd_data); |
| 2473 | + DBUG_EXECUTE_IF("before_secure_transport_check", { |
| 2474 | + DBUG_SET("+d,wait_until_thread_kill"); |
| 2475 | + const char act[] = "now SIGNAL acl_auth_reached"; |
| 2476 | + assert(!debug_sync_set_action(current_thd, STRING_WITH_LEN(act))); |
| 2477 | + }); |
| 2478 | + |
| 2479 | + if (opt_require_secure_transport && thd->active_vio != NULL && |
| 2480 | + !is_secure_transport(thd->active_vio->type)) { |
| 2481 | + mysql_mutex_unlock(&thd->LOCK_thd_data); |
2457 | 2482 | my_error(ER_SECURE_TRANSPORT_REQUIRED, MYF(0)); |
2458 | 2483 | DBUG_RETURN(1); |
2459 | 2484 | } |
2460 | | - |
| 2485 | + mysql_mutex_unlock(&thd->LOCK_thd_data); |
2461 | 2486 |
|
2462 | 2487 | /* checking password_time_expire for connecting user */ |
2463 | 2488 | password_time_expired= check_password_lifetime(thd, mpvio.acl_user); |
@@ -2542,6 +2567,11 @@ acl_authenticate(THD *thd, enum_server_command command) |
2542 | 2567 | #endif // !EMBEDDED_LIBRARY |
2543 | 2568 | } |
2544 | 2569 |
|
| 2570 | + DBUG_EXECUTE_IF("wait_until_thread_kill", { |
| 2571 | + DBUG_SET("-d,wait_until_thread_kill"); |
| 2572 | + const char act[] = "now WAIT_FOR killed"; |
| 2573 | + assert(!debug_sync_set_action(current_thd, STRING_WITH_LEN(act))); |
| 2574 | + }); |
2545 | 2575 | /* |
2546 | 2576 | This is the default access rights for the current database. It's |
2547 | 2577 | set to 0 here because we don't have an active database yet (and we |
@@ -2928,6 +2958,12 @@ static int sha256_password_authenticate(MYSQL_PLUGIN_VIO *vio, |
2928 | 2958 |
|
2929 | 2959 | DBUG_ENTER("sha256_password_authenticate"); |
2930 | 2960 |
|
| 2961 | + DBUG_EXECUTE_IF("in_sha256_password_authenticate", { |
| 2962 | + DBUG_SET("+d,wait_until_thread_kill"); |
| 2963 | + const char act[] = "now SIGNAL acl_auth_reached"; |
| 2964 | + assert(!debug_sync_set_action(current_thd, STRING_WITH_LEN(act))); |
| 2965 | + }); |
| 2966 | + |
2931 | 2967 | generate_user_salt(scramble, SCRAMBLE_LENGTH + 1); |
2932 | 2968 |
|
2933 | 2969 | /* |
|
0 commit comments