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
22b171d3
Commit
22b171d3
authored
Jan 09, 2021
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-17852 Altered connection limits for user have no effect
update mqh in struct user_conn after taking it from the cache
parent
fc0d9a47
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
1 deletion
+54
-1
mysql-test/r/user_limits.result
mysql-test/r/user_limits.result
+27
-0
mysql-test/t/user_limits.test
mysql-test/t/user_limits.test
+26
-0
sql/sql_connect.cc
sql/sql_connect.cc
+1
-1
No files found.
mysql-test/r/user_limits.result
View file @
22b171d3
...
@@ -186,3 +186,30 @@ connection default;
...
@@ -186,3 +186,30 @@ connection default;
drop user mysqltest_1@localhost;
drop user mysqltest_1@localhost;
drop table t1;
drop table t1;
set global max_user_connections= @my_max_user_connections;
set global max_user_connections= @my_max_user_connections;
#
# End of 10.1 tests
#
#
# MDEV-17852 Altered connection limits for user have no effect
#
create user foo@'%' with max_user_connections 1;
connect con1,localhost,foo;
select current_user();
current_user()
foo@%
connect(localhost,foo,,test,MYSQL_PORT,MYSQL_SOCK);
connect con2,localhost,foo;
ERROR 42000: User 'foo' has exceeded the 'max_user_connections' resource (current value: 1)
connection default;
alter user foo with max_user_connections 2;
connect con3,localhost,foo;
select current_user();
current_user()
foo@%
disconnect con3;
disconnect con1;
connection default;
drop user foo@'%';
#
# End of 10.2 tests
#
mysql-test/t/user_limits.test
View file @
22b171d3
...
@@ -216,3 +216,29 @@ drop table t1;
...
@@ -216,3 +216,29 @@ drop table t1;
--
source
include
/
wait_until_count_sessions
.
inc
--
source
include
/
wait_until_count_sessions
.
inc
set
global
max_user_connections
=
@
my_max_user_connections
;
set
global
max_user_connections
=
@
my_max_user_connections
;
--
echo
#
--
echo
# End of 10.1 tests
--
echo
#
--
echo
#
--
echo
# MDEV-17852 Altered connection limits for user have no effect
--
echo
#
create
user
foo
@
'%'
with
max_user_connections
1
;
--
connect
con1
,
localhost
,
foo
select
current_user
();
--
replace_result
$MASTER_MYPORT
MYSQL_PORT
$MASTER_MYSOCK
MYSQL_SOCK
--
error
ER_USER_LIMIT_REACHED
--
connect
con2
,
localhost
,
foo
--
connection
default
alter
user
foo
with
max_user_connections
2
;
--
connect
con3
,
localhost
,
foo
select
current_user
();
--
disconnect
con3
--
disconnect
con1
--
connection
default
drop
user
foo
@
'%'
;
--
echo
#
--
echo
# End of 10.2 tests
--
echo
#
sql/sql_connect.cc
View file @
22b171d3
...
@@ -85,7 +85,6 @@ int get_or_create_user_conn(THD *thd, const char *user,
...
@@ -85,7 +85,6 @@ int get_or_create_user_conn(THD *thd, const char *user,
uc
->
host
=
uc
->
user
+
user_len
+
1
;
uc
->
host
=
uc
->
user
+
user_len
+
1
;
uc
->
len
=
temp_len
;
uc
->
len
=
temp_len
;
uc
->
connections
=
uc
->
questions
=
uc
->
updates
=
uc
->
conn_per_hour
=
0
;
uc
->
connections
=
uc
->
questions
=
uc
->
updates
=
uc
->
conn_per_hour
=
0
;
uc
->
user_resources
=
*
mqh
;
uc
->
reset_utime
=
thd
->
thr_create_utime
;
uc
->
reset_utime
=
thd
->
thr_create_utime
;
if
(
my_hash_insert
(
&
hash_user_connections
,
(
uchar
*
)
uc
))
if
(
my_hash_insert
(
&
hash_user_connections
,
(
uchar
*
)
uc
))
{
{
...
@@ -95,6 +94,7 @@ int get_or_create_user_conn(THD *thd, const char *user,
...
@@ -95,6 +94,7 @@ int get_or_create_user_conn(THD *thd, const char *user,
goto
end
;
goto
end
;
}
}
}
}
uc
->
user_resources
=
*
mqh
;
thd
->
user_connect
=
uc
;
thd
->
user_connect
=
uc
;
uc
->
connections
++
;
uc
->
connections
++
;
end:
end:
...
...
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