several bug fixes

parent 9b35856c
......@@ -263,8 +263,10 @@ C_MODE_END
#endif
#ifdef HAVE_ATOMIC_ADD
#define __SMP__
#define CONFIG_SMP
#include <asm/atomic.h>
#ifndef CONFIG_SMP
#define CONFIG_SMP
#endif
#endif
#include <errno.h> /* Recommended by debian */
/* 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)
cs->to_lower=tmp_to_lower;
cs->to_upper=tmp_to_upper;
cs->sort_order=tmp_sort_order;
cs->strxfrm_multiply=cs->mbmaxlen=1;
if (read_charset_file(cs_number, cs, flags))
return NULL;
......
......@@ -2285,12 +2285,21 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list,
(!db ? rights : 0), revoke_grant,
create_new_users)))
result= -1;
else
else if (db)
{
ulong db_rights= rights & DB_ACLS;
if (db_rights == rights)
{
if (db && replace_db_table(tables[1].table, db, *Str, rights & DB_ACLS,
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;
}
}
}
VOID(pthread_mutex_unlock(&acl_cache->lock));
pthread_mutex_unlock(&LOCK_grant);
......
......@@ -257,10 +257,11 @@ static bool check_user(THD *thd,enum_server_command command, const char *user,
db ? db : (char*) "");
thd->db_access=0;
/* 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))
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))
return -1;
if (db && db[0])
......@@ -308,7 +309,7 @@ static int check_for_max_user_connections(USER_CONN *uc)
DBUG_ENTER("check_for_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);
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