提交 2afba3b0 编写于 作者: R Roberto Sassu

Extend write_rpm_pgp_sig to read signature from file

上级 77633e0b
......@@ -27,7 +27,7 @@ int main(int argc, char *argv[])
u16 algo;
int ret, fd;
if (argc != 3) {
if (argc < 3) {
printf("Missing argument\n");
return -EINVAL;
}
......@@ -41,6 +41,15 @@ int main(int argc, char *argv[])
if (ret < 0)
goto out;
if (argc == 4) {
free(sig);
ret = read_file_from_path(-1, argv[3], (void **)&sig,
(loff_t *)&sig_len);
if (ret < 0)
goto out;
}
write_ima_xattr(-1, argv[1], issuer, sizeof(uint32_t), sig, sig_len,
pgp_algo_mapping[algo]);
......@@ -55,6 +64,9 @@ int main(int argc, char *argv[])
out:
munmap(pgp_sig, pgp_sig_len);
free(data);
free(sig);
if (argc == 4)
munmap(sig, sig_len);
else
free(sig);
return ret;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册