diff options
author | unknown <serg@serg.mylan> | 2005-03-26 19:46:42 +0100 |
---|---|---|
committer | unknown <serg@serg.mylan> | 2005-03-26 19:46:42 +0100 |
commit | 7f7f4f30b383f98a0d6327d7ec3399035757f279 (patch) | |
tree | 0b5649d7f02826f731642141dbe964360536a02a | |
parent | c5ad0fc0ce717485d64d684586f7ed9e62b1a63c (diff) | |
download | mariadb-git-7f7f4f30b383f98a0d6327d7ec3399035757f279.tar.gz |
fixes for "backport wild_compare fix from 4.1 - bug#3924"
sql/sql_acl.cc:
don't use acl_cache for GRANT
sql/sql_parse.cc:
fixed backporting error in "backport wild_compare fix from 4.1 - bug#3924"
-rw-r--r-- | sql/sql_acl.cc | 8 | ||||
-rw-r--r-- | sql/sql_parse.cc | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index c883407970a..acdd07b2fc5 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -855,6 +855,9 @@ static void acl_insert_db(const char *user, const char *host, const char *db, /* Get privilege for a host, user and db combination + + as db_is_pattern changes the semantics of comparison, + acl_cache is not used if db_is_pattern is set. */ ulong acl_get(const char *host, const char *ip, const char *bin_ip, @@ -875,7 +878,7 @@ ulong acl_get(const char *host, const char *ip, const char *bin_ip, db=tmp_db; } key_length=(uint) (end-key); - if ((entry=(acl_entry*) acl_cache->search(key,key_length))) + if (!db_is_pattern && (entry=(acl_entry*) acl_cache->search(key,key_length))) { db_access=entry->access; VOID(pthread_mutex_unlock(&acl_cache->lock)); @@ -923,7 +926,8 @@ ulong acl_get(const char *host, const char *ip, const char *bin_ip, } exit: /* Save entry in cache for quick retrieval */ - if ((entry= (acl_entry*) malloc(sizeof(acl_entry)+key_length))) + if (!db_is_pattern && + (entry= (acl_entry*) malloc(sizeof(acl_entry)+key_length))) { entry->access=(db_access & host_access); entry->length=key_length; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 613484ebf50..7d48489bf71 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -2727,7 +2727,7 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv, if (!(thd->master_access & SELECT_ACL) && (db && (!thd->db || strcmp(db,thd->db)))) db_access=acl_get(thd->host, thd->ip, (char*) &thd->remote.sin_addr, - thd->priv_user, db, 0); /* purecov: inspected */ + thd->priv_user, db, test(want_access & GRANT_ACL)); *save_priv=thd->master_access | db_access; DBUG_RETURN(FALSE); } @@ -2747,7 +2747,7 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv, if (db && (!thd->db || strcmp(db,thd->db))) db_access=acl_get(thd->host, thd->ip, (char*) &thd->remote.sin_addr, - thd->priv_user, db, 0); /* purecov: inspected */ + thd->priv_user, db, test(want_access & GRANT_ACL)); else db_access=thd->db_access; // Remove SHOW attribute and access rights we already have |