Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
iSulad
提交
94f07690
I
iSulad
项目概览
openeuler
/
iSulad
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
iSulad
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
94f07690
编写于
3月 03, 2020
作者:
L
LiFeng
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
iSulad: make network config file to 0644
Signed-off-by:
N
LiFeng
<
lifeng68@huawei.com
>
上级
7d45f00b
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
22 addition
and
20 deletion
+22
-20
src/connect/client/grpc/client_base.h
src/connect/client/grpc/client_base.h
+1
-1
src/constants.h
src/constants.h
+2
-0
src/cutils/utils_file.c
src/cutils/utils_file.c
+4
-4
src/cutils/utils_file.h
src/cutils/utils_file.h
+2
-2
src/runtime/isula/isula_rt_ops.c
src/runtime/isula/isula_rt_ops.c
+2
-2
src/services/cri/cni_network_plugin.cc
src/services/cri/cni_network_plugin.cc
+1
-1
src/services/cri/cri_sandbox.cc
src/services/cri/cri_sandbox.cc
+1
-1
src/services/execution/execute/execution_network.c
src/services/execution/execute/execution_network.c
+7
-7
src/services/execution/spec/specs.c
src/services/execution/spec/specs.c
+1
-1
test/services/execution/spec/selinux_label_mock_llt.cc
test/services/execution/spec/selinux_label_mock_llt.cc
+1
-1
未找到文件。
src/connect/client/grpc/client_base.h
浏览文件 @
94f07690
...
...
@@ -196,7 +196,7 @@ protected:
// Set common name from cert.perm
char
common_name_value
[
ClientBaseConstants
::
COMMON_NAME_LEN
]
=
{
0
};
int
ret
=
get_common_name_from_tls_cert
(
m_certFile
.
c_str
(),
common_name_value
,
ClientBaseConstants
::
COMMON_NAME_LEN
);
ClientBaseConstants
::
COMMON_NAME_LEN
);
if
(
ret
!=
0
)
{
ERROR
(
"Failed to get common name in: %s"
,
m_certFile
.
c_str
());
return
-
1
;
...
...
src/constants.h
浏览文件 @
94f07690
...
...
@@ -46,6 +46,8 @@
#define DEBUG_DIRECTORY_MODE 0750
#define NETWORK_MOUNT_FILE_MODE 0644
#define ISULAD_CONFIG "/etc/isulad"
#define ISULAD_DAEMON_JSON_CONF_FILE ISULAD_CONFIG "/daemon.json"
...
...
src/cutils/utils_file.c
浏览文件 @
94f07690
...
...
@@ -822,7 +822,7 @@ free_out:
return
ret
;
}
int
util_write_file
(
const
char
*
fname
,
const
char
*
content
,
size_t
content_len
)
int
util_write_file
(
const
char
*
fname
,
const
char
*
content
,
size_t
content_len
,
mode_t
mode
)
{
int
ret
=
0
;
int
dst_fd
=
-
1
;
...
...
@@ -834,7 +834,7 @@ int util_write_file(const char *fname, const char *content, size_t content_len)
if
(
content
==
NULL
||
content_len
==
0
)
{
return
0
;
}
dst_fd
=
util_open
(
fname
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
DEFAULT_SECURE_FILE_MODE
);
dst_fd
=
util_open
(
fname
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
mode
);
if
(
dst_fd
<
0
)
{
ERROR
(
"Creat file: %s, failed: %s"
,
fname
,
strerror
(
errno
));
ret
=
-
1
;
...
...
@@ -877,7 +877,7 @@ char *verify_file_and_get_real_path(const char *file)
return
util_strdup_s
(
resolved_path
);
}
int
util_copy_file
(
const
char
*
src_file
,
const
char
*
dst_file
)
int
util_copy_file
(
const
char
*
src_file
,
const
char
*
dst_file
,
mode_t
mode
)
{
#define BUFSIZE 4096
int
ret
=
0
;
...
...
@@ -902,7 +902,7 @@ int util_copy_file(const char *src_file, const char *dst_file)
ret
=
-
1
;
goto
free_out
;
}
dst_fd
=
util_open
(
dst_file
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
DEFAULT_SECURE_FILE_MODE
);
dst_fd
=
util_open
(
dst_file
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
mode
);
if
(
dst_fd
<
0
)
{
ERROR
(
"Creat file: %s, failed: %s"
,
dst_file
,
strerror
(
errno
));
ret
=
-
1
;
...
...
src/cutils/utils_file.h
浏览文件 @
94f07690
...
...
@@ -69,11 +69,11 @@ int util_file2str(const char *filename, char *buf, size_t len);
char
*
look_path
(
const
char
*
file
,
char
**
err
);
int
util_write_file
(
const
char
*
fname
,
const
char
*
content
,
size_t
content_len
);
int
util_write_file
(
const
char
*
fname
,
const
char
*
content
,
size_t
content_len
,
mode_t
mode
);
char
*
verify_file_and_get_real_path
(
const
char
*
file
);
int
util_copy_file
(
const
char
*
src_file
,
const
char
*
dst_file
);
int
util_copy_file
(
const
char
*
src_file
,
const
char
*
dst_file
,
mode_t
mode
);
#ifdef __cplusplus
}
...
...
src/runtime/isula/isula_rt_ops.c
浏览文件 @
94f07690
...
...
@@ -60,7 +60,7 @@ static int file_write_int(const char *fname, int val)
return
-
1
;
}
if
(
util_write_file
(
fname
,
sint
,
strlen
(
sint
))
<
0
)
{
if
(
util_write_file
(
fname
,
sint
,
strlen
(
sint
)
,
DEFAULT_SECURE_FILE_MODE
)
<
0
)
{
return
-
1
;
}
...
...
@@ -188,7 +188,7 @@ static int create_process_json_file(const char *workdir, const shim_client_proce
goto
out
;
}
if
(
util_write_file
(
fname
,
data
,
strlen
(
data
))
!=
0
)
{
if
(
util_write_file
(
fname
,
data
,
strlen
(
data
)
,
DEFAULT_SECURE_FILE_MODE
)
!=
0
)
{
retcode
=
-
1
;
ERROR
(
"failed write process.json"
);
goto
out
;
...
...
src/services/cri/cni_network_plugin.cc
浏览文件 @
94f07690
...
...
@@ -33,7 +33,7 @@ static std::string VendorCNIDir(const std::string &prefix, const std::string &pl
static
std
::
unique_ptr
<
CNINetwork
>
GetLoNetwork
(
const
std
::
string
&
binDir
,
const
std
::
string
&
vendorDirPrefix
)
{
const
std
::
string
loNetConfListJson
{
"{
\"
cniVersion
\"
:
\"
0.3.0
\"
,
\"
name
\"
:
\"
cni-loopback
\"
,"
"
\"
plugins
\"
:[{
\"
type
\"
:
\"
loopback
\"
}]}"
};
"
\"
plugins
\"
:[{
\"
type
\"
:
\"
loopback
\"
}]}"
};
char
*
cerr
{
nullptr
};
struct
cni_network_list_conf
*
loConf
{
...
...
src/services/cri/cri_sandbox.cc
浏览文件 @
94f07690
...
...
@@ -307,7 +307,7 @@ void CRIRuntimeServiceImpl::SetupSandboxFiles(const std::string &resolvPath,
if
(
!
resolvContentStrs
.
empty
())
{
std
::
string
resolvContent
=
CXXUtils
::
StringsJoin
(
resolvContentStrs
,
"
\n
"
)
+
"
\n
"
;
if
(
util_write_file
(
resolvPath
.
c_str
(),
resolvContent
.
c_str
(),
resolvContent
.
size
())
!=
0
)
{
if
(
util_write_file
(
resolvPath
.
c_str
(),
resolvContent
.
c_str
(),
resolvContent
.
size
()
,
DEFAULT_SECURE_FILE_MODE
)
!=
0
)
{
error
.
SetError
(
"Failed to write resolv content"
);
}
}
...
...
src/services/execution/execute/execution_network.c
浏览文件 @
94f07690
...
...
@@ -48,7 +48,7 @@ static int write_hostname_to_file(const char *rootfs, const char *hostname)
goto
error_out
;
}
if
(
hostname
!=
NULL
)
{
ret
=
util_write_file
(
file_path
,
hostname
,
strlen
(
hostname
));
ret
=
util_write_file
(
file_path
,
hostname
,
strlen
(
hostname
)
,
NETWORK_MOUNT_FILE_MODE
);
if
(
ret
)
{
SYSERROR
(
"Failed to write %s"
,
file_path
);
isulad_set_error_message
(
"Failed to write %s: %s"
,
file_path
,
strerror
(
errno
));
...
...
@@ -140,7 +140,7 @@ static int write_content_to_file(const char *file_path, const char *content)
int
ret
=
0
;
if
(
content
!=
NULL
)
{
ret
=
util_write_file
(
file_path
,
content
,
strlen
(
content
));
ret
=
util_write_file
(
file_path
,
content
,
strlen
(
content
)
,
NETWORK_MOUNT_FILE_MODE
);
if
(
ret
!=
0
)
{
SYSERROR
(
"Failed to write file %s"
,
file_path
);
isulad_set_error_message
(
"Failed to write file %s: %s"
,
file_path
,
strerror
(
errno
));
...
...
@@ -869,7 +869,7 @@ static int create_default_hostname(const char *id, const char *rootpath, bool sh
}
if
(
util_write_file
(
file_path
,
hostname_content
,
strlen
(
hostname_content
))
!=
0
)
{
if
(
util_write_file
(
file_path
,
hostname_content
,
strlen
(
hostname_content
)
,
NETWORK_MOUNT_FILE_MODE
)
!=
0
)
{
ERROR
(
"Failed to create default hostname"
);
ret
=
-
1
;
goto
out
;
...
...
@@ -915,7 +915,7 @@ static int write_default_hosts(const char *file_path, const char *hostname)
goto
out_free
;
}
ret
=
util_write_file
(
file_path
,
content
,
strlen
(
content
));
ret
=
util_write_file
(
file_path
,
content
,
strlen
(
content
)
,
NETWORK_MOUNT_FILE_MODE
);
if
(
ret
!=
0
)
{
ret
=
-
1
;
goto
out_free
;
...
...
@@ -941,7 +941,7 @@ static int create_default_hosts(const char *id, const char *rootpath, bool share
}
if
(
share_host
&&
util_file_exists
(
ETC_HOSTS
))
{
ret
=
util_copy_file
(
ETC_HOSTS
,
file_path
);
ret
=
util_copy_file
(
ETC_HOSTS
,
file_path
,
NETWORK_MOUNT_FILE_MODE
);
}
else
{
ret
=
write_default_hosts
(
file_path
,
v2_spec
->
config
->
hostname
);
}
...
...
@@ -962,7 +962,7 @@ static int write_default_resolve(const char *file_path)
{
const
char
*
default_ipv4_dns
=
"
\n
nameserver 8.8.8.8
\n
nameserver 8.8.4.4
\n
"
;;
return
util_write_file
(
file_path
,
default_ipv4_dns
,
strlen
(
default_ipv4_dns
));
return
util_write_file
(
file_path
,
default_ipv4_dns
,
strlen
(
default_ipv4_dns
)
,
NETWORK_MOUNT_FILE_MODE
);
}
static
int
create_default_resolv
(
const
char
*
id
,
const
char
*
rootpath
,
container_config_v2_common_config
*
v2_spec
)
...
...
@@ -978,7 +978,7 @@ static int create_default_resolv(const char *id, const char *rootpath, container
}
if
(
util_file_exists
(
RESOLV_CONF_PATH
))
{
ret
=
util_copy_file
(
RESOLV_CONF_PATH
,
file_path
);
ret
=
util_copy_file
(
RESOLV_CONF_PATH
,
file_path
,
NETWORK_MOUNT_FILE_MODE
);
}
else
{
ret
=
write_default_resolve
(
file_path
);
}
...
...
src/services/execution/spec/specs.c
浏览文件 @
94f07690
...
...
@@ -2167,7 +2167,7 @@ int save_oci_config(const char *id, const char *rootpath, const oci_runtime_spec
goto
out_free
;
}
if
(
util_write_file
(
file_path
,
json_container
,
strlen
(
json_container
))
!=
0
)
{
if
(
util_write_file
(
file_path
,
json_container
,
strlen
(
json_container
)
,
DEFAULT_SECURE_FILE_MODE
)
!=
0
)
{
ERROR
(
"write json container failed: %s"
,
strerror
(
errno
));
ret
=
-
1
;
goto
out_free
;
...
...
test/services/execution/spec/selinux_label_mock_llt.cc
浏览文件 @
94f07690
...
...
@@ -56,7 +56,7 @@ TEST_F(SELinuxGetEnableUnitTest, test_selinux_get_enable_normal)
const
uint32_t
selinuxfsMagic
=
0xf97cff8c
;
struct
statfs
sfbuf
{
.
f_type
=
selinuxfsMagic
,
.
f_flags
=
0
.
f_flags
=
0
};
EXPECT_CALL
(
m_syscall
,
Statfs
(
_
,
_
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录