8 Star 0 Fork 5

src-anolis-os/glusterfs

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0038-spec-avoid-creation-of-temp-file-in-lua-script.patch 7.12 KB
一键复制 编辑 原始数据 按行查看 历史
张彬琛 提交于 2021-01-20 13:34 . import glusterfs-6.0-20.el8.src.rpm
From a577dd0a3cbf435681f10d095a0dca0595c6a354 Mon Sep 17 00:00:00 2001
From: Milind Changire <[email protected]>
Date: Sat, 9 Feb 2019 14:01:28 +0530
Subject: [PATCH 38/52] spec: avoid creation of temp file in lua script
Avoiding creation of temporary file to execute bash shell script from a
lua scriptlet increases install time security.
Label: DOWNSTREAM ONLY
Change-Id: Ie5b9035f292402b18dea768aca8bc82a1e7fa615
Signed-off-by: Milind Changire <[email protected]>
Reviewed-on: https://code.engineering.redhat.com/gerrit/162621
Tested-by: RHGS Build Bot <[email protected]>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <[email protected]>
---
glusterfs.spec.in | 120 ++++++------------------------------------------------
1 file changed, 12 insertions(+), 108 deletions(-)
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index 9db5a34..df8d116 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -1542,15 +1542,7 @@ if [ $? -eq 0 ]; then
fi
]]
--- Since we run pretrans scripts only for RPMs built for a server build,
--- we can now use os.tmpname() since it is available on RHEL6 and later
--- platforms which are server platforms.
-tmpname = os.tmpname()
-tmpfile = io.open(tmpname, "w")
-tmpfile:write(script)
-tmpfile:close()
-ok, how, val = os.execute("/bin/bash " .. tmpname)
-os.remove(tmpname)
+ok, how, val = os.execute(script)
if not (ok == 0) then
error("Detected running glusterfs processes", ok)
end
@@ -1584,15 +1576,7 @@ if [ $? -eq 0 ]; then
fi
]]
--- Since we run pretrans scripts only for RPMs built for a server build,
--- we can now use os.tmpname() since it is available on RHEL6 and later
--- platforms which are server platforms.
-tmpname = os.tmpname()
-tmpfile = io.open(tmpname, "w")
-tmpfile:write(script)
-tmpfile:close()
-ok, how, val = os.execute("/bin/bash " .. tmpname)
-os.remove(tmpname)
+ok, how, val = os.execute(script)
if not (ok == 0) then
error("Detected running glusterfs processes", ok)
end
@@ -1626,15 +1610,7 @@ if [ $? -eq 0 ]; then
fi
]]
--- Since we run pretrans scripts only for RPMs built for a server build,
--- we can now use os.tmpname() since it is available on RHEL6 and later
--- platforms which are server platforms.
-tmpname = os.tmpname()
-tmpfile = io.open(tmpname, "w")
-tmpfile:write(script)
-tmpfile:close()
-ok, how, val = os.execute("/bin/bash " .. tmpname)
-os.remove(tmpname)
+ok, how, val = os.execute(script)
if not (ok == 0) then
error("Detected running glusterfs processes", ok)
end
@@ -1668,15 +1644,7 @@ if [ $? -eq 0 ]; then
fi
]]
--- Since we run pretrans scripts only for RPMs built for a server build,
--- we can now use os.tmpname() since it is available on RHEL6 and later
--- platforms which are server platforms.
-tmpname = os.tmpname()
-tmpfile = io.open(tmpname, "w")
-tmpfile:write(script)
-tmpfile:close()
-ok, how, val = os.execute("/bin/bash " .. tmpname)
-os.remove(tmpname)
+ok, how, val = os.execute(script)
if not (ok == 0) then
error("Detected running glusterfs processes", ok)
end
@@ -1709,15 +1677,7 @@ if [ $? -eq 0 ]; then
fi
]]
--- Since we run pretrans scripts only for RPMs built for a server build,
--- we can now use os.tmpname() since it is available on RHEL6 and later
--- platforms which are server platforms.
-tmpname = os.tmpname()
-tmpfile = io.open(tmpname, "w")
-tmpfile:write(script)
-tmpfile:close()
-ok, how, val = os.execute("/bin/bash " .. tmpname)
-os.remove(tmpname)
+ok, how, val = os.execute(script)
if not (ok == 0) then
error("Detected running glusterfs processes", ok)
end
@@ -1750,15 +1710,7 @@ if [ $? -eq 0 ]; then
fi
]]
--- Since we run pretrans scripts only for RPMs built for a server build,
--- we can now use os.tmpname() since it is available on RHEL6 and later
--- platforms which are server platforms.
-tmpname = os.tmpname()
-tmpfile = io.open(tmpname, "w")
-tmpfile:write(script)
-tmpfile:close()
-ok, how, val = os.execute("/bin/bash " .. tmpname)
-os.remove(tmpname)
+ok, how, val = os.execute(script)
if not (ok == 0) then
error("Detected running glusterfs processes", ok)
end
@@ -1792,15 +1744,7 @@ if [ $? -eq 0 ]; then
fi
]]
--- Since we run pretrans scripts only for RPMs built for a server build,
--- we can now use os.tmpname() since it is available on RHEL6 and later
--- platforms which are server platforms.
-tmpname = os.tmpname()
-tmpfile = io.open(tmpname, "w")
-tmpfile:write(script)
-tmpfile:close()
-ok, how, val = os.execute("/bin/bash " .. tmpname)
-os.remove(tmpname)
+ok, how, val = os.execute(script)
if not (ok == 0) then
error("Detected running glusterfs processes", ok)
end
@@ -1835,15 +1779,7 @@ if [ $? -eq 0 ]; then
fi
]]
--- Since we run pretrans scripts only for RPMs built for a server build,
--- we can now use os.tmpname() since it is available on RHEL6 and later
--- platforms which are server platforms.
-tmpname = os.tmpname()
-tmpfile = io.open(tmpname, "w")
-tmpfile:write(script)
-tmpfile:close()
-ok, how, val = os.execute("/bin/bash " .. tmpname)
-os.remove(tmpname)
+ok, how, val = os.execute(script)
if not (ok == 0) then
error("Detected running glusterfs processes", ok)
end
@@ -1878,15 +1814,7 @@ if [ $? -eq 0 ]; then
fi
]]
--- Since we run pretrans scripts only for RPMs built for a server build,
--- we can now use os.tmpname() since it is available on RHEL6 and later
--- platforms which are server platforms.
-tmpname = os.tmpname()
-tmpfile = io.open(tmpname, "w")
-tmpfile:write(script)
-tmpfile:close()
-ok, how, val = os.execute("/bin/bash " .. tmpname)
-os.remove(tmpname)
+ok, how, val = os.execute(script)
if not (ok == 0) then
error("Detected running glusterfs processes", ok)
end
@@ -1921,15 +1849,7 @@ if [ $? -eq 0 ]; then
fi
]]
--- Since we run pretrans scripts only for RPMs built for a server build,
--- we can now use os.tmpname() since it is available on RHEL6 and later
--- platforms which are server platforms.
-tmpname = os.tmpname()
-tmpfile = io.open(tmpname, "w")
-tmpfile:write(script)
-tmpfile:close()
-ok, how, val = os.execute("/bin/bash " .. tmpname)
-os.remove(tmpname)
+ok, how, val = os.execute(script)
if not (ok == 0) then
error("Detected running glusterfs processes", ok)
end
@@ -1965,15 +1885,7 @@ if [ $? -eq 0 ]; then
fi
]]
--- Since we run pretrans scripts only for RPMs built for a server build,
--- we can now use os.tmpname() since it is available on RHEL6 and later
--- platforms which are server platforms.
-tmpname = os.tmpname()
-tmpfile = io.open(tmpname, "w")
-tmpfile:write(script)
-tmpfile:close()
-ok, how, val = os.execute("/bin/bash " .. tmpname)
-os.remove(tmpname)
+ok, how, val = os.execute(script)
if not (ok == 0) then
error("Detected running glusterfs processes", ok)
end
@@ -2008,15 +1920,7 @@ if [ $? -eq 0 ]; then
fi
]]
--- Since we run pretrans scripts only for RPMs built for a server build,
--- we can now use os.tmpname() since it is available on RHEL6 and later
--- platforms which are server platforms.
-tmpname = os.tmpname()
-tmpfile = io.open(tmpname, "w")
-tmpfile:write(script)
-tmpfile:close()
-ok, how, val = os.execute("/bin/bash " .. tmpname)
-os.remove(tmpname)
+ok, how, val = os.execute(script)
if not (ok == 0) then
error("Detected running glusterfs processes", ok)
end
--
1.8.3.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-anolis-os/glusterfs.git
[email protected]:src-anolis-os/glusterfs.git
src-anolis-os
glusterfs
glusterfs
a8

搜索帮助