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
d4dea98f
Commit
d4dea98f
authored
Jun 27, 2005
by
jimw@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix max_connections_per_hour handling when the global
max_user_connections is also set. (Bug #9947)
parent
2dcf451b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
12 deletions
+10
-12
sql/sql_parse.cc
sql/sql_parse.cc
+10
-12
No files found.
sql/sql_parse.cc
View file @
d4dea98f
...
@@ -136,7 +136,7 @@ static int get_or_create_user_conn(THD *thd, const char *user,
...
@@ -136,7 +136,7 @@ static int get_or_create_user_conn(THD *thd, const char *user,
const
char
*
host
,
const
char
*
host
,
USER_RESOURCES
*
mqh
)
USER_RESOURCES
*
mqh
)
{
{
int
return_val
=
0
;
int
return_val
=
0
;
uint
temp_len
,
user_len
;
uint
temp_len
,
user_len
;
char
temp_user
[
USERNAME_LENGTH
+
HOSTNAME_LENGTH
+
2
];
char
temp_user
[
USERNAME_LENGTH
+
HOSTNAME_LENGTH
+
2
];
struct
user_conn
*
uc
;
struct
user_conn
*
uc
;
...
@@ -144,7 +144,7 @@ static int get_or_create_user_conn(THD *thd, const char *user,
...
@@ -144,7 +144,7 @@ static int get_or_create_user_conn(THD *thd, const char *user,
DBUG_ASSERT
(
user
!=
0
);
DBUG_ASSERT
(
user
!=
0
);
DBUG_ASSERT
(
host
!=
0
);
DBUG_ASSERT
(
host
!=
0
);
user_len
=
strlen
(
user
);
user_len
=
strlen
(
user
);
temp_len
=
(
strmov
(
strmov
(
temp_user
,
user
)
+
1
,
host
)
-
temp_user
)
+
1
;
temp_len
=
(
strmov
(
strmov
(
temp_user
,
user
)
+
1
,
host
)
-
temp_user
)
+
1
;
(
void
)
pthread_mutex_lock
(
&
LOCK_user_conn
);
(
void
)
pthread_mutex_lock
(
&
LOCK_user_conn
);
if
(
!
(
uc
=
(
struct
user_conn
*
)
hash_search
(
&
hash_user_connections
,
if
(
!
(
uc
=
(
struct
user_conn
*
)
hash_search
(
&
hash_user_connections
,
...
@@ -156,25 +156,23 @@ static int get_or_create_user_conn(THD *thd, const char *user,
...
@@ -156,25 +156,23 @@ static int get_or_create_user_conn(THD *thd, const char *user,
MYF
(
MY_WME
)))))
MYF
(
MY_WME
)))))
{
{
send_error
(
thd
,
0
,
NullS
);
// Out of memory
send_error
(
thd
,
0
,
NullS
);
// Out of memory
return_val
=
1
;
return_val
=
1
;
goto
end
;
goto
end
;
}
}
uc
->
user
=
(
char
*
)
(
uc
+
1
);
uc
->
user
=
(
char
*
)
(
uc
+
1
);
memcpy
(
uc
->
user
,
temp_user
,
temp_len
+
1
);
memcpy
(
uc
->
user
,
temp_user
,
temp_len
+
1
);
uc
->
user_len
=
user_len
;
uc
->
user_len
=
user_len
;
uc
->
host
=
uc
->
user
+
uc
->
user_len
+
1
;
uc
->
host
=
uc
->
user
+
uc
->
user_len
+
1
;
uc
->
len
=
temp_len
;
uc
->
len
=
temp_len
;
uc
->
connections
=
1
;
uc
->
connections
=
0
;
uc
->
questions
=
uc
->
updates
=
uc
->
conn_per_hour
=
0
;
uc
->
questions
=
uc
->
updates
=
uc
->
conn_per_hour
=
0
;
uc
->
user_resources
=*
mqh
;
uc
->
user_resources
=
*
mqh
;
if
(
max_user_connections
&&
mqh
->
connections
>
max_user_connections
)
uc
->
intime
=
thd
->
thr_create_time
;
uc
->
user_resources
.
connections
=
max_user_connections
;
uc
->
intime
=
thd
->
thr_create_time
;
if
(
my_hash_insert
(
&
hash_user_connections
,
(
byte
*
)
uc
))
if
(
my_hash_insert
(
&
hash_user_connections
,
(
byte
*
)
uc
))
{
{
my_free
((
char
*
)
uc
,
0
);
my_free
((
char
*
)
uc
,
0
);
send_error
(
thd
,
0
,
NullS
);
// Out of memory
send_error
(
thd
,
0
,
NullS
);
// Out of memory
return_val
=
1
;
return_val
=
1
;
goto
end
;
goto
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