diff options
author | serg@serg.mylan <> | 2003-10-24 23:27:21 +0200 |
---|---|---|
committer | serg@serg.mylan <> | 2003-10-24 23:27:21 +0200 |
commit | c752d2cad0672a69945972166b2830da94827a3e (patch) | |
tree | b8897b47e2ad7d929f25f6603752d75cbe47ed29 /sql/sql_acl.cc | |
parent | 6457b89948c034aa7a65407555d2db73e9ab56fb (diff) | |
download | mariadb-git-c752d2cad0672a69945972166b2830da94827a3e.tar.gz |
removed one more hack that - as usual - almost always worked
(but broke permission handling for *some* IP's after we started to compare in utf8)
Bug #1636
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r-- | sql/sql_acl.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index a27dd3999fe..b8423fc6b7a 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -52,7 +52,8 @@ static byte* acl_entry_get_key(acl_entry *entry,uint *length, return (byte*) entry->key; } -#define ACL_KEY_LENGTH (sizeof(long)+NAME_LEN+USERNAME_LENGTH+1) +#define IP_ADDR_STRLEN +#define ACL_KEY_LENGTH (IP_ADDR_STRLEN+1+NAME_LEN+1+USERNAME_LENGTH+1) static DYNAMIC_ARRAY acl_hosts,acl_users,acl_dbs; static MEM_ROOT mem, memex; @@ -909,7 +910,7 @@ static void acl_insert_db(const char *user, const char *host, const char *db, Get privilege for a host, user and db combination */ -ulong acl_get(const char *host, const char *ip, const char *bin_ip, +ulong acl_get(const char *host, const char *ip, const char *user, const char *db, my_bool db_is_pattern) { ulong host_access,db_access; @@ -919,8 +920,7 @@ ulong acl_get(const char *host, const char *ip, const char *bin_ip, acl_entry *entry; VOID(pthread_mutex_lock(&acl_cache->lock)); - memcpy_fixed(&key,bin_ip,sizeof(struct in_addr)); - end=strmov((tmp_db=strmov(key+sizeof(struct in_addr),user)+1),db); + end=strmov((tmp_db=strmov(strmov(key, ip ? ip : "")+1,user)+1),db); if (lower_case_table_names) { my_casedn_str(&my_charset_latin1, tmp_db); @@ -1331,7 +1331,7 @@ static bool test_if_create_new_users(THD *thd) bzero((char*) &tl,sizeof(tl)); tl.db= (char*) "mysql"; tl.real_name= (char*) "user"; - db_access=acl_get(thd->host, thd->ip, (char*) &thd->remote.sin_addr, + db_access=acl_get(thd->host, thd->ip, thd->priv_user, tl.db, 0); if (!(db_access & INSERT_ACL)) { |