public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Rolf Eike Beer <eike@sf-mail.de>
To: gentoo-dev@lists.gentoo.org
Subject: [gentoo-dev] [PATCH 2/3 v3] qmail.eclass: remove magic to query root group
Date: Sat, 14 Aug 2021 11:36:34 +0200	[thread overview]
Message-ID: <2590214.mvXUDI8C0e@daneel.sf-tec.de> (raw)
In-Reply-To: <4670715.31r3eYUQgx@eto.sf-tec.de>

[-- Attachment #1: Type: text/plain, Size: 4045 bytes --]

The default owner is root:root anyway, so just make sure other settings do not
leak outside from the places where it is actually used. This also fixes
qmail_supervise_install_one() when called from outside of qmail_src_install().

Signed-off-by: Rolf Eike Beer <eike@sf-mail.de>
---
 eclass/qmail.eclass | 32 ++++++++++++++++++--------------
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/eclass/qmail.eclass b/eclass/qmail.eclass
index 6b04cbf7792..c4f0b98ab30 100644
--- a/eclass/qmail.eclass
+++ b/eclass/qmail.eclass
@@ -73,7 +73,7 @@ is_prime() {
 
 dospp() {
 	insinto "${QMAIL_HOME}"/plugins/
-	insopts -o root -g "${GROUP_ROOT}" -m 0755
+	insopts -m 0755
 	newins $1 ${2:-$(basename $1)}
 }
 
@@ -86,8 +86,8 @@ dosupervise() {
 	local runfile=${2:-${service}} logfile=${3:-${service}-log}
 	[[ -z "${service}" ]] && die "no service given"
 
-	insopts -o root -g "${GROUP_ROOT}" -m 0755
-	diropts -o root -g "${GROUP_ROOT}" -m 0755
+	insopts -m 0755
+	diropts -m 0755
 
 	dodir ${SUPERVISE_DIR}/${service}{,/log}
 	fperms +t ${SUPERVISE_DIR}/${service}{,/log}
@@ -185,6 +185,10 @@ qmail_base_install() {
 	insopts -o qmailq -g qmail -m 4711
 	doins qmail-queue
 
+	# reset to default
+	insopts -o root -g root -m 644
+	diropts -o root -g root -m 755
+
 	declare -F qmail_base_install_hook >/dev/null && \
 		qmail_base_install_hook
 }
@@ -192,12 +196,12 @@ qmail_base_install() {
 qmail_config_install() {
 	einfo "Installing stock configuration files"
 	insinto "${QMAIL_HOME}"/control
-	insopts -o root -g "${GROUP_ROOT}" -m 644
+	insopts -m 644
 	doins "${GENQMAIL_S}"/control/{conf-*,defaultdelivery}
 
 	einfo "Installing configuration sanity checker and launcher"
 	insinto "${QMAIL_HOME}"/bin
-	insopts -o root -g "${GROUP_ROOT}" -m 644
+	insopts -m 644
 	doins "${GENQMAIL_S}"/control/qmail-config-system
 
 	declare -F qmail_config_install_hook >/dev/null && \
@@ -254,9 +258,9 @@ qmail_maildir_install() {
 	done
 
 	einfo "Setting up default maildirs in the account skeleton"
-	diropts -o root -g "${GROUP_ROOT}" -m 755
+	diropts -o root -g root -m 755
 	insinto /etc/skel
-	insopts -o root -g "${GROUP_ROOT}" -m 644
+	insopts -m 644
 	newins "${GENQMAIL_S}"/control/defaultdelivery .qmail.sample
 	"${MAILDIRMAKE}" "${D}"/etc/skel/.maildir
 	keepdir /etc/skel/.maildir/{cur,new,tmp}
@@ -268,7 +272,7 @@ qmail_maildir_install() {
 qmail_tcprules_install() {
 	dodir "${TCPRULES_DIR}"
 	insinto "${TCPRULES_DIR}"
-	insopts -o root -g "${GROUP_ROOT}" -m 0644
+	insopts -m 0644
 	doins "${GENQMAIL_S}"/tcprules/Makefile.qmail
 	doins "${GENQMAIL_S}"/tcprules/tcp.qmail-*
 	use ssl && use pop3 || rm -f "${D}${TCPRULES_DIR}"/tcp.qmail-pop3sd
@@ -276,8 +280,10 @@ qmail_tcprules_install() {
 
 qmail_supervise_install_one() {
 	dosupervise ${1}
-	diropts -o qmaill -g "${GROUP_ROOT}" -m 755
+	diropts -o qmaill -g root -m 755
 	keepdir /var/log/qmail/${1}
+	# reset to default
+	diropts -o root -g root
 }
 
 qmail_supervise_install() {
@@ -301,7 +307,7 @@ qmail_supervise_install() {
 qmail_spp_install() {
 	einfo "Installing qmail-spp configuration files"
 	insinto "${QMAIL_HOME}"/control/
-	insopts -o root -g "${GROUP_ROOT}" -m 0644
+	insopts -m 0644
 	doins "${GENQMAIL_S}"/spp/smtpplugins
 
 	einfo "Installing qmail-spp plugins"
@@ -321,16 +327,15 @@ qmail_ssl_install() {
 
 	einfo "Installing SSL Certificate creation script"
 	insinto "${QMAIL_HOME}"/control
-	insopts -o root -g "${GROUP_ROOT}" -m 0644
+	insopts -m 0644
 	doins "${GENQMAIL_S}"/ssl/servercert.cnf
 
 	insinto "${QMAIL_HOME}"/bin
-	insopts -o root -g "${GROUP_ROOT}" -m 0755
+	insopts -m 0755
 	doins "${GENQMAIL_S}"/ssl/mkservercert
 
 	einfo "Installing RSA key generation cronjob"
 	insinto /etc/${CRON_FOLDER}
-	insopts -o root -g "${GROUP_ROOT}" -m 0755
 	doins "${GENQMAIL_S}"/ssl/qmail-genrsacert.sh
 
 	keepdir "${QMAIL_HOME}"/control/tlshosts
@@ -340,7 +345,6 @@ qmail_ssl_install() {
 }
 
 qmail_src_install() {
-	export GROUP_ROOT="$(id -gn root)"
 	qmail_base_install
 	qmail_config_install
 	qmail_man_install
-- 
2.26.2


[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  parent reply	other threads:[~2021-08-14  9:36 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-12  9:54 [gentoo-dev] [PATCH 1/3] qmail.eclass: support EAPI 8 Rolf Eike Beer
2021-08-12  9:55 ` [gentoo-dev] [PATCH 2/3] qmail.eclass: hardcode root group Rolf Eike Beer
2021-08-12 11:13   ` Ulrich Mueller
2021-08-12 14:03     ` Rolf Eike Beer
2021-08-12 15:22   ` [gentoo-dev] [PATCH 2/3] qmail.eclass: remove magic to query " Rolf Eike Beer
2021-08-12 17:39     ` Michael Orlitzky
2021-08-13  7:17       ` Rolf Eike Beer
2021-08-13  9:06         ` Ulrich Mueller
2021-08-13 10:31           ` Rolf Eike Beer
2021-08-14 10:43             ` David Seifert
2021-08-14  9:36   ` Rolf Eike Beer [this message]
2021-08-14 10:52     ` [gentoo-dev] [PATCH 2/3 v3] " Ulrich Mueller
2021-08-14 11:11       ` Rolf Eike Beer
2021-08-14 11:54         ` Ulrich Mueller
2021-08-14 11:34   ` [gentoo-dev] [PATCH 2/3 v4] " Rolf Eike Beer
2021-08-12  9:55 ` [gentoo-dev] [PATCH 3/5] qmail.eclass: simplify is_prime() Rolf Eike Beer
2021-08-12 11:25   ` Ulrich Mueller
2021-08-12 15:25     ` Rolf Eike Beer
2021-08-12 15:25   ` [gentoo-dev] [PATCH 3/3] " Rolf Eike Beer
2021-08-13  7:47 ` [gentoo-dev] [PATCH 4/3] qmail.eclass: remove needless keepdirs Rolf Eike Beer
2021-08-14 11:47   ` [gentoo-dev] [PATCH 4/3 v2] " Rolf Eike Beer
2021-08-13 10:44 ` [gentoo-dev] [PATCH 5/3] qmail.eclass: retire qmail_tcprules_fixup() Rolf Eike Beer

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=2590214.mvXUDI8C0e@daneel.sf-tec.de \
    --to=eike@sf-mail.de \
    --cc=gentoo-dev@lists.gentoo.org \
    /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