Update the security context when updating the user Helper function. Update only if the security context is pointing to the same user. And return true if the update happens (i.e. we're operating on the user account of the current user). Normalize the names for a safe compare. @param sctx The security context to update @param acl_user_ptr User account being updated @par
| 2388 | @return did the update happen ? |
| 2389 | */ |
| 2390 | static bool |
| 2391 | update_sctx_cache(Security_context *sctx, ACL_USER *acl_user_ptr, bool expired) |
| 2392 | { |
| 2393 | const char *acl_host= acl_user_ptr->host.get_host(); |
| 2394 | const char *acl_user= acl_user_ptr->user; |
| 2395 | const char *sctx_user= sctx->priv_user; |
| 2396 | const char *sctx_host= sctx->priv_host; |
| 2397 | |
| 2398 | if (!acl_host) |
| 2399 | acl_host= ""; |
| 2400 | if(!acl_user) |
| 2401 | acl_user= ""; |
| 2402 | if (!sctx_host) |
| 2403 | sctx_host= ""; |
| 2404 | if (!sctx_user) |
| 2405 | sctx_user= ""; |
| 2406 | |
| 2407 | if (!strcmp(acl_user, sctx_user) && !strcmp(acl_host, sctx_host)) |
| 2408 | { |
| 2409 | sctx->password_expired= expired; |
| 2410 | return true; |
| 2411 | } |
| 2412 | |
| 2413 | return false; |
| 2414 | } |
| 2415 | |
| 2416 | |
| 2417 |
no test coverage detected