Skip to content
GitLab
项目
群组
代码片段
/
帮助
帮助
支持
社区论坛
快捷键
?
提交反馈
登录
切换导航
菜单
打开侧边栏
wazuh
Osquery
提交
47e1a5ba
提交
47e1a5ba
编辑于
8年前
作者:
Teddy Reed
提交者:
GitHub
8年前
浏览文件
操作
下载
电子邮件补丁
差异文件
Use noexcept boost::filesystem overloads (#2195)
上级
3472b7cc
变更
4
隐藏空白变更内容
行内
左右并排
显示
4 个更改的文件
osquery/config/plugins/filesystem.cpp
+6
-2
osquery/config/plugins/filesystem.cpp
osquery/core/watcher.cpp
+4
-2
osquery/core/watcher.cpp
osquery/filesystem/filesystem.cpp
+5
-3
osquery/filesystem/filesystem.cpp
osquery/filesystem/windows/fileops.cpp
+3
-2
osquery/filesystem/windows/fileops.cpp
有
18 个添加
和
9 个删除
+18
-9
osquery/config/plugins/filesystem.cpp
+
6
-
2
浏览文件 @
47e1a5ba
...
...
@@ -18,6 +18,7 @@
#include
<osquery/logger.h>
namespace
fs
=
boost
::
filesystem
;
namespace
errc
=
boost
::
system
::
errc
;
namespace
osquery
{
...
...
@@ -38,7 +39,9 @@ REGISTER(FilesystemConfigPlugin, "config", "filesystem");
Status
FilesystemConfigPlugin
::
genConfig
(
std
::
map
<
std
::
string
,
std
::
string
>&
config
)
{
if
(
!
fs
::
is_regular_file
(
FLAGS_config_path
))
{
boost
::
system
::
error_code
ec
;
if
(
!
fs
::
is_regular_file
(
FLAGS_config_path
,
ec
)
||
ec
.
value
()
!=
errc
::
success
)
{
return
Status
(
1
,
"config file does not exist: "
+
FLAGS_config_path
);
}
...
...
@@ -60,7 +63,8 @@ Status FilesystemConfigPlugin::genConfig(
Status
FilesystemConfigPlugin
::
genPack
(
const
std
::
string
&
name
,
const
std
::
string
&
value
,
std
::
string
&
pack
)
{
if
(
!
fs
::
is_regular_file
(
value
))
{
boost
::
system
::
error_code
ec
;
if
(
!
fs
::
is_regular_file
(
value
,
ec
)
||
ec
.
value
()
!=
errc
::
success
)
{
return
Status
(
1
,
value
+
" is not a valid path"
);
}
return
readFile
(
value
,
pack
);
...
...
This diff is collapsed.
Click to expand it.
osquery/core/watcher.cpp
+
4
-
2
浏览文件 @
47e1a5ba
...
...
@@ -349,7 +349,8 @@ void WatcherRunner::createWorker() {
}
// Get the complete path of the osquery process binary.
auto
exec_path
=
fs
::
system_complete
(
fs
::
path
(
qd
[
0
][
"path"
]));
boost
::
system
::
error_code
ec
;
auto
exec_path
=
fs
::
system_complete
(
fs
::
path
(
qd
[
0
][
"path"
]),
ec
);
if
(
!
safePermissions
(
exec_path
.
parent_path
().
string
(),
exec_path
.
string
(),
true
))
{
// osqueryd binary has become unsafe.
...
...
@@ -385,7 +386,8 @@ bool WatcherRunner::createExtension(const std::string& extension) {
}
// Check the path to the previously-discovered extension binary.
auto
exec_path
=
fs
::
system_complete
(
fs
::
path
(
extension
));
boost
::
system
::
error_code
ec
;
auto
exec_path
=
fs
::
system_complete
(
fs
::
path
(
extension
),
ec
);
if
(
!
safePermissions
(
exec_path
.
parent_path
().
string
(),
exec_path
.
string
(),
true
))
{
// Extension binary has become unsafe.
...
...
This diff is collapsed.
Click to expand it.
osquery/filesystem/filesystem.cpp
+
5
-
3
浏览文件 @
47e1a5ba
...
...
@@ -296,7 +296,8 @@ inline void replaceGlobWildcards(std::string& pattern, GlobLimits limits) {
(
pattern
.
size
()
>
3
&&
pattern
[
1
]
!=
':'
&&
pattern
[
2
]
!=
'\\'
&&
pattern
[
2
]
!=
'/'
)))
&&
pattern
[
0
]
!=
'~'
)
{
pattern
=
(
fs
::
initial_path
()
/
pattern
).
make_preferred
().
string
();
boost
::
system
::
error_code
ec
;
pattern
=
(
fs
::
current_path
(
ec
)
/
pattern
).
make_preferred
().
string
();
}
auto
base
=
...
...
@@ -443,8 +444,9 @@ const std::string& osqueryHomeDirectory() {
(
fs
::
path
(
*
home_directory
)
/
".osquery"
).
make_preferred
().
string
();
}
else
{
// Fail over to a temporary directory (used for the shell).
homedir
=
(
fs
::
temp_directory_path
()
/
"osquery"
).
make_preferred
().
string
();
boost
::
system
::
error_code
ec
;
auto
temp
=
fs
::
temp_directory_path
(
ec
);
homedir
=
(
temp
/
"osquery"
).
make_preferred
().
string
();
}
}
...
...
This diff is collapsed.
Click to expand it.
osquery/filesystem/windows/fileops.cpp
+
3
-
2
浏览文件 @
47e1a5ba
...
...
@@ -1046,7 +1046,7 @@ std::vector<std::string> platformGlob(const std::string &find_path) {
// going to append the component to the previous valid path and append
// the new path to the list
boost
::
system
::
error_code
ec
;
if
(
fs
::
exists
(
valid_path
/
component
)
&&
if
(
fs
::
exists
(
valid_path
/
component
,
ec
)
&&
ec
.
value
()
==
errc
::
success
)
{
tmp_valid_paths
.
push_back
(
valid_path
/
component
);
}
...
...
@@ -1174,7 +1174,8 @@ static bool dirPathsAreEqual(const fs::path &dir1, const fs::path &dir2) {
}
Status
platformIsTmpDir
(
const
fs
::
path
&
dir
)
{
if
(
!
dirPathsAreEqual
(
dir
,
fs
::
temp_directory_path
()))
{
boost
::
system
::
error_code
ec
;
if
(
!
dirPathsAreEqual
(
dir
,
fs
::
temp_directory_path
(
ec
)))
{
return
Status
(
1
,
"Not temp directory"
);
}
...
...
This diff is collapsed.
Click to expand it.
编辑
预览
支持
Markdown
0%
请重试
或
添加新附件
.
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录