summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Phillip Brink <binki@gentoo.org>2016-08-20 21:26:06 +0000
committerNathan Phillip Brink <binki@gentoo.org>2016-08-20 21:26:06 +0000
commit1a1a5528ea8d7264df4f7bb2e1b5d3e55501736d (patch)
tree33a87bd6b6ac6b713b80176b794e3504e81ea669 /net-irc
parentdev-erlang/esip: stabilize 1.0.4 on ppc, bug #587908 (diff)
downloadgentoo-1a1a5528ea8d7264df4f7bb2e1b5d3e55501736d.tar.gz
gentoo-1a1a5528ea8d7264df4f7bb2e1b5d3e55501736d.tar.bz2
gentoo-1a1a5528ea8d7264df4f7bb2e1b5d3e55501736d.zip
net-irc/unrealircd: Precreate tune/logfile for bug #560790.
If you run a program as root and it creates files those will be owned by root instead of the intended user. Since unrealircd was not intended to be run directly as root but it is easy to do so by accident, this change precreates some files so that it is easier to switch back to running unrealircd as an unprivileged user. Package-Manager: portage-2.2.28
Diffstat (limited to 'net-irc')
-rw-r--r--net-irc/unrealircd/unrealircd-4.0.5.ebuild27
1 files changed, 23 insertions, 4 deletions
diff --git a/net-irc/unrealircd/unrealircd-4.0.5.ebuild b/net-irc/unrealircd/unrealircd-4.0.5.ebuild
index ef8330531ec3..b05a9840475b 100644
--- a/net-irc/unrealircd/unrealircd-4.0.5.ebuild
+++ b/net-irc/unrealircd/unrealircd-4.0.5.ebuild
@@ -63,7 +63,7 @@ src_configure() {
--with-tmpdir="${EPREFIX}"/var/lib/${PN}/tmp \
--with-nick-history=2000 \
--with-sendq=3000000 \
- --with-permissions=0600 \
+ --with-permissions=0640 \
--with-fd-setsize=1024 \
--with-system-cares \
--with-system-pcre2 \
@@ -213,10 +213,29 @@ s/"and another one";/"'"${keys[2]}"'";/
eend $?
fi
+ # Precreate ircd.tune and ircd.log with the correct ownership to
+ # protect people from themselves when they run unrealircd as root
+ # before trying the initscripts. #560790
+ local f
+ for f in "${EROOT}"var/{lib/${PN}/ircd.tune,log/${PN}/ircd.log}; do
+ [[ -e ${f} ]] && continue
+ ebegin "Precreating ${f} to set ownership"
+ (
+ umask 0037
+ # ircd.tune must be seeded with content instead of being empty.
+ if [[ ${f} == *ircd.tune ]]; then
+ echo 0 > "${f}"
+ echo 0 >> "${f}"
+ fi
+ touch "${f}"
+ )
+ chown unrealircd "${f}"
+ eend $?
+ done
+
elog "UnrealIRCd will not run until you've set up /etc/unrealircd/unrealircd.conf"
elog
elog "You can also configure ${PN} start at boot with rc-update(1)."
- elog "Note that it is recommended to run unrealircd as an"
- elog "unprivileged user (the provided init.d script does this"
- elog "for you). Running as root will break file permissions."
+ elog "It is recommended to run unrealircd as an unprivileged user."
+ elog "The provided init.d script does this for you."
}