Skip to content

Commit

Permalink
cleanup: sql_acl.cc
Browse files Browse the repository at this point in the history
* remove no-op check_password_policy() and references to it
* add 'static' to functions that need it
* remove unused function check_acl_user()
  • Loading branch information
vuvova committed Dec 4, 2014
1 parent f5722f5 commit 61820bc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 40 deletions.
10 changes: 2 additions & 8 deletions sql/item_strfunc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2184,7 +2184,6 @@ String *Item_func_password::val_str_ascii(String *str)
String *res= args[0]->val_str(str);
switch (alg){
case NEW:
check_password_policy(res);
if (args[0]->null_value || res->length() == 0)
return make_empty_result();
my_make_scrambled_password(tmp_value, res->ptr(), res->length());
Expand Down Expand Up @@ -2215,13 +2214,8 @@ char *Item_func_password::alloc(THD *thd, const char *password,

switch (al) {
case NEW:
{
String *password_str= new (thd->mem_root)String(password, thd->variables.
character_set_client);
check_password_policy(password_str);
my_make_scrambled_password(buff, password, pass_len);
break;
}
my_make_scrambled_password(buff, password, pass_len);
break;
case OLD:
my_make_scrambled_password_323(buff, password, pass_len);
break;
Expand Down
35 changes: 5 additions & 30 deletions sql/sql_acl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2406,7 +2406,7 @@ static void init_check_host(void)
'acl_user' array, which are invalidated by drop operation, and use
ACL_USER::host::hostname as a key, which is changed by rename.
*/
void rebuild_check_host(void)
static void rebuild_check_host(void)
{
delete_dynamic(&acl_wild_hosts);
my_hash_free(&acl_check_hosts);
Expand Down Expand Up @@ -2594,7 +2594,7 @@ bool acl_check_host(const char *host, const char *ip)
@retval 1 Error
*/

int check_alter_user(THD *thd, const char *host, const char *user)
static int check_alter_user(THD *thd, const char *host, const char *user)
{
int error = 1;
if (!initialized)
Expand Down Expand Up @@ -5596,7 +5596,7 @@ static bool merge_one_role_privileges(ACL_ROLE *grantee)
End of the role privilege propagation and graph traversal code
******************************************************************/

bool copy_and_check_auth(LEX_USER *to, LEX_USER *from, LEX *lex)
static bool copy_and_check_auth(LEX_USER *to, LEX_USER *from, LEX *lex)
{
if (to != from)
{
Expand Down Expand Up @@ -6646,7 +6646,8 @@ static bool grant_load(THD *thd, TABLE_LIST *tables)
}


my_bool role_propagate_grants_action(void *ptr, void *unused __attribute__((unused)))
static my_bool role_propagate_grants_action(void *ptr,
void *unused __attribute__((unused)))
{
ACL_ROLE *role= (ACL_ROLE *)ptr;
if (role->counter)
Expand Down Expand Up @@ -8426,26 +8427,6 @@ static int open_grant_tables(THD *thd, TABLE_LIST *tables,
DBUG_RETURN(0);
}

ACL_USER *check_acl_user(LEX_USER *user_name, uint *acl_acl_userdx)
{
ACL_USER *acl_user= 0;
uint counter;

mysql_mutex_assert_owner(&acl_cache->lock);

for (counter= 0 ; counter < acl_users.elements ; counter++)
{
acl_user= dynamic_element(&acl_users, counter, ACL_USER*);
if(acl_user->eq(user_name->user.str, user_name->host.str))
break;
}
if (counter == acl_users.elements)
return 0;

*acl_acl_userdx= counter;
return acl_user;
}

/*
Modify a privilege table.
Expand Down Expand Up @@ -12629,9 +12610,3 @@ maria_declare_plugin(mysql_password)
}
maria_declare_plugin_end;


/* called when new user is created or exsisting password is changed */
int check_password_policy(String *password)
{
return (0);
}
1 change: 0 additions & 1 deletion sql/sql_acl.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond);
int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond);
int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond);
int wild_case_compare(CHARSET_INFO *cs, const char *str,const char *wildstr);
int check_password_policy(String *password);

/**
Result of an access check for an internal schema or table.
Expand Down
2 changes: 1 addition & 1 deletion sql/sql_trigger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "sql_table.h" // build_table_filename,
// check_n_cut_mysql50_prefix
#include "sql_db.h" // get_default_db_collation
#include "sql_acl.h" // *_ACL, is_acl_user
#include "sql_acl.h" // *_ACL
#include "sql_handler.h" // mysql_ha_rm_tables
#include "sp_cache.h" // sp_invalidate_cache
#include <mysys_err.h>
Expand Down

0 comments on commit 61820bc

Please sign in to comment.