@@ -13932,61 +13932,6 @@ bool acl_authenticate(THD *thd, uint com_change_user_pkt_len)
13932
13932
13933
13933
if (initialized) // if not --skip-grant-tables
13934
13934
{
13935
- #ifndef NO_EMBEDDED_ACCESS_CHECKS
13936
- bool is_proxy_user= FALSE ;
13937
- const char *auth_user = acl_user->user .str ;
13938
- ACL_PROXY_USER *proxy_user;
13939
- /* check if the user is allowed to proxy as another user */
13940
- proxy_user= acl_find_proxy_user (auth_user, sctx->host , sctx->ip ,
13941
- mpvio.auth_info .authenticated_as ,
13942
- &is_proxy_user);
13943
- if (is_proxy_user)
13944
- {
13945
- ACL_USER *acl_proxy_user;
13946
-
13947
- /* we need to find the proxy user, but there was none */
13948
- if (!proxy_user)
13949
- {
13950
- Host_errors errors;
13951
- errors.m_proxy_user = 1 ;
13952
- inc_host_errors (mpvio.auth_info .thd ->security_ctx ->ip , &errors);
13953
- if (!thd->is_error ())
13954
- login_failed_error (thd);
13955
- DBUG_RETURN (1 );
13956
- }
13957
-
13958
- my_snprintf (sctx->proxy_user , sizeof (sctx->proxy_user ) - 1 ,
13959
- " '%s'@'%s'" , auth_user,
13960
- safe_str (acl_user->host .hostname ));
13961
-
13962
- /* we're proxying : find the proxy user definition */
13963
- mysql_mutex_lock (&acl_cache->lock );
13964
- acl_proxy_user= find_user_exact (safe_str (proxy_user->get_proxied_host ()),
13965
- mpvio.auth_info .authenticated_as );
13966
- if (!acl_proxy_user)
13967
- {
13968
- mysql_mutex_unlock (&acl_cache->lock );
13969
-
13970
- Host_errors errors;
13971
- errors.m_proxy_user_acl = 1 ;
13972
- inc_host_errors (mpvio.auth_info .thd ->security_ctx ->ip , &errors);
13973
- if (!thd->is_error ())
13974
- login_failed_error (thd);
13975
- DBUG_RETURN (1 );
13976
- }
13977
- acl_user= acl_proxy_user->copy (thd->mem_root );
13978
- mysql_mutex_unlock (&acl_cache->lock );
13979
- }
13980
- #endif
13981
-
13982
- sctx->master_access = acl_user->access ;
13983
- strmake_buf (sctx->priv_user , acl_user->user .str );
13984
-
13985
- if (acl_user->host .hostname )
13986
- strmake_buf (sctx->priv_host , acl_user->host .hostname );
13987
- else
13988
- *sctx->priv_host = 0 ;
13989
-
13990
13935
/*
13991
13936
OK. Let's check the SSL. Historically it was checked after the password,
13992
13937
as an additional layer, not instead of the password
@@ -14023,6 +13968,65 @@ bool acl_authenticate(THD *thd, uint com_change_user_pkt_len)
14023
13968
14024
13969
sctx->password_expired = password_expired;
14025
13970
13971
+ #ifndef NO_EMBEDDED_ACCESS_CHECKS
13972
+ if (!password_expired)
13973
+ {
13974
+ bool is_proxy_user= FALSE ;
13975
+ const char *auth_user = acl_user->user .str ;
13976
+ ACL_PROXY_USER *proxy_user;
13977
+ /* check if the user is allowed to proxy as another user */
13978
+ proxy_user= acl_find_proxy_user (auth_user, sctx->host , sctx->ip ,
13979
+ mpvio.auth_info .authenticated_as ,
13980
+ &is_proxy_user);
13981
+ if (is_proxy_user)
13982
+ {
13983
+ ACL_USER *acl_proxy_user;
13984
+
13985
+ /* we need to find the proxy user, but there was none */
13986
+ if (!proxy_user)
13987
+ {
13988
+ Host_errors errors;
13989
+ errors.m_proxy_user = 1 ;
13990
+ inc_host_errors (mpvio.auth_info .thd ->security_ctx ->ip , &errors);
13991
+ if (!thd->is_error ())
13992
+ login_failed_error (thd);
13993
+ DBUG_RETURN (1 );
13994
+ }
13995
+
13996
+ my_snprintf (sctx->proxy_user , sizeof (sctx->proxy_user ) - 1 ,
13997
+ " '%s'@'%s'" , auth_user,
13998
+ safe_str (acl_user->host .hostname ));
13999
+
14000
+ /* we're proxying : find the proxy user definition */
14001
+ mysql_mutex_lock (&acl_cache->lock );
14002
+ acl_proxy_user= find_user_exact (safe_str (proxy_user->get_proxied_host ()),
14003
+ mpvio.auth_info .authenticated_as );
14004
+ if (!acl_proxy_user)
14005
+ {
14006
+ mysql_mutex_unlock (&acl_cache->lock );
14007
+
14008
+ Host_errors errors;
14009
+ errors.m_proxy_user_acl = 1 ;
14010
+ inc_host_errors (mpvio.auth_info .thd ->security_ctx ->ip , &errors);
14011
+ if (!thd->is_error ())
14012
+ login_failed_error (thd);
14013
+ DBUG_RETURN (1 );
14014
+ }
14015
+ acl_user= acl_proxy_user->copy (thd->mem_root );
14016
+ mysql_mutex_unlock (&acl_cache->lock );
14017
+ }
14018
+ }
14019
+ #endif
14020
+
14021
+ sctx->master_access = acl_user->access ;
14022
+ strmake_buf (sctx->priv_user , acl_user->user .str );
14023
+
14024
+ if (acl_user->host .hostname )
14025
+ strmake_buf (sctx->priv_host , acl_user->host .hostname );
14026
+ else
14027
+ *sctx->priv_host = 0 ;
14028
+
14029
+
14026
14030
/*
14027
14031
Don't allow the user to connect if he has done too many queries.
14028
14032
As we are testing max_user_connections == 0 here, it means that we
0 commit comments