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
d0cea95f
Commit
d0cea95f
authored
Jun 25, 2002
by
Sinisa@sinisa.nasamreza.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for a user management system that resources can be reset to zero
with a GRANT statement.
parent
66e1777a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
8 deletions
+11
-8
sql/sql_acl.cc
sql/sql_acl.cc
+6
-6
sql/sql_parse.cc
sql/sql_parse.cc
+1
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+3
-0
sql/structs.h
sql/structs.h
+1
-1
No files found.
sql/sql_acl.cc
View file @
d0cea95f
...
@@ -652,11 +652,11 @@ static void acl_update_user(const char *user, const char *host,
...
@@ -652,11 +652,11 @@ static void acl_update_user(const char *user, const char *host,
acl_user
->
host
.
hostname
&&
!
strcmp
(
host
,
acl_user
->
host
.
hostname
))
acl_user
->
host
.
hostname
&&
!
strcmp
(
host
,
acl_user
->
host
.
hostname
))
{
{
acl_user
->
access
=
privileges
;
acl_user
->
access
=
privileges
;
if
(
mqh
->
questions
)
if
(
mqh
->
bits
&
1
)
acl_user
->
user_resource
.
questions
=
mqh
->
questions
;
acl_user
->
user_resource
.
questions
=
mqh
->
questions
;
if
(
mqh
->
updates
)
if
(
mqh
->
bits
&
2
)
acl_user
->
user_resource
.
updates
=
mqh
->
updates
;
acl_user
->
user_resource
.
updates
=
mqh
->
updates
;
if
(
mqh
->
connections
)
if
(
mqh
->
bits
&
4
)
acl_user
->
user_resource
.
connections
=
mqh
->
connections
;
acl_user
->
user_resource
.
connections
=
mqh
->
connections
;
#ifdef HAVE_OPENSSL
#ifdef HAVE_OPENSSL
acl_user
->
ssl_type
=
ssl_type
;
acl_user
->
ssl_type
=
ssl_type
;
...
@@ -1300,11 +1300,11 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
...
@@ -1300,11 +1300,11 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
#endif
/* HAVE_OPENSSL */
#endif
/* HAVE_OPENSSL */
USER_RESOURCES
mqh
=
thd
->
lex
.
mqh
;
USER_RESOURCES
mqh
=
thd
->
lex
.
mqh
;
if
(
mqh
.
questions
)
if
(
mqh
.
bits
&
1
)
table
->
field
[
28
]
->
store
((
longlong
)
mqh
.
questions
);
table
->
field
[
28
]
->
store
((
longlong
)
mqh
.
questions
);
if
(
mqh
.
updates
)
if
(
mqh
.
bits
&
2
)
table
->
field
[
29
]
->
store
((
longlong
)
mqh
.
updates
);
table
->
field
[
29
]
->
store
((
longlong
)
mqh
.
updates
);
if
(
mqh
.
connections
)
if
(
mqh
.
bits
&
4
)
table
->
field
[
30
]
->
store
((
longlong
)
mqh
.
connections
);
table
->
field
[
30
]
->
store
((
longlong
)
mqh
.
connections
);
mqh_used
=
mqh_used
||
mqh
.
questions
||
mqh
.
updates
||
mqh
.
connections
;
mqh_used
=
mqh_used
||
mqh
.
questions
||
mqh
.
updates
||
mqh
.
connections
;
}
}
...
...
sql/sql_parse.cc
View file @
d0cea95f
...
@@ -392,7 +392,7 @@ static void reset_mqh(THD *thd, LEX_USER *lu, bool get_them=false)
...
@@ -392,7 +392,7 @@ static void reset_mqh(THD *thd, LEX_USER *lu, bool get_them=false)
if
(
lu
)
// for GRANT
if
(
lu
)
// for GRANT
{
{
USER_CONN
*
uc
;
USER_CONN
*
uc
;
volatile
uint
temp_len
=
lu
->
user
.
length
+
lu
->
host
.
length
+
2
;
uint
temp_len
=
lu
->
user
.
length
+
lu
->
host
.
length
+
2
;
char
temp_user
[
USERNAME_LENGTH
+
HOSTNAME_LENGTH
+
2
];
char
temp_user
[
USERNAME_LENGTH
+
HOSTNAME_LENGTH
+
2
];
memcpy
(
temp_user
,
lu
->
user
.
str
,
lu
->
user
.
length
);
memcpy
(
temp_user
,
lu
->
user
.
str
,
lu
->
user
.
length
);
...
...
sql/sql_yacc.yy
View file @
d0cea95f
...
@@ -3669,14 +3669,17 @@ grant_option:
...
@@ -3669,14 +3669,17 @@ grant_option:
| MAX_QUERIES_PER_HOUR ULONG_NUM
| MAX_QUERIES_PER_HOUR ULONG_NUM
{
{
Lex->mqh.questions=$2;
Lex->mqh.questions=$2;
Lex->mqh.bits |= 1;
}
}
| MAX_UPDATES_PER_HOUR ULONG_NUM
| MAX_UPDATES_PER_HOUR ULONG_NUM
{
{
Lex->mqh.updates=$2;
Lex->mqh.updates=$2;
Lex->mqh.bits |= 2;
}
}
| MAX_CONNECTIONS_PER_HOUR ULONG_NUM
| MAX_CONNECTIONS_PER_HOUR ULONG_NUM
{
{
Lex->mqh.connections=$2;
Lex->mqh.connections=$2;
Lex->mqh.bits |= 4;
};
};
begin:
begin:
...
...
sql/structs.h
View file @
d0cea95f
...
@@ -163,7 +163,7 @@ typedef struct st_lex_user {
...
@@ -163,7 +163,7 @@ typedef struct st_lex_user {
typedef
struct
user_resources
{
typedef
struct
user_resources
{
uint
questions
,
updates
,
connections
;
uint
questions
,
updates
,
connections
,
bits
;
}
USER_RESOURCES
;
}
USER_RESOURCES
;
typedef
struct
user_conn
{
typedef
struct
user_conn
{
...
...
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