several bug fixes

parent 9b35856c
...@@ -263,8 +263,10 @@ C_MODE_END ...@@ -263,8 +263,10 @@ C_MODE_END
#endif #endif
#ifdef HAVE_ATOMIC_ADD #ifdef HAVE_ATOMIC_ADD
#define __SMP__ #define __SMP__
#define CONFIG_SMP
#include <asm/atomic.h> #include <asm/atomic.h>
#ifndef CONFIG_SMP
#define CONFIG_SMP
#endif
#endif #endif
#include <errno.h> /* Recommended by debian */ #include <errno.h> /* Recommended by debian */
/* We need the following to go around a problem with openssl on solaris */ /* We need the following to go around a problem with openssl on solaris */
......
...@@ -315,6 +315,7 @@ static CHARSET_INFO *add_charset(uint cs_number, const char *cs_name, myf flags) ...@@ -315,6 +315,7 @@ static CHARSET_INFO *add_charset(uint cs_number, const char *cs_name, myf flags)
cs->to_lower=tmp_to_lower; cs->to_lower=tmp_to_lower;
cs->to_upper=tmp_to_upper; cs->to_upper=tmp_to_upper;
cs->sort_order=tmp_sort_order; cs->sort_order=tmp_sort_order;
cs->strxfrm_multiply=cs->mbmaxlen=1;
if (read_charset_file(cs_number, cs, flags)) if (read_charset_file(cs_number, cs, flags))
return NULL; return NULL;
......
...@@ -2285,11 +2285,20 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list, ...@@ -2285,11 +2285,20 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list,
(!db ? rights : 0), revoke_grant, (!db ? rights : 0), revoke_grant,
create_new_users))) create_new_users)))
result= -1; result= -1;
else else if (db)
{ {
if (db && replace_db_table(tables[1].table, db, *Str, rights & DB_ACLS, ulong db_rights= rights & DB_ACLS;
revoke_grant)) if (db_rights == rights)
{
if (replace_db_table(tables[1].table, db, *Str, db_rights,
revoke_grant))
result= -1;
}
else
{
net_printf(&thd->net,ER_WRONG_USAGE,"DB GRANT","GLOBAL PRIVILEGEY");
result= -1; result= -1;
}
} }
} }
VOID(pthread_mutex_unlock(&acl_cache->lock)); VOID(pthread_mutex_unlock(&acl_cache->lock));
......
...@@ -257,10 +257,11 @@ static bool check_user(THD *thd,enum_server_command command, const char *user, ...@@ -257,10 +257,11 @@ static bool check_user(THD *thd,enum_server_command command, const char *user,
db ? db : (char*) ""); db ? db : (char*) "");
thd->db_access=0; thd->db_access=0;
/* Don't allow user to connect if he has done too many queries */ /* Don't allow user to connect if he has done too many queries */
if ((ur.questions || ur.updates || ur.connections) && if ((ur.questions || ur.updates || ur.connections || max_user_connections) &&
get_or_create_user_conn(thd,user,thd->host_or_ip,&ur)) get_or_create_user_conn(thd,user,thd->host_or_ip,&ur))
return -1; return -1;
if (thd->user_connect && thd->user_connect->user_resources.connections && if (thd->user_connect && ((thd->user_connect->user_resources.connections) ||
max_user_connections) &&
check_for_max_user_connections(thd->user_connect)) check_for_max_user_connections(thd->user_connect))
return -1; return -1;
if (db && db[0]) if (db && db[0])
...@@ -308,7 +309,7 @@ static int check_for_max_user_connections(USER_CONN *uc) ...@@ -308,7 +309,7 @@ static int check_for_max_user_connections(USER_CONN *uc)
DBUG_ENTER("check_for_max_user_connections"); DBUG_ENTER("check_for_max_user_connections");
if (max_user_connections && if (max_user_connections &&
(max_user_connections <= (uint) uc->connections)) (max_user_connections < (uint) uc->connections))
{ {
net_printf(&(current_thd->net),ER_TOO_MANY_USER_CONNECTIONS, uc->user); net_printf(&(current_thd->net),ER_TOO_MANY_USER_CONNECTIONS, uc->user);
error=1; error=1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment