summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2012-04-21 17:20:11 +0000
committerMike Frysinger <vapier@gentoo.org>2012-04-21 17:20:11 +0000
commitd4e5f36259fb33eddee55acf2c39f50eb434f3ea (patch)
tree0c2f1bb94a9db8ea747b49525251c324d77a982e /sys-apps
parentold (diff)
downloadgentoo-2-d4e5f36259fb33eddee55acf2c39f50eb434f3ea.tar.gz
gentoo-2-d4e5f36259fb33eddee55acf2c39f50eb434f3ea.tar.bz2
gentoo-2-d4e5f36259fb33eddee55acf2c39f50eb434f3ea.zip
Fix crash when calling userdel #405409 by Yuri Mamaev. Add patch for groupadd on selinux #406819 by Amadeusz Sławiński. Depend on libsemanage when USE=selinux #408173 by Markus Knetschke.
(Portage version: 2.2.0_alpha100/cvs/Linux x86_64)
Diffstat (limited to 'sys-apps')
-rw-r--r--sys-apps/shadow/ChangeLog11
-rw-r--r--sys-apps/shadow/files/shadow-4.1.5-grremove.patch49
-rw-r--r--sys-apps/shadow/files/shadow-4.1.5-selinux-groupadd.patch32
-rw-r--r--sys-apps/shadow/shadow-4.1.5-r2.ebuild203
4 files changed, 294 insertions, 1 deletions
diff --git a/sys-apps/shadow/ChangeLog b/sys-apps/shadow/ChangeLog
index c8b9078a3529..d648420ab852 100644
--- a/sys-apps/shadow/ChangeLog
+++ b/sys-apps/shadow/ChangeLog
@@ -1,6 +1,15 @@
# ChangeLog for sys-apps/shadow
# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/shadow/ChangeLog,v 1.268 2012/04/17 08:38:50 phajdan.jr Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/shadow/ChangeLog,v 1.269 2012/04/21 17:20:11 vapier Exp $
+
+*shadow-4.1.5-r2 (21 Apr 2012)
+
+ 21 Apr 2012; Mike Frysinger <vapier@gentoo.org> +shadow-4.1.5-r2.ebuild,
+ +files/shadow-4.1.5-grremove.patch,
+ +files/shadow-4.1.5-selinux-groupadd.patch:
+ Fix crash when calling userdel #405409 by Yuri Mamaev. Add patch for groupadd
+ on selinux #406819 by Amadeusz Sławiński. Depend on libsemanage when
+ USE=selinux #408173 by Markus Knetschke.
*shadow-4.1.5-r1 (17 Apr 2012)
diff --git a/sys-apps/shadow/files/shadow-4.1.5-grremove.patch b/sys-apps/shadow/files/shadow-4.1.5-grremove.patch
new file mode 100644
index 000000000000..96062ae15d2b
--- /dev/null
+++ b/sys-apps/shadow/files/shadow-4.1.5-grremove.patch
@@ -0,0 +1,49 @@
+https://bugs.gentoo.org/405409
+
+http://lists.alioth.debian.org/pipermail/pkg-shadow-devel/2012-February/009159.html
+http://lists.alioth.debian.org/pipermail/pkg-shadow-devel/2012-March/009196.html
+
+--- shadow-4.1.5/src/userdel.c
++++ shadow-4.1.5/src/userdel.c
+@@ -333,22 +333,22 @@ static void remove_usergroup (void)
+ * We can remove this group, it is not the primary
+ * group of any remaining user.
+ */
+- if (gr_remove (grp->gr_name) == 0) {
++ if (gr_remove (user_name) == 0) {
+ fprintf (stderr,
+ _("%s: cannot remove entry '%s' from %s\n"),
+- Prog, grp->gr_name, gr_dbname ());
++ Prog, user_name, gr_dbname ());
+ fail_exit (E_GRP_UPDATE);
+ }
+
+ #ifdef WITH_AUDIT
+ audit_logger (AUDIT_DEL_GROUP, Prog,
+ "deleting group",
+- grp->gr_name, AUDIT_NO_ID,
++ user_name, AUDIT_NO_ID,
+ SHADOW_AUDIT_SUCCESS);
+ #endif /* WITH_AUDIT */
+ SYSLOG ((LOG_INFO,
+ "removed group '%s' owned by '%s'\n",
+- grp->gr_name, user_name));
++ user_name, user_name));
+
+ #ifdef SHADOWGRP
+ if (sgr_locate (user_name) != NULL) {
+@@ -361,12 +361,12 @@ static void remove_usergroup (void)
+ #ifdef WITH_AUDIT
+ audit_logger (AUDIT_DEL_GROUP, Prog,
+ "deleting shadow group",
+- grp->gr_name, AUDIT_NO_ID,
++ user_name, AUDIT_NO_ID,
+ SHADOW_AUDIT_SUCCESS);
+ #endif /* WITH_AUDIT */
+ SYSLOG ((LOG_INFO,
+ "removed shadow group '%s' owned by '%s'\n",
+- grp->gr_name, user_name));
++ user_name, user_name));
+
+ }
+ #endif /* SHADOWGRP */
diff --git a/sys-apps/shadow/files/shadow-4.1.5-selinux-groupadd.patch b/sys-apps/shadow/files/shadow-4.1.5-selinux-groupadd.patch
new file mode 100644
index 000000000000..5a95c0f87764
--- /dev/null
+++ b/sys-apps/shadow/files/shadow-4.1.5-selinux-groupadd.patch
@@ -0,0 +1,32 @@
+http://lists.alioth.debian.org/pipermail/pkg-shadow-devel/2012-March/009205.html
+
+https://bugs.gentoo.org/406819
+
+--- shadow-4.1.5/lib/commonio.c
++++ shadow-4.1.5/lib/commonio.c
+@@ -977,6 +977,12 @@ int commonio_close (struct commonio_db *
+
+ snprintf (buf, sizeof buf, "%s+", db->filename);
+
++#ifdef WITH_SELINUX
++ if (set_selinux_file_context (buf) != 0) {
++ errors++;
++ }
++#endif
++
+ db->fp = fopen_set_perms (buf, "w", &sb);
+ if (NULL == db->fp) {
+ goto fail;
+@@ -1011,6 +1017,12 @@ int commonio_close (struct commonio_db *
+ goto fail;
+ }
+
++#ifdef WITH_SELINUX
++ if (reset_selinux_file_context () != 0) {
++ goto fail;
++ }
++#endif
++
+ nscd_need_reload = true;
+ goto success;
+ fail:
diff --git a/sys-apps/shadow/shadow-4.1.5-r2.ebuild b/sys-apps/shadow/shadow-4.1.5-r2.ebuild
new file mode 100644
index 000000000000..9441eb9e35a2
--- /dev/null
+++ b/sys-apps/shadow/shadow-4.1.5-r2.ebuild
@@ -0,0 +1,203 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/shadow/shadow-4.1.5-r2.ebuild,v 1.1 2012/04/21 17:20:11 vapier Exp $
+
+inherit eutils libtool toolchain-funcs pam multilib
+
+DESCRIPTION="Utilities to deal with user accounts"
+HOMEPAGE="http://shadow.pld.org.pl/ http://pkg-shadow.alioth.debian.org/"
+SRC_URI="http://pkg-shadow.alioth.debian.org/releases/${P}.tar.bz2"
+
+LICENSE="BSD GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+IUSE="acl audit cracklib nls pam selinux skey tcb xattr"
+
+RDEPEND="acl? ( sys-apps/acl )
+ audit? ( sys-process/audit )
+ cracklib? ( >=sys-libs/cracklib-2.7-r3 )
+ pam? ( virtual/pam )
+ skey? ( sys-auth/skey )
+ selinux? (
+ >=sys-libs/libselinux-1.28
+ sys-libs/libsemanage
+ )
+ nls? ( virtual/libintl )
+ tcb? ( sys-auth/tcb )
+ xattr? ( sys-apps/attr )"
+DEPEND="${RDEPEND}
+ nls? ( sys-devel/gettext )"
+RDEPEND="${RDEPEND}
+ pam? ( >=sys-auth/pambase-20120417 )"
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ epatch "${FILESDIR}"/${PN}-4.1.3-dots-in-usernames.patch #22920
+ epatch "${FILESDIR}"/${PN}-4.1.5-stdarg.patch
+ epatch "${FILESDIR}"/${PN}-4.1.5-nscd-newline-msg.patch
+ epatch "${FILESDIR}"/${PN}-4.1.5-nscd-ignore-exit-1.patch
+ epatch "${FILESDIR}"/${PN}-4.1.5-grremove.patch #405409
+ epatch "${FILESDIR}"/${PN}-4.1.5-selinux-groupadd.patch #406819
+ elibtoolize
+ epunt_cxx
+}
+
+src_compile() {
+ tc-is-cross-compiler && export ac_cv_func_setpgrp_void=yes
+ econf \
+ --without-group-name-max-length \
+ --enable-shared=no \
+ --enable-static=yes \
+ $(use_with acl) \
+ $(use_with audit) \
+ $(use_with cracklib libcrack) \
+ $(use_with pam libpam) \
+ $(use_with skey) \
+ $(use_with selinux) \
+ $(use_enable nls) \
+ $(use_with elibc_glibc nscd) \
+ $(use_with tcb) \
+ $(use_with xattr attr)
+ emake || die
+}
+
+set_login_opt() {
+ local comment="" opt=$1 val=$2
+ [[ -z ${val} ]] && comment="#"
+ sed -i -r \
+ -e "/^#?${opt}/s:.*:${comment}${opt} ${val}:" \
+ "${D}"/etc/login.defs
+ local res=$(grep "^${comment}${opt}" "${D}"/etc/login.defs)
+ einfo ${res:-Unable to find ${opt} in /etc/login.defs}
+}
+
+src_install() {
+ emake DESTDIR="${D}" suidperms=4711 install || die
+
+ # Remove libshadow and libmisc; see bug 37725 and the following
+ # comment from shadow's README.linux:
+ # Currently, libshadow.a is for internal use only, so if you see
+ # -lshadow in a Makefile of some other package, it is safe to
+ # remove it.
+ rm -f "${D}"/{,usr/}$(get_libdir)/lib{misc,shadow}.{a,la}
+
+ insinto /etc
+ # Using a securetty with devfs device names added
+ # (compat names kept for non-devfs compatibility)
+ insopts -m0600 ; doins "${FILESDIR}"/securetty
+ if ! use pam ; then
+ insopts -m0600
+ doins etc/login.access etc/limits
+ fi
+ # Output arch-specific cruft
+ local devs
+ case $(tc-arch) in
+ ppc*) devs="hvc0 hvsi0 ttyPSC0";;
+ hppa) devs="ttyB0";;
+ arm) devs="ttyFB0 ttySAC0 ttySAC1 ttySAC2 ttySAC3 ttymxc0 ttymxc1 ttyO0 ttyO1 ttyO2";;
+ sh) devs="ttySC0 ttySC1";;
+ esac
+ [[ -n ${devs} ]] && printf '%s\n' ${devs} >> "${D}"/etc/securetty
+
+ # needed for 'useradd -D'
+ insinto /etc/default
+ insopts -m0600
+ doins "${FILESDIR}"/default/useradd
+
+ # move passwd to / to help recover broke systems #64441
+ mv "${D}"/usr/bin/passwd "${D}"/bin/
+ dosym /bin/passwd /usr/bin/passwd
+
+ cd "${S}"
+ insinto /etc
+ insopts -m0644
+ newins etc/login.defs login.defs
+
+ if ! use pam ; then
+ set_login_opt MAIL_CHECK_ENAB no
+ set_login_opt SU_WHEEL_ONLY yes
+ set_login_opt CRACKLIB_DICTPATH /usr/$(get_libdir)/cracklib_dict
+ set_login_opt LOGIN_RETRIES 3
+ set_login_opt ENCRYPT_METHOD SHA512
+ else
+ dopamd "${FILESDIR}"/pam.d-include/shadow || die
+
+ for x in chpasswd chgpasswd; do
+ newpamd "${FILESDIR}"/pam.d-include/passwd ${x} || die
+ done
+
+ for x in chage chsh chfn newusers \
+ user{add,del,mod} group{add,del,mod} ; do
+ newpamd "${FILESDIR}"/pam.d-include/shadow ${x} || die
+ done
+
+ # comment out login.defs options that pam hates
+ local opt
+ for opt in \
+ CHFN_AUTH \
+ CRACKLIB_DICTPATH \
+ ENV_HZ \
+ ENVIRON_FILE \
+ FAILLOG_ENAB \
+ FTMP_FILE \
+ LASTLOG_ENAB \
+ MAIL_CHECK_ENAB \
+ MOTD_FILE \
+ NOLOGINS_FILE \
+ OBSCURE_CHECKS_ENAB \
+ PASS_ALWAYS_WARN \
+ PASS_CHANGE_TRIES \
+ PASS_MIN_LEN \
+ PORTTIME_CHECKS_ENAB \
+ QUOTAS_ENAB \
+ SU_WHEEL_ONLY
+ do
+ set_login_opt ${opt}
+ done
+
+ sed -i -f "${FILESDIR}"/login_defs_pam.sed \
+ "${D}"/etc/login.defs
+
+ # remove manpages that pam will install for us
+ # and/or don't apply when using pam
+ find "${D}"/usr/share/man \
+ '(' -name 'limits.5*' -o -name 'suauth.5*' ')' \
+ -exec rm {} +
+
+ # Remove pam.d files provided by pambase.
+ rm "${D}"/etc/pam.d/{login,passwd,su} || die
+ fi
+
+ # Remove manpages that are handled by other packages
+ find "${D}"/usr/share/man \
+ '(' -name id.1 -o -name passwd.5 -o -name getspnam.3 ')' \
+ -exec rm {} +
+
+ cd "${S}"
+ dodoc ChangeLog NEWS TODO
+ newdoc README README.download
+ cd doc
+ dodoc HOWTO README* WISHLIST *.txt
+}
+
+pkg_preinst() {
+ rm -f "${ROOT}"/etc/pam.d/system-auth.new \
+ "${ROOT}/etc/login.defs.new"
+
+ use pam && pam_epam_expand "${D}"/etc/pam.d/login
+}
+
+pkg_postinst() {
+ # Enable shadow groups.
+ if [ ! -f "${ROOT}"/etc/gshadow ] ; then
+ if grpck -r -R "${ROOT}" 2>/dev/null ; then
+ grpconv -R "${ROOT}"
+ else
+ ewarn "Running 'grpck' returned errors. Please run it by hand, and then"
+ ewarn "run 'grpconv' afterwards!"
+ fi
+ fi
+
+ einfo "The 'adduser' symlink to 'useradd' has been dropped."
+}