summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorjimw@mysql.com <>2005-02-18 12:47:33 -0800
committerjimw@mysql.com <>2005-02-18 12:47:33 -0800
commit5348bc99c1001d60cc732e0e3c6623c501599aee (patch)
tree5512a23c24f11ad2a531220b231fa30f446ff59b /sql
parenta6afab6a55026bf4d8fce13d5ab44decf92ffe68 (diff)
downloadmariadb-git-5348bc99c1001d60cc732e0e3c6623c501599aee.tar.gz
Clean up fix for Bug #7989 by avoiding extra memory copy, and adding some
more information to the error message.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_acl.cc22
1 files changed, 10 insertions, 12 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 92d6f471a1e..252a2af7134 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -202,18 +202,17 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables)
{
/*
We make a temporary copy of the database, force it to lower case,
- and then copy it back over the original name. We can't just update
- the host.db pointer, because tmp_name is allocated on the stack.
+ and then check it against the original name.
*/
- (void)strmov(tmp_name, host.db);
- my_casedn_str(files_charset_info, tmp_name);
+ (void)strnmov(tmp_name, host.db, sizeof(tmp_name));
+ my_casedn_str(files_charset_info, host.db);
if (strcmp(host.db, tmp_name) != 0)
{
sql_print_warning("'host' entry '%s|%s' had database in mixed "
"case that has been forced to lowercase because "
- "lower_case_table_names is set.",
+ "lower_case_table_names is set. It will not be "
+ "possible to remove this privilege using REVOKE.",
host.host.hostname, host.db);
- (void)strmov(host.db, tmp_name);
}
}
host.access= get_access(table,2);
@@ -403,18 +402,17 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables)
{
/*
We make a temporary copy of the database, force it to lower case,
- and then copy it back over the original name. We can't just update
- the db.db pointer, because tmp_name is allocated on the stack.
+ and then check it against the original name.
*/
- (void)strmov(tmp_name, db.db);
- my_casedn_str(files_charset_info, tmp_name);
+ (void)strnmov(tmp_name, db.db, sizeof(tmp_name));
+ my_casedn_str(files_charset_info, db.db);
if (strcmp(db.db, tmp_name) != 0)
{
sql_print_warning("'db' entry '%s %s@%s' had database in mixed "
"case that has been forced to lowercase because "
- "lower_case_table_names is set.",
+ "lower_case_table_names is set. It will not be "
+ "possible to remove this privilege using REVOKE.",
db.db, db.user, db.host.hostname, db.host.hostname);
- (void)strmov(db.db, tmp_name);
}
}
db.sort=get_sort(3,db.host.hostname,db.db,db.user);