mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: ptxdist@pengutronix.de
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Subject: [ptxdist] [PATCH] scripts/lib/ptxd_make: fix image root permission, don't leak user's umask
Date: Wed,  8 Mar 2017 12:23:05 +0100	[thread overview]
Message-ID: <20170308112305.12046-1-mkl@pengutronix.de> (raw)

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 scripts/lib/ptxd_make_image_genimage.sh         | 2 +-
 scripts/lib/ptxd_make_image_prepare_work_dir.sh | 2 +-
 scripts/lib/ptxd_make_xpkg_prepare.sh           | 5 +++--
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/scripts/lib/ptxd_make_image_genimage.sh b/scripts/lib/ptxd_make_image_genimage.sh
index 2112875e4f4d..b4a8e9de222e 100644
--- a/scripts/lib/ptxd_make_image_genimage.sh
+++ b/scripts/lib/ptxd_make_image_genimage.sh
@@ -56,7 +56,7 @@ ptxd_make_image_genimage_impl() {
     ptxd_make_image_genimage_config "${1}" &&
 
     rm -rf "${pkg_dir}" &&
-    mkdir -p "${pkg_dir}" &&
+    install -m 755 -d "${pkg_dir}" &&
     for file in ${image_files}; do
 	ptxd_make_extract_archive "${file}" "${pkg_dir}"
     done &&
diff --git a/scripts/lib/ptxd_make_image_prepare_work_dir.sh b/scripts/lib/ptxd_make_image_prepare_work_dir.sh
index 2b8f10a81a1d..84a6ca8dbcae 100644
--- a/scripts/lib/ptxd_make_image_prepare_work_dir.sh
+++ b/scripts/lib/ptxd_make_image_prepare_work_dir.sh
@@ -51,7 +51,7 @@ ${list[*]}
     fi
 
     rm -rf "${work_dir}" &&
-    mkdir -p "${work_dir}" &&
+    install -m 755 -d "${work_dir}" &&
 
     ARCH="${PTXDIST_IPKG_ARCH_STRING}" \
     SRC="" \
diff --git a/scripts/lib/ptxd_make_xpkg_prepare.sh b/scripts/lib/ptxd_make_xpkg_prepare.sh
index 5619373045d3..f473375e7f78 100644
--- a/scripts/lib/ptxd_make_xpkg_prepare.sh
+++ b/scripts/lib/ptxd_make_xpkg_prepare.sh
@@ -58,7 +58,7 @@ ptxd_make_xpkg_prepare() {
 	"${pkg_xpkg_cmds}" \
 	"${pkg_xpkg_perms}" \
 	"${pkg_xpkg_install_deps}" &&
-    mkdir -p -- "${pkg_xpkg_control_dir}" &&
+    install -m 755 -d -- "${pkg_xpkg_control_dir}" &&
     touch "${pkg_xpkg_perms}" &&
     touch "${pkg_xpkg_cmds}" || return
 
@@ -82,7 +82,8 @@ install_init:	@DEPENDS@ -> ${dep}"
 	VERSION="${pkg_xpkg_version}" \
 	DEPENDS="${dep}" \
 	ptxd_replace_magic "${PTXDIST_TOPDIR}/config/xpkg/ipkg.control" > \
-	"${pkg_xpkg_control}" || return
+	"${pkg_xpkg_control}" &&
+	chmod 644 "${pkg_xpkg_control}" || return
 
     local script
     for script in preinst postinst prerm postrm; do
-- 
2.11.0


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

             reply	other threads:[~2017-03-08 11:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-08 11:23 Marc Kleine-Budde [this message]
2017-03-10  9:42 ` Michael Olbrich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170308112305.12046-1-mkl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox