Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
968e9a73
Commit
968e9a73
authored
Mar 15, 2003
by
monty@mashka.mysql.fi
Browse files
Options
Browse Files
Download
Plain Diff
merge with 3.23 to get:
- Fix for empty table/column names
parents
a6482b13
369da478
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
42 additions
and
20 deletions
+42
-20
mysql-test/t/create.test
mysql-test/t/create.test
+8
-0
sql/filesort.cc
sql/filesort.cc
+6
-10
sql/sql_parse.cc
sql/sql_parse.cc
+1
-2
sql/sql_table.cc
sql/sql_table.cc
+5
-6
sql/table.cc
sql/table.cc
+6
-1
tests/grant.pl
tests/grant.pl
+10
-0
tests/grant.res
tests/grant.res
+6
-1
No files found.
mysql-test/t/create.test
View file @
968e9a73
...
@@ -55,6 +55,14 @@ create table test_$1.test2$ (a int);
...
@@ -55,6 +55,14 @@ create table test_$1.test2$ (a int);
drop
table
test_
$
1.
test2
$
;
drop
table
test_
$
1.
test2
$
;
drop
database
test_
$
1
;
drop
database
test_
$
1
;
--
error
1103
create
table
``
(
a
int
);
--
error
1103
drop
table
if
exists
``
;
--
error
1166
create
table
t1
(
``
int
);
drop
table
if
exists
t1
;
#
#
# Test of CREATE ... SELECT with indexes
# Test of CREATE ... SELECT with indexes
#
#
...
...
sql/filesort.cc
View file @
968e9a73
...
@@ -68,7 +68,7 @@ ha_rows filesort(TABLE *table, SORT_FIELD *sortorder, uint s_length,
...
@@ -68,7 +68,7 @@ ha_rows filesort(TABLE *table, SORT_FIELD *sortorder, uint s_length,
ha_rows
*
examined_rows
)
ha_rows
*
examined_rows
)
{
{
int
error
;
int
error
;
ulong
memavl
;
ulong
memavl
,
min_sort_memory
;
uint
maxbuffer
;
uint
maxbuffer
;
BUFFPEK
*
buffpek
;
BUFFPEK
*
buffpek
;
ha_rows
records
;
ha_rows
records
;
...
@@ -137,7 +137,8 @@ ha_rows filesort(TABLE *table, SORT_FIELD *sortorder, uint s_length,
...
@@ -137,7 +137,8 @@ ha_rows filesort(TABLE *table, SORT_FIELD *sortorder, uint s_length,
#endif
#endif
memavl
=
thd
->
variables
.
sortbuff_size
;
memavl
=
thd
->
variables
.
sortbuff_size
;
while
(
memavl
>=
MIN_SORT_MEMORY
)
min_sort_memory
=
max
(
MIN_SORT_MEMORY
,
param
.
sort_length
*
MERGEBUFF2
);
while
(
memavl
>=
min_sort_memory
)
{
{
ulong
old_memavl
;
ulong
old_memavl
;
ulong
keys
=
memavl
/
(
param
.
sort_length
+
sizeof
(
char
*
));
ulong
keys
=
memavl
/
(
param
.
sort_length
+
sizeof
(
char
*
));
...
@@ -146,15 +147,10 @@ ha_rows filesort(TABLE *table, SORT_FIELD *sortorder, uint s_length,
...
@@ -146,15 +147,10 @@ ha_rows filesort(TABLE *table, SORT_FIELD *sortorder, uint s_length,
MYF
(
0
))))
MYF
(
0
))))
break
;
break
;
old_memavl
=
memavl
;
old_memavl
=
memavl
;
if
((
memavl
=
memavl
/
4
*
3
)
<
MIN_SORT_MEMORY
&&
old_memavl
>
MIN_SORT_MEMORY
)
if
((
memavl
=
memavl
/
4
*
3
)
<
min_sort_memory
&&
old_memavl
>
min_sort_memory
)
memavl
=
MIN_SORT_MEMORY
;
memavl
=
min_sort_memory
;
}
}
if
(
memavl
<
param
.
sort_length
*
MERGEBUFF2
)
if
(
memavl
<
min_sort_memory
)
{
my_error
(
ER_OUT_OF_SORTMEMORY
,
MYF
(
0
));
goto
err
;
}
if
(
memavl
<
MIN_SORT_MEMORY
)
{
{
my_error
(
ER_OUTOFMEMORY
,
MYF
(
ME_ERROR
+
ME_WAITTANG
),
my_error
(
ER_OUTOFMEMORY
,
MYF
(
ME_ERROR
+
ME_WAITTANG
),
thd
->
variables
.
sortbuff_size
);
thd
->
variables
.
sortbuff_size
);
...
...
sql/sql_parse.cc
View file @
968e9a73
...
@@ -3218,8 +3218,7 @@ TABLE_LIST *add_table_to_list(Table_ident *table, LEX_STRING *alias,
...
@@ -3218,8 +3218,7 @@ TABLE_LIST *add_table_to_list(Table_ident *table, LEX_STRING *alias,
if
(
!
table
)
if
(
!
table
)
DBUG_RETURN
(
0
);
// End of memory
DBUG_RETURN
(
0
);
// End of memory
alias_str
=
alias
?
alias
->
str
:
table
->
table
.
str
;
alias_str
=
alias
?
alias
->
str
:
table
->
table
.
str
;
if
(
table
->
table
.
length
>
NAME_LEN
||
if
(
check_table_name
(
table
->
table
.
str
,
table
->
table
.
length
)
||
check_table_name
(
table
->
table
.
str
,
table
->
table
.
length
)
||
table
->
db
.
str
&&
check_db_name
(
table
->
db
.
str
))
table
->
db
.
str
&&
check_db_name
(
table
->
db
.
str
))
{
{
net_printf
(
&
thd
->
net
,
ER_WRONG_TABLE_NAME
,
table
->
table
.
str
);
net_printf
(
&
thd
->
net
,
ER_WRONG_TABLE_NAME
,
table
->
table
.
str
);
...
...
sql/sql_table.cc
View file @
968e9a73
...
@@ -394,6 +394,11 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
...
@@ -394,6 +394,11 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
}
}
if
(
!
(
sql_field
->
flags
&
NOT_NULL_FLAG
))
if
(
!
(
sql_field
->
flags
&
NOT_NULL_FLAG
))
null_fields
++
;
null_fields
++
;
if
(
check_column_name
(
sql_field
->
field_name
))
{
my_error
(
ER_WRONG_COLUMN_NAME
,
MYF
(
0
),
sql_field
->
field_name
);
DBUG_RETURN
(
-
1
);
}
while
((
dup_field
=
it2
++
)
!=
sql_field
)
while
((
dup_field
=
it2
++
)
!=
sql_field
)
{
{
if
(
my_strcasecmp
(
sql_field
->
field_name
,
dup_field
->
field_name
)
==
0
)
if
(
my_strcasecmp
(
sql_field
->
field_name
,
dup_field
->
field_name
)
==
0
)
...
@@ -830,12 +835,6 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
...
@@ -830,12 +835,6 @@ TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
while
((
item
=
it
++
))
while
((
item
=
it
++
))
{
{
create_field
*
cr_field
;
create_field
*
cr_field
;
if
(
strlen
(
item
->
name
)
>
NAME_LEN
||
check_column_name
(
item
->
name
))
{
my_error
(
ER_WRONG_COLUMN_NAME
,
MYF
(
0
),
item
->
name
);
DBUG_RETURN
(
0
);
}
Field
*
field
;
Field
*
field
;
if
(
item
->
type
()
==
Item
::
FUNC_ITEM
)
if
(
item
->
type
()
==
Item
::
FUNC_ITEM
)
field
=
item
->
tmp_table_field
(
&
tmp_table
);
field
=
item
->
tmp_table_field
(
&
tmp_table
);
...
...
sql/table.cc
View file @
968e9a73
...
@@ -1164,6 +1164,8 @@ bool check_db_name(char *name)
...
@@ -1164,6 +1164,8 @@ bool check_db_name(char *name)
bool
check_table_name
(
const
char
*
name
,
uint
length
)
bool
check_table_name
(
const
char
*
name
,
uint
length
)
{
{
const
char
*
end
=
name
+
length
;
const
char
*
end
=
name
+
length
;
if
(
!
length
||
length
>
NAME_LEN
)
return
1
;
while
(
name
!=
end
)
while
(
name
!=
end
)
{
{
...
@@ -1187,6 +1189,8 @@ bool check_table_name(const char *name, uint length)
...
@@ -1187,6 +1189,8 @@ bool check_table_name(const char *name, uint length)
bool
check_column_name
(
const
char
*
name
)
bool
check_column_name
(
const
char
*
name
)
{
{
const
char
*
start
=
name
;
while
(
*
name
)
while
(
*
name
)
{
{
#if defined(USE_MB) && defined(USE_MB_IDENT)
#if defined(USE_MB) && defined(USE_MB_IDENT)
...
@@ -1204,7 +1208,8 @@ bool check_column_name(const char *name)
...
@@ -1204,7 +1208,8 @@ bool check_column_name(const char *name)
return
1
;
return
1
;
name
++
;
name
++
;
}
}
return
0
;
/* Error if empty or too long column name */
return
(
name
==
start
||
(
uint
)
(
name
-
start
)
>
NAME_LEN
);
}
}
/*
/*
...
...
tests/grant.pl
View file @
968e9a73
...
@@ -210,6 +210,16 @@ user_query("delete from $opt_database.test where a=1",1);
...
@@ -210,6 +210,16 @@ user_query("delete from $opt_database.test where a=1",1);
user_query
("
update
$opt_database
.test set b=3 where b=1
",
1
);
user_query
("
update
$opt_database
.test set b=3 where b=1
",
1
);
user_query
("
update
$opt_database
.test set b=b+1
",
1
);
user_query
("
update
$opt_database
.test set b=b+1
",
1
);
#
# Test global SELECT privilege combined with table level privileges
#
safe_query
("
grant SELECT on *.* to
$user
");
user_connect
(
0
);
user_query
("
update
$opt_database
.test set b=b+1
");
safe_query
("
revoke SELECT on *.* from
$user
");
user_connect
(
0
);
# Add one privilege at a time until the user has all privileges
# Add one privilege at a time until the user has all privileges
user_query
("
select * from test
",
1
);
user_query
("
select * from test
",
1
);
safe_query
("
grant select on
$opt_database
.test to
$user
");
safe_query
("
grant select on
$opt_database
.test to
$user
");
...
...
tests/grant.res
View file @
968e9a73
...
@@ -195,7 +195,12 @@ update grant_test.test set b=3 where b=1
...
@@ -195,7 +195,12 @@ update grant_test.test set b=3 where b=1
Error in execute: SELECT command denied to user: 'grant_user@localhost' for column 'b' in table 'test'
Error in execute: SELECT command denied to user: 'grant_user@localhost' for column 'b' in table 'test'
update grant_test.test set b=b+1
update grant_test.test set b=b+1
Error in execute: SELECT command denied to user: 'grant_user@localhost' for column 'b' in table 'test'
Error in execute: SELECT command denied to user: 'grant_user@localhost' for column 'b' in table 'test'
select * from test
grant SELECT on *.* to grant_user@localhost
Connecting grant_user
update grant_test.test set b=b+1
revoke SELECT on *.* from grant_user@localhost
Connecting grant_user
lect * from test
Error in execute: select command denied to user: 'grant_user@localhost' for table 'test'
Error in execute: select command denied to user: 'grant_user@localhost' for table 'test'
grant select on grant_test.test to grant_user@localhost
grant select on grant_test.test to grant_user@localhost
delete from grant_test.test where a=1
delete from grant_test.test where a=1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment