1 Star 0 Fork 25

huanghaitao/libreswan

forked from src-openEuler/libreswan 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0001-fix-libselinux-deprecated.patch 2.66 KB
一键复制 编辑 原始数据 按行查看 历史
From 54b0f3bf7c87ccd8e9f7c74872371d571f0c118c Mon Sep 17 00:00:00 2001
From: si-gui <[email protected]>
Date: Tue, 15 Sep 2020 19:57:58 +0800
Subject: [PATCH] fix libselinux deprecated
Signed-off-by: si-gui <[email protected]>
---
contrib/labeled-ipsec/getpeercon_server.c | 4 ++--
programs/pluto/security_selinux.c | 7 ++-----
programs/pluto/security_selinux.h | 2 +-
3 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/contrib/labeled-ipsec/getpeercon_server.c b/contrib/labeled-ipsec/getpeercon_server.c
index 57a24d0..aa2e2b4 100644
--- a/contrib/labeled-ipsec/getpeercon_server.c
+++ b/contrib/labeled-ipsec/getpeercon_server.c
@@ -64,7 +64,7 @@ int main(int argc, char *argv[])
srv_sock_path = argv[1];
{
- security_context_t ctx;
+ char *ctx;
int rc = getcon(&ctx);
fprintf(stderr, "-> running as %s\n",
@@ -136,7 +136,7 @@ int main(int argc, char *argv[])
struct sockaddr_in6 *const cli_sock_6addr = (struct sockaddr_in6 *)&cli_sock_saddr;
socklen_t cli_sock_addr_len;
char cli_sock_addr_str[INET6_ADDRSTRLEN + 1];
- security_context_t ctx;
+ char *ctx;
char *ctx_str;
//fflush(stdout);
diff --git a/programs/pluto/security_selinux.c b/programs/pluto/security_selinux.c
index ac5028e..c09a2d0 100644
--- a/programs/pluto/security_selinux.c
+++ b/programs/pluto/security_selinux.c
@@ -27,13 +27,13 @@ void init_avc(void)
DBG_log("selinux support is enabled.");
}
- if (avc_init("libreswan", NULL, NULL, NULL, NULL) == 0)
+ if (avc_open(NULL, 0) == 0)
selinux_ready = 1;
else
DBG_log("selinux: could not initialize avc.");
}
-int within_range(security_context_t sl, security_context_t range)
+int within_range(char *sl, char *range)
{
int rtn = 1;
security_id_t slsid;
@@ -61,7 +61,6 @@ int within_range(security_context_t sl, security_context_t range)
if (rtn != 0) {
DBG_log("within_range: Unable to retrieve sid for range context (%s)",
range);
- sidput(slsid);
return 0;
}
@@ -74,8 +73,6 @@ int within_range(security_context_t sl, security_context_t range)
if (rtn != 0) {
DBG_log("within_range: The sl (%s) is not within range of (%s)", sl,
range);
- sidput(slsid);
- sidput(rangesid);
return 0;
}
DBG_log("within_range: The sl (%s) is within range of (%s)", sl,
diff --git a/programs/pluto/security_selinux.h b/programs/pluto/security_selinux.h
index cccd60f..7c07bd8 100644
--- a/programs/pluto/security_selinux.h
+++ b/programs/pluto/security_selinux.h
@@ -20,6 +20,6 @@
#include <selinux/context.h>
void init_avc(void);
-int within_range(security_context_t sl, security_context_t range);
+int within_range(char *sl, char *range);
#endif /* _SECURITY_SELINUX_H */
--
2.23.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hht8/libreswan.git
[email protected]:hht8/libreswan.git
hht8
libreswan
libreswan
master

搜索帮助