Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
07ba7ffe
C
ClickHouse
项目概览
2dot5
/
ClickHouse
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
ClickHouse
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
07ba7ffe
编写于
6月 14, 2020
作者:
A
Alexey Milovidov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Clear password from command line #11624
上级
561d4b5b
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
31 addition
and
1 deletion
+31
-1
programs/benchmark/Benchmark.cpp
programs/benchmark/Benchmark.cpp
+4
-1
programs/client/Client.cpp
programs/client/Client.cpp
+2
-0
src/Common/clearPasswordFromCommandLine.cpp
src/Common/clearPasswordFromCommandLine.cpp
+18
-0
src/Common/clearPasswordFromCommandLine.h
src/Common/clearPasswordFromCommandLine.h
+6
-0
src/Common/ya.make
src/Common/ya.make
+1
-0
未找到文件。
programs/benchmark/Benchmark.cpp
浏览文件 @
07ba7ffe
...
...
@@ -18,6 +18,7 @@
#include <Common/ConcurrentBoundedQueue.h>
#include <Common/Exception.h>
#include <Common/randomSeed.h>
#include <Common/clearPasswordFromCommandLine.h>
#include <Core/Types.h>
#include <IO/ReadBufferFromFileDescriptor.h>
#include <IO/WriteBufferFromFileDescriptor.h>
...
...
@@ -539,7 +540,7 @@ int mainEntryClickHouseBenchmark(int argc, char ** argv)
(
"password"
,
value
<
std
::
string
>
()
->
default_value
(
""
),
""
)
(
"database"
,
value
<
std
::
string
>
()
->
default_value
(
"default"
),
""
)
(
"stacktrace"
,
"print stack traces of exceptions"
)
(
"confidence"
,
value
<
size_t
>
()
->
default_value
(
5
),
"set the level of confidence for T-test [0=80%, 1=90%, 2=95%, 3=98%, 4=99%, 5=99.5%(default)"
)
(
"confidence"
,
value
<
size_t
>
()
->
default_value
(
5
),
"set the level of confidence for T-test [0=80%, 1=90%, 2=95%, 3=98%, 4=99%, 5=99.5%(default)"
)
(
"query_id"
,
value
<
std
::
string
>
()
->
default_value
(
""
),
""
)
;
...
...
@@ -550,6 +551,8 @@ int mainEntryClickHouseBenchmark(int argc, char ** argv)
boost
::
program_options
::
store
(
boost
::
program_options
::
parse_command_line
(
argc
,
argv
,
desc
),
options
);
boost
::
program_options
::
notify
(
options
);
clearPasswordFromCommandLine
(
argc
,
argv
);
if
(
options
.
count
(
"help"
))
{
std
::
cout
<<
"Usage: "
<<
argv
[
0
]
<<
" [options] < queries.txt
\n
"
;
...
...
programs/client/Client.cpp
浏览文件 @
07ba7ffe
...
...
@@ -38,6 +38,7 @@
#include <Common/Throttler.h>
#include <Common/StringUtils/StringUtils.h>
#include <Common/typeid_cast.h>
#include <Common/clearPasswordFromCommandLine.h>
#include <Common/Config/ConfigProcessor.h>
#include <Core/Types.h>
#include <Core/QueryProcessingStage.h>
...
...
@@ -2006,6 +2007,7 @@ public:
argsToConfig
(
common_arguments
,
config
(),
100
);
clearPasswordFromCommandLine
(
argc
,
argv
);
}
};
...
...
src/Common/clearPasswordFromCommandLine.cpp
0 → 100644
浏览文件 @
07ba7ffe
#include <string.h>
#include "clearPasswordFromCommandLine.h"
void
clearPasswordFromCommandLine
(
int
argc
,
char
**
argv
)
{
for
(
int
arg
=
1
;
arg
<
argc
;
++
arg
)
{
if
(
arg
+
1
<
argc
&&
0
==
strcmp
(
argv
[
arg
],
"--password"
))
{
++
arg
;
memset
(
argv
[
arg
],
0
,
strlen
(
argv
[
arg
]));
}
else
if
(
0
==
strncmp
(
argv
[
arg
],
"--password="
,
strlen
(
"--password="
)))
{
memset
(
argv
[
arg
]
+
strlen
(
"--password="
),
0
,
strlen
(
argv
[
arg
])
-
strlen
(
"--password="
));
}
}
}
src/Common/clearPasswordFromCommandLine.h
0 → 100644
浏览文件 @
07ba7ffe
#pragma once
/** If there are --password=... or --password ... arguments in command line, replace their values with zero bytes.
* This is needed to prevent password exposure in 'ps' and similar tools.
*/
void
clearPasswordFromCommandLine
(
int
argc
,
char
**
argv
);
src/Common/ya.make
浏览文件 @
07ba7ffe
...
...
@@ -30,6 +30,7 @@ SRCS(
Config/configReadClient.cpp
Config/ConfigReloader.cpp
createHardLink.cpp
clearPasswordFromCommandLine.cpp
CurrentMetrics.cpp
CurrentThread.cpp
DNSResolver.cpp
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录