| Bug #104915 | Remove the dead code | ||
|---|---|---|---|
| Submitted: | 12 Sep 2021 3:19 | Modified: | 30 Nov 2021 13:49 |
| Reporter: | Rahul Sisondia | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Security: Roles | Severity: | S3 (Non-critical) |
| Version: | 8.0 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[12 Sep 2021 8:17]
MySQL Verification Team
Hello Rahul, Thank you for the report and feedback. regards, Umesh
[30 Nov 2021 13:49]
Daniel Price
Posted by developer: Fixed as of the upcoming 8.0.29 release: Redundant init and checkout_access_maps function code was removed from the Security_context class.

Description: It seems that map_checkout_count is not serving any purpose. We can safely remove the dead code. How to repeat: See below Suggested fix: diff --git a/sql/auth/sql_security_ctx.cc b/sql/auth/sql_security_ctx.cc index 2f7cf355b2c..ca9968552ee 100644 --- a/sql/auth/sql_security_ctx.cc +++ b/sql/auth/sql_security_ctx.cc @@ -87,7 +87,6 @@ void Security_context::init() { m_master_access = 0; m_db_access = NO_ACCESS; m_acl_map = nullptr; - m_map_checkout_count = 0; m_password_expired = false; m_is_locked = false; m_is_skip_grants_user = false; @@ -393,8 +392,6 @@ void Security_context::checkout_access_maps(void) { m_acl_map = nullptr; } - if (m_active_roles.size() == 0) return; - ++m_map_checkout_count; Auth_id_ref uid; uid.first.str = this->m_priv_user; uid.first.length = this->m_priv_user_length; diff --git a/sql/auth/sql_security_ctx.h b/sql/auth/sql_security_ctx.h index 5e47f3fbea2..9da1a48983a 100644 --- a/sql/auth/sql_security_ctx.h +++ b/sql/auth/sql_security_ctx.h @@ -368,7 +368,7 @@ class Security_context { bool m_password_expired; List_of_auth_id_refs m_active_roles; Acl_map *m_acl_map; - int m_map_checkout_count; + /** True if this account can't be logged into. */