summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2005-03-30 10:43:24 +0200
committerunknown <serg@serg.mylan>2005-03-30 10:43:24 +0200
commitfe811dd892f2301f6787033f16e84c3a4412eab2 (patch)
tree49f077ee8da873b4987045a84b1e000d6ad4acb4 /sql
parent606ee28d2a34159295a5f587d306f684fb68e27b (diff)
downloadmariadb-git-fe811dd892f2301f6787033f16e84c3a4412eab2.tar.gz
don't strcmp db if it's a pattern
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_parse.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 7d48489bf71..8f56b7cfcff 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2704,6 +2704,7 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
DBUG_PRINT("enter",("want_access: %lu master_access: %lu", want_access,
thd->master_access));
ulong db_access,dummy;
+ bool db_is_pattern= test(want_access & GRANT_ACL);
if (save_priv)
*save_priv=0;
else
@@ -2725,9 +2726,9 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
*/
db_access= thd->db_access;
if (!(thd->master_access & SELECT_ACL) &&
- (db && (!thd->db || strcmp(db,thd->db))))
+ (db && (!thd->db || db_is_pattern || strcmp(db,thd->db))))
db_access=acl_get(thd->host, thd->ip, (char*) &thd->remote.sin_addr,
- thd->priv_user, db, test(want_access & GRANT_ACL));
+ thd->priv_user, db, db_is_pattern);
*save_priv=thd->master_access | db_access;
DBUG_RETURN(FALSE);
}
@@ -2745,9 +2746,9 @@ check_access(THD *thd, ulong want_access, const char *db, ulong *save_priv,
if (db == any_db)
DBUG_RETURN(FALSE); // Allow select on anything
- if (db && (!thd->db || strcmp(db,thd->db)))
+ if (db && (!thd->db || db_is_pattern || strcmp(db,thd->db)))
db_access=acl_get(thd->host, thd->ip, (char*) &thd->remote.sin_addr,
- thd->priv_user, db, test(want_access & GRANT_ACL));
+ thd->priv_user, db, db_is_pattern);
else
db_access=thd->db_access;
// Remove SHOW attribute and access rights we already have