Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
digest-list-tools
提交
7a68c9c3
D
digest-list-tools
项目概览
openeuler
/
digest-list-tools
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
digest-list-tools
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
7a68c9c3
编写于
8月 31, 2020
作者:
O
openeuler-ci-bot
提交者:
Gitee
8月 31, 2020
浏览文件
操作
浏览文件
下载
差异文件
!3 replace hard coded permission with DIGEST_LIST_MODE
Merge pull request !3 from nettingsisyphus/mycode
上级
b77b1227
1733980d
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
17 addition
and
16 deletion
+17
-16
generators/compact.c
generators/compact.c
+2
-2
generators/copy.c
generators/copy.c
+1
-1
generators/rpm.c
generators/rpm.c
+3
-3
generators/unknown.c
generators/unknown.c
+2
-2
include/compact_list.h
include/compact_list.h
+1
-0
lib/compact_list.c
lib/compact_list.c
+0
-1
lib/lib.c
lib/lib.c
+2
-1
src/manage_digest_lists.c
src/manage_digest_lists.c
+1
-1
src/write_rpm_pgp_sig.c
src/write_rpm_pgp_sig.c
+1
-1
tests/compact_tlv.c
tests/compact_tlv.c
+3
-3
tests/rpm.c
tests/rpm.c
+1
-1
未找到文件。
generators/compact.c
浏览文件 @
7a68c9c3
...
...
@@ -368,9 +368,9 @@ int generator(int dirfd, int pos, struct list_head *head_in,
}
if
(
!
gen_list_path
)
fd
=
openat
(
dirfd
,
filename
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
0644
);
fd
=
openat
(
dirfd
,
filename
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
DIGEST_LIST_MODE
);
else
fd
=
openat
(
-
1
,
gen_list_path
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
0644
);
fd
=
openat
(
-
1
,
gen_list_path
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
DIGEST_LIST_MODE
);
if
(
fd
<
0
)
{
printf
(
"Cannot open %s
\n
"
,
filename
);
ret
=
-
EACCES
;
...
...
generators/copy.c
浏览文件 @
7a68c9c3
...
...
@@ -51,7 +51,7 @@ int generator(int dirfd, int pos, struct list_head *head_in,
if
(
ret
<
0
)
goto
out
;
fd
=
openat
(
dirfd
,
filename
,
O_WRONLY
|
O_CREAT
,
0644
);
fd
=
openat
(
dirfd
,
filename
,
O_WRONLY
|
O_CREAT
,
DIGEST_LIST_MODE
);
if
(
fd
<
0
)
{
munmap
(
buf
,
size
);
ret
=
fd
;
...
...
generators/rpm.c
浏览文件 @
7a68c9c3
...
...
@@ -70,7 +70,7 @@ static int add_file(int dirfd, char *filename, Header *hdr, u16 type,
struct
list_struct
*
list
=
NULL
,
*
list_file
=
NULL
;
struct
stat
s
;
fd
=
openat
(
dirfd
,
filename
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
0644
);
fd
=
openat
(
dirfd
,
filename
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
DIGEST_LIST_MODE
);
if
(
fd
<
0
)
return
-
EACCES
;
...
...
@@ -342,7 +342,7 @@ static int gen_rpm_digest_list(Header rpm, int dirfd, char *filename,
ssize_t
ret
;
int
fd
;
fd
=
openat
(
dirfd
,
filename
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
0644
);
fd
=
openat
(
dirfd
,
filename
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
DIGEST_LIST_MODE
);
if
(
fd
<
0
)
return
-
EACCES
;
...
...
@@ -384,7 +384,7 @@ static int write_rpm_header_signature(Header rpm, int dirfd, char *filename)
write_ima_xattr
(
dirfd
,
filename
,
issuer
,
sizeof
(
uint32_t
),
sig
,
sig_len
,
pgp_algo_mapping
[
algo
]);
fd
=
openat
(
dirfd
,
filename
,
O_WRONLY
|
O_APPEND
,
0644
);
fd
=
openat
(
dirfd
,
filename
,
O_WRONLY
|
O_APPEND
,
DIGEST_LIST_MODE
);
if
(
fd
<
0
)
{
ret
=
-
EACCES
;
goto
out
;
...
...
generators/unknown.c
浏览文件 @
7a68c9c3
...
...
@@ -373,9 +373,9 @@ int generator(int dirfd, int pos, struct list_head *head_in,
tm
.
tm_mon
+
1
,
tm
.
tm_mday
,
tm
.
tm_hour
,
tm
.
tm_min
,
tm
.
tm_sec
);
fd
=
openat
(
dirfd
,
filename
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
0644
);
fd
=
openat
(
dirfd
,
filename
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
DIGEST_LIST_MODE
);
}
else
{
fd
=
openat
(
-
1
,
gen_list_path
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
0644
);
fd
=
openat
(
-
1
,
gen_list_path
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
DIGEST_LIST_MODE
);
}
if
(
fd
<
0
)
{
...
...
include/compact_list.h
浏览文件 @
7a68c9c3
...
...
@@ -19,6 +19,7 @@
#define COMPACT_LIST_SIZE_MAX 64 * 1024 * 1024 - 1
#define IMA_KEY_PATH "/etc/keys/x509_ima.der"
#define DIGEST_LIST_MODE 0644
enum
parser_ops
{
PARSER_OP_ADD_DIGEST
,
PARSER_OP_ADD_DIGEST_TO_HTABLE
,
PARSER_OP_ADD_META_DIGEST
,
...
...
lib/compact_list.c
浏览文件 @
7a68c9c3
...
...
@@ -37,7 +37,6 @@
#include "selinux.h"
#define DIGEST_LIST_LABEL "system_u:object_r:etc_t:s0"
#define DIGEST_LIST_MODE 0644
#define DIGEST_LIST_ALGO HASH_ALGO_SHA256
char
*
compact_types_str
[
COMPACT__LAST
]
=
{
...
...
lib/lib.c
浏览文件 @
7a68c9c3
...
...
@@ -26,6 +26,7 @@
#include <sys/xattr.h>
#include "lib.h"
#include "compact_list.h"
static
const
char
*
file_attrs_str
[
ATTR__LAST
]
=
{
[
ATTR_PATH
]
=
"path"
,
...
...
@@ -130,7 +131,7 @@ int copy_file(char *src, char *dest)
if
(
ret
<
0
)
return
ret
;
fd
=
open
(
dest
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
0644
);
fd
=
open
(
dest
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
DIGEST_LIST_MODE
);
if
(
fd
<
0
)
goto
out
;
...
...
src/manage_digest_lists.c
浏览文件 @
7a68c9c3
...
...
@@ -194,7 +194,7 @@ int main(int argc, char *argv[])
fd
=
init_digest_list_upload
(
&
mount_sysfs
,
&
mount_securityfs
);
else
fd
=
open
(
output
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
0644
);
fd
=
open
(
output
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
DIGEST_LIST_MODE
);
if
(
fd
<
0
)
{
ret
=
-
EACCES
;
...
...
src/write_rpm_pgp_sig.c
浏览文件 @
7a68c9c3
...
...
@@ -53,7 +53,7 @@ int main(int argc, char *argv[])
write_ima_xattr
(
-
1
,
argv
[
1
],
issuer
,
sizeof
(
uint32_t
),
sig
,
sig_len
,
pgp_algo_mapping
[
algo
]);
fd
=
openat
(
-
1
,
argv
[
1
],
O_WRONLY
|
O_APPEND
,
0644
);
fd
=
openat
(
-
1
,
argv
[
1
],
O_WRONLY
|
O_APPEND
,
DIGEST_LIST_MODE
);
if
(
fd
<
0
)
{
ret
=
-
EACCES
;
goto
out
;
...
...
tests/compact_tlv.c
浏览文件 @
7a68c9c3
...
...
@@ -130,7 +130,7 @@ static void test_compact_tlv_parser(void **state)
assert_return_code
(
dirfd
,
0
);
snprintf
(
path
,
sizeof
(
path
),
"I:%s"
,
NEW_FILE
);
fd
=
open
(
&
path
[
2
],
O_WRONLY
|
O_CREAT
,
0644
);
fd
=
open
(
&
path
[
2
],
O_WRONLY
|
O_CREAT
,
DIGEST_LIST_MODE
);
assert_return_code
(
fd
,
0
);
ret
=
write
(
fd
,
"0"
,
1
);
...
...
@@ -170,7 +170,7 @@ static void test_compact_tlv_parser(void **state)
assert_non_null
(
parser_lib
);
fd_compact_list
=
openat
(
dirfd
,
NEW_COMPACT_LIST
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
0644
);
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
DIGEST_LIST_MODE
);
assert_return_code
(
fd_compact_list
,
0
);
ret
=
((
parser_func
)
parser_lib
->
func
)(
fd_compact_list
,
&
list_head
,
...
...
@@ -196,7 +196,7 @@ static void test_compact_tlv_parser(void **state)
munmap
(
buf
,
size
);
fd_compact_list
=
openat
(
dirfd
,
NEW_COMPACT_LIST
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
0644
);
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
DIGEST_LIST_MODE
);
assert_return_code
(
fd_compact_list
,
0
);
ret
=
((
parser_func
)
parser_lib
->
func
)(
fd_compact_list
,
&
list_head
,
...
...
tests/rpm.c
浏览文件 @
7a68c9c3
...
...
@@ -152,7 +152,7 @@ static void test_rpm_parser(void **state)
assert_non_null
(
lib
);
fd_compact_list
=
openat
(
dirfd
,
NEW_COMPACT_LIST
,
O_WRONLY
|
O_CREAT
,
0644
);
DIGEST_LIST_MODE
);
assert_return_code
(
fd_compact_list
,
0
);
ret
=
read_file_from_path
(
dirfd
,
RPM_HEADER
,
&
buf
,
&
size
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录