Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
c82ccf06
Commit
c82ccf06
authored
Feb 05, 2020
by
Oran Agra
Committed by
antirez
Feb 12, 2020
Browse files
memoryGetKeys helper function so that ACL can limit access to keys for MEMORY command
parent
51c1a9f8
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/db.c
View file @
c82ccf06
...
@@ -1522,6 +1522,22 @@ int *georadiusGetKeys(struct redisCommand *cmd, robj **argv, int argc, int *numk
...
@@ -1522,6 +1522,22 @@ int *georadiusGetKeys(struct redisCommand *cmd, robj **argv, int argc, int *numk
return
keys
;
return
keys
;
}
}
/* Helper function to extract keys from memory command.
* MEMORY USAGE <key> */
int
*
memoryGetKeys
(
struct
redisCommand
*
cmd
,
robj
**
argv
,
int
argc
,
int
*
numkeys
)
{
int
*
keys
;
UNUSED
(
cmd
);
if
(
argc
>=
3
&&
!
strcasecmp
(
argv
[
1
]
->
ptr
,
"usage"
))
{
keys
=
zmalloc
(
sizeof
(
int
)
*
1
);
keys
[
0
]
=
2
;
*
numkeys
=
1
;
return
keys
;
}
*
numkeys
=
0
;
return
NULL
;
}
/* XREAD [BLOCK <milliseconds>] [COUNT <count>] [GROUP <groupname> <ttl>]
/* XREAD [BLOCK <milliseconds>] [COUNT <count>] [GROUP <groupname> <ttl>]
* STREAMS key_1 key_2 ... key_N ID_1 ID_2 ... ID_N */
* STREAMS key_1 key_2 ... key_N ID_1 ID_2 ... ID_N */
int
*
xreadGetKeys
(
struct
redisCommand
*
cmd
,
robj
**
argv
,
int
argc
,
int
*
numkeys
)
{
int
*
xreadGetKeys
(
struct
redisCommand
*
cmd
,
robj
**
argv
,
int
argc
,
int
*
numkeys
)
{
...
...
src/server.c
View file @
c82ccf06
...
@@ -817,7 +817,7 @@ struct redisCommand redisCommandTable[] = {
...
@@ -817,7 +817,7 @@ struct redisCommand redisCommandTable[] = {
{
"memory"
,
memoryCommand
,
-
2
,
{
"memory"
,
memoryCommand
,
-
2
,
"random read-only"
,
"random read-only"
,
0
,
NULL
,
0
,
0
,
0
,
0
,
0
,
0
},
0
,
memoryGetKeys
,
0
,
0
,
0
,
0
,
0
,
0
},
{
"client"
,
clientCommand
,
-
2
,
{
"client"
,
clientCommand
,
-
2
,
"admin no-script random @connection"
,
"admin no-script random @connection"
,
...
...
src/server.h
View file @
c82ccf06
...
@@ -2077,6 +2077,7 @@ int *sortGetKeys(struct redisCommand *cmd, robj **argv, int argc, int *numkeys);
...
@@ -2077,6 +2077,7 @@ int *sortGetKeys(struct redisCommand *cmd, robj **argv, int argc, int *numkeys);
int
*
migrateGetKeys
(
struct
redisCommand
*
cmd
,
robj
**
argv
,
int
argc
,
int
*
numkeys
);
int
*
migrateGetKeys
(
struct
redisCommand
*
cmd
,
robj
**
argv
,
int
argc
,
int
*
numkeys
);
int
*
georadiusGetKeys
(
struct
redisCommand
*
cmd
,
robj
**
argv
,
int
argc
,
int
*
numkeys
);
int
*
georadiusGetKeys
(
struct
redisCommand
*
cmd
,
robj
**
argv
,
int
argc
,
int
*
numkeys
);
int
*
xreadGetKeys
(
struct
redisCommand
*
cmd
,
robj
**
argv
,
int
argc
,
int
*
numkeys
);
int
*
xreadGetKeys
(
struct
redisCommand
*
cmd
,
robj
**
argv
,
int
argc
,
int
*
numkeys
);
int
*
memoryGetKeys
(
struct
redisCommand
*
cmd
,
robj
**
argv
,
int
argc
,
int
*
numkeys
);
/* Cluster */
/* Cluster */
void
clusterInit
(
void
);
void
clusterInit
(
void
);
...
...
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