mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Merge zippy.(none):/home/cmiller/work/mysql/merge/tmp_merge
into zippy.(none):/home/cmiller/work/mysql/merge/mysql-5.1 libmysqld/lib_sql.cc: Auto merged libmysqld/libmysqld.c: Auto merged mysql-test/mysql-test-run.sh: Auto merged mysql-test/r/gis.result: Auto merged mysql-test/r/information_schema.result: Auto merged mysql-test/r/sp-security.result: Auto merged mysql-test/r/variables.result: Auto merged mysql-test/t/gis.test: Auto merged mysql-test/t/sp-security.test: Auto merged mysql-test/t/variables.test: Auto merged scripts/make_binary_distribution.sh: Auto merged sql/ha_ndbcluster.cc: Auto merged sql/item_geofunc.h: Auto merged sql-common/client.c: Auto merged sql/set_var.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_parse.cc: Auto merged storage/ndb/include/kernel/GlobalSignalNumbers.h: Auto merged storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp: Auto merged storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp: Auto merged mysql-test/t/mysqldump.test: Manual merge. (Seems to need null-merging.) sql/mysqld.cc: Manual merge + formatting change. sql/sql_show.cc: Manual merge
This commit is contained in:
@@ -5749,25 +5749,30 @@ bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name,
|
||||
TABLE_LIST tables[1];
|
||||
List<LEX_USER> user_list;
|
||||
bool result;
|
||||
ACL_USER *au;
|
||||
char passwd_buff[SCRAMBLED_PASSWORD_CHAR_LENGTH+1];
|
||||
DBUG_ENTER("sp_grant_privileges");
|
||||
|
||||
if (!(combo=(LEX_USER*) thd->alloc(sizeof(st_lex_user))))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
combo->user.str= sctx->user;
|
||||
|
||||
|
||||
VOID(pthread_mutex_lock(&acl_cache->lock));
|
||||
if (!find_acl_user(combo->host.str=(char*)sctx->host_or_ip, combo->user.str,
|
||||
FALSE) &&
|
||||
!find_acl_user(combo->host.str=(char*)sctx->host, combo->user.str,
|
||||
FALSE) &&
|
||||
!find_acl_user(combo->host.str=(char*)sctx->ip, combo->user.str,
|
||||
FALSE) &&
|
||||
!find_acl_user(combo->host.str=(char*)"%", combo->user.str, FALSE))
|
||||
{
|
||||
VOID(pthread_mutex_unlock(&acl_cache->lock));
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
if ((au= find_acl_user(combo->host.str=(char*)sctx->host_or_ip,combo->user.str,FALSE)))
|
||||
goto found_acl;
|
||||
if ((au= find_acl_user(combo->host.str=(char*)sctx->host, combo->user.str,FALSE)))
|
||||
goto found_acl;
|
||||
if ((au= find_acl_user(combo->host.str=(char*)sctx->ip, combo->user.str,FALSE)))
|
||||
goto found_acl;
|
||||
if((au= find_acl_user(combo->host.str=(char*)"%", combo->user.str, FALSE)))
|
||||
goto found_acl;
|
||||
|
||||
VOID(pthread_mutex_unlock(&acl_cache->lock));
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
found_acl:
|
||||
VOID(pthread_mutex_unlock(&acl_cache->lock));
|
||||
|
||||
bzero((char*)tables, sizeof(TABLE_LIST));
|
||||
@@ -5775,13 +5780,37 @@ bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name,
|
||||
|
||||
tables->db= (char*)sp_db;
|
||||
tables->table_name= tables->alias= (char*)sp_name;
|
||||
|
||||
|
||||
combo->host.length= strlen(combo->host.str);
|
||||
combo->user.length= strlen(combo->user.str);
|
||||
combo->host.str= thd->strmake(combo->host.str,combo->host.length);
|
||||
combo->user.str= thd->strmake(combo->user.str,combo->user.length);
|
||||
combo->password.str= (char*)"";
|
||||
combo->password.length= 0;
|
||||
|
||||
|
||||
if(au && au->salt_len)
|
||||
{
|
||||
if (au->salt_len == SCRAMBLE_LENGTH)
|
||||
{
|
||||
make_password_from_salt(passwd_buff, au->salt);
|
||||
combo->password.length= SCRAMBLED_PASSWORD_CHAR_LENGTH;
|
||||
}
|
||||
else if (au->salt_len == SCRAMBLE_LENGTH_323)
|
||||
{
|
||||
make_password_from_salt_323(passwd_buff, (ulong *) au->salt);
|
||||
combo->password.length= SCRAMBLED_PASSWORD_CHAR_LENGTH_323;
|
||||
}
|
||||
else
|
||||
{
|
||||
my_error(ER_PASSWD_LENGTH, MYF(0), SCRAMBLED_PASSWORD_CHAR_LENGTH);
|
||||
return -1;
|
||||
}
|
||||
combo->password.str= passwd_buff;
|
||||
}
|
||||
else
|
||||
{
|
||||
combo->password.str= (char*)"";
|
||||
combo->password.length= 0;
|
||||
}
|
||||
|
||||
if (user_list.push_back(combo))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
Reference in New Issue
Block a user