Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xindoo
redis
提交
90fae58b
R
redis
项目概览
xindoo
/
redis
通知
2
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
redis
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
90fae58b
编写于
2月 04, 2020
作者:
A
antirez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ACL LOG: make max log entries configurable.
上级
64a73e92
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
19 addition
and
0 deletion
+19
-0
src/acl.c
src/acl.c
+6
-0
src/config.c
src/config.c
+1
-0
src/server.h
src/server.h
+1
-0
tests/unit/acl.tcl
tests/unit/acl.tcl
+11
-0
未找到文件。
src/acl.c
浏览文件 @
90fae58b
...
...
@@ -1576,6 +1576,12 @@ void addACLLogEntry(client *c, int reason, int keypos, sds username) {
/* Add it to our list of entires. We'll have to trim the list
* to its maximum size. */
listAddNodeHead
(
ACLLog
,
le
);
while
(
listLength
(
ACLLog
)
>
server
.
acllog_max_len
)
{
listNode
*
ln
=
listLast
(
ACLLog
);
ACLLogEntry
*
le
=
listNodeValue
(
ln
);
ACLFreeLogEntry
(
le
);
listDelNode
(
ACLLog
,
ln
);
}
}
}
...
...
src/config.c
浏览文件 @
90fae58b
...
...
@@ -2233,6 +2233,7 @@ standardConfig configs[] = {
/* Unsigned Long configs */
createULongConfig
(
"active-defrag-max-scan-fields"
,
NULL
,
MODIFIABLE_CONFIG
,
1
,
LONG_MAX
,
server
.
active_defrag_max_scan_fields
,
1000
,
INTEGER_CONFIG
,
NULL
,
NULL
),
/* Default: keys with more than 1000 fields will be processed separately */
createULongConfig
(
"slowlog-max-len"
,
NULL
,
MODIFIABLE_CONFIG
,
0
,
LONG_MAX
,
server
.
slowlog_max_len
,
128
,
INTEGER_CONFIG
,
NULL
,
NULL
),
createULongConfig
(
"acllog-max-len"
,
NULL
,
MODIFIABLE_CONFIG
,
0
,
LONG_MAX
,
server
.
acllog_max_len
,
128
,
INTEGER_CONFIG
,
NULL
,
NULL
),
/* Long Long configs */
createLongLongConfig
(
"lua-time-limit"
,
NULL
,
MODIFIABLE_CONFIG
,
0
,
LONG_MAX
,
server
.
lua_time_limit
,
5000
,
INTEGER_CONFIG
,
NULL
,
NULL
),
/* milliseconds */
...
...
src/server.h
浏览文件 @
90fae58b
...
...
@@ -1385,6 +1385,7 @@ struct redisServer {
dict
*
latency_events
;
/* ACLs */
char
*
acl_filename
;
/* ACL Users file. NULL if not configured. */
unsigned
long
acllog_max_len
;
/* Maximum length of the ACL LOG list. */
/* Assert & bug reporting */
const
char
*
assert_failed
;
const
char
*
assert_file
;
...
...
tests/unit/acl.tcl
浏览文件 @
90fae58b
...
...
@@ -237,4 +237,15 @@ start_server {tags {"acl"}} {
assert
{[
dict get $entry object
]
eq
{
AUTH
}}
assert
{[
dict get $entry username
]
eq
{
antirez
}}
}
test
{
ACL LOG entries are limited to a maximum amount
}
{
r ACL LOG RESET
r CONFIG SET acllog-max-len 5
r AUTH antirez foo
for
{
set j 0
}
{
$j
< 10
}
{
incr j
}
{
catch
{
r SET obj:$j 123
}
}
r AUTH default
""
assert
{[
llength
[
r ACL LOG
]]
== 5
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录