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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
c45da992
Commit
c45da992
authored
Nov 25, 2009
by
Evgeny Potemkin
Browse files
Options
Browse Files
Download
Plain Diff
Auto-merge.
parents
0039944e
42fcc56f
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
75 additions
and
39 deletions
+75
-39
client/mysql.cc
client/mysql.cc
+1
-3
include/mysql.h
include/mysql.h
+0
-10
include/mysql.h.pp
include/mysql.h.pp
+0
-10
libmysql/libmysql.c
libmysql/libmysql.c
+0
-14
libmysql/libmysql.def
libmysql/libmysql.def
+0
-1
libmysqld/libmysqld.def
libmysqld/libmysqld.def
+0
-1
mysql-test/r/grant2.result
mysql-test/r/grant2.result
+27
-0
mysql-test/t/grant2.test
mysql-test/t/grant2.test
+35
-0
sql/sql_acl.cc
sql/sql_acl.cc
+7
-0
sql/sql_parse.cc
sql/sql_parse.cc
+5
-0
No files found.
client/mysql.cc
View file @
c45da992
...
...
@@ -4474,9 +4474,7 @@ server_version_string(MYSQL *con)
*/
if
(
server_version
==
NULL
)
{
server_version
=
strdup
(
mysql_get_server_info
(
con
));
}
server_version
=
my_strdup
(
mysql_get_server_info
(
con
),
MYF
(
MY_WME
));
}
return
server_version
?
server_version
:
""
;
...
...
include/mysql.h
View file @
c45da992
...
...
@@ -557,16 +557,6 @@ unsigned long STDCALL mysql_real_escape_string(MYSQL *mysql,
char
*
to
,
const
char
*
from
,
unsigned
long
length
);
void
STDCALL
mysql_debug
(
const
char
*
debug
);
char
*
STDCALL
mysql_odbc_escape_string
(
MYSQL
*
mysql
,
char
*
to
,
unsigned
long
to_length
,
const
char
*
from
,
unsigned
long
from_length
,
void
*
param
,
char
*
(
*
extend_buffer
)
(
void
*
,
char
*
to
,
unsigned
long
*
length
));
void
STDCALL
myodbc_remove_escape
(
MYSQL
*
mysql
,
char
*
name
);
unsigned
int
STDCALL
mysql_thread_safe
(
void
);
my_bool
STDCALL
mysql_embedded
(
void
);
...
...
include/mysql.h.pp
View file @
c45da992
...
...
@@ -518,16 +518,6 @@ unsigned long mysql_real_escape_string(MYSQL *mysql,
char
*
to
,
const
char
*
from
,
unsigned
long
length
);
void
mysql_debug
(
const
char
*
debug
);
char
*
mysql_odbc_escape_string
(
MYSQL
*
mysql
,
char
*
to
,
unsigned
long
to_length
,
const
char
*
from
,
unsigned
long
from_length
,
void
*
param
,
char
*
(
*
extend_buffer
)
(
void
*
,
char
*
to
,
unsigned
long
*
length
));
void
myodbc_remove_escape
(
MYSQL
*
mysql
,
char
*
name
);
unsigned
int
mysql_thread_safe
(
void
);
my_bool
mysql_embedded
(
void
);
...
...
libmysql/libmysql.c
View file @
c45da992
...
...
@@ -1629,20 +1629,6 @@ mysql_real_escape_string(MYSQL *mysql, char *to,const char *from,
return
(
uint
)
escape_string_for_mysql
(
mysql
->
charset
,
to
,
0
,
from
,
length
);
}
char
*
STDCALL
mysql_odbc_escape_string
(
MYSQL
*
mysql
__attribute__
((
unused
)),
char
*
to
__attribute__
((
unused
)),
ulong
to_length
__attribute__
((
unused
)),
const
char
*
from
__attribute__
((
unused
)),
ulong
from_length
__attribute__
((
unused
)),
void
*
param
__attribute__
((
unused
)),
char
*
(
*
extend_buffer
)(
void
*
,
char
*
,
ulong
*
)
__attribute__
((
unused
)))
{
return
NULL
;
}
void
STDCALL
myodbc_remove_escape
(
MYSQL
*
mysql
,
char
*
name
)
{
...
...
libmysql/libmysql.def
View file @
c45da992
...
...
@@ -78,7 +78,6 @@ EXPORTS
mysql_next_result
mysql_num_fields
mysql_num_rows
mysql_odbc_escape_string
mysql_options
mysql_stmt_param_count
mysql_stmt_param_metadata
...
...
libmysqld/libmysqld.def
View file @
c45da992
...
...
@@ -50,7 +50,6 @@ EXPORTS
mysql_next_result
mysql_num_fields
mysql_num_rows
mysql_odbc_escape_string
mysql_options
mysql_ping
mysql_query
...
...
mysql-test/r/grant2.result
View file @
c45da992
...
...
@@ -443,3 +443,30 @@ DROP TABLE db1.t1, db1.t2;
DROP USER mysqltest1@localhost;
DROP DATABASE db1;
End of 5.0 tests
USE mysql;
SELECT LEFT(CURRENT_USER(),INSTR(CURRENT_USER(),'@')-1) INTO @u;
SELECT MID(CURRENT_USER(),INSTR(CURRENT_USER(),'@')+1) INTO @h;
SELECT password FROM user WHERE user=@u AND host=@h INTO @pwd;
SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h;
user host password insert_priv
root localhost Y
UPDATE user SET insert_priv='N' WHERE user=@u AND host=@h;
SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h;
user host password insert_priv
root localhost N
GRANT INSERT ON *.* TO CURRENT_USER();
SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h;
user host password insert_priv
root localhost Y
UPDATE user SET insert_priv='N' WHERE user=@u AND host=@h;
GRANT INSERT ON *.* TO CURRENT_USER() IDENTIFIED BY 'keksdose';
SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h;
user host password insert_priv
root localhost *0BB7188CF0DE9B403BA66E9DD810D82652D002EB Y
UPDATE user SET password=@pwd WHERE user=@u AND host=@h;
SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h;
user host password insert_priv
root localhost Y
FLUSH PRIVILEGES;
USE test;
End of 5.1 tests
mysql-test/t/grant2.test
View file @
c45da992
...
...
@@ -632,5 +632,40 @@ DROP DATABASE db1;
--
echo
End
of
5.0
tests
#
# Bug #48319: Server crashes on "GRANT/REVOKE ... TO CURRENT_USER"
#
# work out who we are.
USE
mysql
;
SELECT
LEFT
(
CURRENT_USER
(),
INSTR
(
CURRENT_USER
(),
'@'
)
-
1
)
INTO
@
u
;
SELECT
MID
(
CURRENT_USER
(),
INSTR
(
CURRENT_USER
(),
'@'
)
+
1
)
INTO
@
h
;
SELECT
password
FROM
user
WHERE
user
=@
u
AND
host
=@
h
INTO
@
pwd
;
# show current privs.
SELECT
user
,
host
,
password
,
insert_priv
FROM
user
WHERE
user
=@
u
AND
host
=@
h
;
# toggle INSERT
UPDATE
user
SET
insert_priv
=
'N'
WHERE
user
=@
u
AND
host
=@
h
;
SELECT
user
,
host
,
password
,
insert_priv
FROM
user
WHERE
user
=@
u
AND
host
=@
h
;
# show that GRANT ... TO CURRENT_USER() no longer crashes
GRANT
INSERT
ON
*.*
TO
CURRENT_USER
();
SELECT
user
,
host
,
password
,
insert_priv
FROM
user
WHERE
user
=@
u
AND
host
=@
h
;
UPDATE
user
SET
insert_priv
=
'N'
WHERE
user
=@
u
AND
host
=@
h
;
# show that GRANT ... TO CURRENT_USER() IDENTIFIED BY ... works now
GRANT
INSERT
ON
*.*
TO
CURRENT_USER
()
IDENTIFIED
BY
'keksdose'
;
SELECT
user
,
host
,
password
,
insert_priv
FROM
user
WHERE
user
=@
u
AND
host
=@
h
;
UPDATE
user
SET
password
=@
pwd
WHERE
user
=@
u
AND
host
=@
h
;
SELECT
user
,
host
,
password
,
insert_priv
FROM
user
WHERE
user
=@
u
AND
host
=@
h
;
FLUSH
PRIVILEGES
;
USE
test
;
--
echo
End
of
5.1
tests
# Wait till we reached the initial number of concurrent sessions
--
source
include
/
wait_until_count_sessions
.
inc
sql/sql_acl.cc
View file @
c45da992
...
...
@@ -3462,6 +3462,13 @@ bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
result
=
TRUE
;
continue
;
}
/*
No User, but a password?
They did GRANT ... TO CURRENT_USER() IDENTIFIED BY ... !
Get the current user, and shallow-copy the new password to them!
*/
if
(
!
tmp_Str
->
user
.
str
&&
tmp_Str
->
password
.
str
)
Str
->
password
=
tmp_Str
->
password
;
if
(
replace_user_table
(
thd
,
tables
[
0
].
table
,
*
Str
,
(
!
db
?
rights
:
0
),
revoke_grant
,
create_new_users
,
test
(
thd
->
variables
.
sql_mode
&
...
...
sql/sql_parse.cc
View file @
c45da992
...
...
@@ -7580,6 +7580,9 @@ void get_default_definer(THD *thd, LEX_USER *definer)
definer
->
host
.
str
=
(
char
*
)
sctx
->
priv_host
;
definer
->
host
.
length
=
strlen
(
definer
->
host
.
str
);
definer
->
password
.
str
=
NULL
;
definer
->
password
.
length
=
0
;
}
...
...
@@ -7631,6 +7634,8 @@ LEX_USER *create_definer(THD *thd, LEX_STRING *user_name, LEX_STRING *host_name)
definer
->
user
=
*
user_name
;
definer
->
host
=
*
host_name
;
definer
->
password
.
str
=
NULL
;
definer
->
password
.
length
=
0
;
return
definer
;
}
...
...
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