summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris PeBenito <pebenito@gentoo.org>2004-01-23 19:51:06 +0000
committerChris PeBenito <pebenito@gentoo.org>2004-01-23 19:51:06 +0000
commitde17dc5b808e70f52a4dafdd96d208aee714b662 (patch)
tree6d041b06ab545c445d830cad44ffba300874aee1
parentstable on x86 (diff)
downloadgentoo-2-de17dc5b808e70f52a4dafdd96d208aee714b662.tar.gz
gentoo-2-de17dc5b808e70f52a4dafdd96d208aee714b662.tar.bz2
gentoo-2-de17dc5b808e70f52a4dafdd96d208aee714b662.zip
Update SELinux patch
-rw-r--r--sys-apps/shadow/ChangeLog6
-rw-r--r--sys-apps/shadow/files/shadow-4.0.4.1-selinux.diff163
-rw-r--r--sys-apps/shadow/shadow-4.0.4.1.ebuild4
3 files changed, 170 insertions, 3 deletions
diff --git a/sys-apps/shadow/ChangeLog b/sys-apps/shadow/ChangeLog
index 07e028bf2c14..8133e3238e7c 100644
--- a/sys-apps/shadow/ChangeLog
+++ b/sys-apps/shadow/ChangeLog
@@ -1,6 +1,10 @@
# ChangeLog for sys-apps/shadow
# Copyright 2002-2004 Gentoo Technologies, Inc.; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/shadow/ChangeLog,v 1.48 2004/01/22 19:20:09 azarah Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/shadow/ChangeLog,v 1.49 2004/01/23 19:51:06 pebenito Exp $
+
+ 23 Jan 2004; Chris PeBenito <pebenito@gentoo.org> shadow-4.0.4.1.ebuild,
+ files/shadow-4.0.4.1-selinux.diff:
+ Update SELinux patch.
*shadow-4.0.4.1 (22 Jan 2004)
diff --git a/sys-apps/shadow/files/shadow-4.0.4.1-selinux.diff b/sys-apps/shadow/files/shadow-4.0.4.1-selinux.diff
new file mode 100644
index 000000000000..c2a15f80fd20
--- /dev/null
+++ b/sys-apps/shadow/files/shadow-4.0.4.1-selinux.diff
@@ -0,0 +1,163 @@
+diff -urN shadow-4.0.3.orig/lib/Makefile.am shadow-4.0.3/lib/Makefile.am
+--- shadow-4.0.3.orig/lib/Makefile.am 2001-10-06 14:53:20.000000000 -0500
++++ shadow-4.0.3/lib/Makefile.am 2003-08-07 08:38:20.000000000 -0500
+@@ -1,7 +1,7 @@
+
+ AUTOMAKE_OPTIONS = 1.0 foreign
+
+-DEFS =
++DEFS = -DWITH_SELINUX
+ INCLUDES =
+
+ lib_LTLIBRARIES = libshadow.la
+diff -urN shadow-4.0.3.orig/lib/commonio.c shadow-4.0.3/lib/commonio.c
+--- shadow-4.0.3.orig/lib/commonio.c 2001-11-17 07:15:52.000000000 -0600
++++ shadow-4.0.3/lib/commonio.c 2003-08-07 08:38:20.000000000 -0500
+@@ -15,7 +15,10 @@
+ #ifdef HAVE_SHADOW_H
+ #include <shadow.h>
+ #endif
+-
++#ifdef WITH_SELINUX
++#include <selinux/selinux.h>
++static security_context_t old_context=NULL;
++#endif
+ #include "commonio.h"
+
+ /* local function prototypes */
+@@ -437,6 +440,15 @@
+ return 0;
+ }
+
++#ifdef WITH_SELINUX
++ db->scontext=NULL;
++ if (is_selinux_enabled() && (! db->readonly)) {
++ if (fgetfilecon(fileno(db->fp),&db->scontext) < 0) {
++ goto cleanup;
++ }
++ }
++#endif
++
+ buflen = BUFLEN;
+ buf = (char *) malloc(buflen);
+ if (!buf)
+@@ -492,6 +504,12 @@
+ free(buf);
+ cleanup:
+ free_linked_list(db);
++#ifdef WITH_SELINUX
++ if (db->scontext!= NULL) {
++ freecon(db->scontext);
++ db->scontext=NULL;
++ }
++#endif
+ fclose(db->fp);
+ db->fp = NULL;
+ errno = ENOMEM;
+@@ -627,6 +645,19 @@
+ goto fail;
+ }
+
++#ifdef WITH_SELINUX
++ if (db->scontext != NULL) {
++ int stat=getfscreatecon(&old_context);
++ if (stat< 0) {
++ errors++;
++ goto fail;
++ }
++ if (setfscreatecon(db->scontext)<0) {
++ errors++;
++ goto fail;
++ }
++ }
++#endif
+ /*
+ * Create backup file.
+ */
+@@ -683,14 +714,26 @@
+ goto fail;
+
+ nscd_need_reload = 1;
+-
++ goto success;
++fail:
++ errors++;
+ success:
+- free_linked_list(db);
+- return 1;
+
+-fail:
++#ifdef WITH_SELINUX
++ if (db->scontext != NULL) {
++ if (setfscreatecon(old_context)<0) {
++ errors++;
++ }
++ if (old_context != NULL) {
++ freecon(old_context);
++ old_context=NULL;
++ }
++ freecon(db->scontext);
++ db->scontext=NULL;
++ }
++#endif
+ free_linked_list(db);
+- return 0;
++ return errors==0;
+ }
+
+
+diff -urN shadow-4.0.3.orig/lib/commonio.h shadow-4.0.3/lib/commonio.h
+--- shadow-4.0.3.orig/lib/commonio.h 2001-08-14 16:09:54.000000000 -0500
++++ shadow-4.0.3/lib/commonio.h 2003-08-07 08:38:20.000000000 -0500
+@@ -1,5 +1,8 @@
+ /* $Id: shadow-4.0.4.1-selinux.diff,v 1.1 2004/01/23 19:51:06 pebenito Exp $ */
+
++#ifdef WITH_SELINUX
++#include <selinux/selinux.h>
++#endif
+ /*
+ * Linked list entry.
+ */
+@@ -70,6 +73,9 @@
+ */
+ FILE *fp;
+
++#ifdef WITH_SELINUX
++ security_context_t scontext;
++#endif
+ /*
+ * Head, tail, current position in linked list.
+ */
+diff -urN shadow-4.0.3.orig/src/Makefile.am shadow-4.0.3/src/Makefile.am
+--- shadow-4.0.3.orig/src/Makefile.am 2002-03-10 01:12:52.000000000 -0600
++++ shadow-4.0.3/src/Makefile.am 2003-08-07 08:38:20.000000000 -0500
+@@ -4,7 +4,7 @@
+ ubindir = ${prefix}/bin
+ usbindir = ${prefix}/sbin
+
+-DEFS = -D_HAVE_CONFIG_H -DLOCALEDIR=\"$(datadir)/locale\"
++DEFS = -D_HAVE_CONFIG_H -DLOCALEDIR=\"$(datadir)/locale\" -DWITH_SELINUX
+
+ INCLUDES = -I${top_srcdir} \
+ -I${top_srcdir}/lib \
+@@ -35,7 +35,7 @@
+ suidubins = chage chfn chsh expiry gpasswd newgrp passwd
+
+ LDADD = $(top_builddir)/libmisc/libmisc.la \
+- $(top_builddir)/lib/libshadow.la
++ $(top_builddir)/lib/libshadow.la -lselinux
+
+ chpasswd_LDADD = $(LDADD) $(LIBPAM)
+ chage_LDADD = $(LDADD) $(LIBPAM)
+diff -urN shadow-4.0.3.orig/src/Makefile.in shadow-4.0.3/src/Makefile.in
+--- shadow-4.0.3.orig/src/Makefile.in 2002-03-13 13:04:10.000000000 -0600
++++ shadow-4.0.3/src/Makefile.in 2003-08-07 08:45:13.000000000 -0500
+@@ -145,7 +145,7 @@
+ suidubins = chage chfn chsh expiry gpasswd newgrp passwd
+
+ LDADD = $(top_builddir)/libmisc/libmisc.la \
+- $(top_builddir)/lib/libshadow.la
++ $(top_builddir)/lib/libshadow.la -lselinux
+
+
+ chpasswd_LDADD = $(LDADD) $(LIBPAM)
diff --git a/sys-apps/shadow/shadow-4.0.4.1.ebuild b/sys-apps/shadow/shadow-4.0.4.1.ebuild
index 0e5ce81369c0..b35b368c1a24 100644
--- a/sys-apps/shadow/shadow-4.0.4.1.ebuild
+++ b/sys-apps/shadow/shadow-4.0.4.1.ebuild
@@ -1,6 +1,6 @@
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/shadow/shadow-4.0.4.1.ebuild,v 1.1 2004/01/22 19:20:09 azarah Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/shadow/shadow-4.0.4.1.ebuild,v 1.2 2004/01/23 19:51:06 pebenito Exp $
IUSE="pam selinux"
@@ -8,7 +8,7 @@ inherit eutils libtool gnuconfig
FORCE_SYSTEMAUTH_UPDATE="no"
-SELINUX_PATCH="shadow-4.0.3-selinux.diff"
+SELINUX_PATCH="shadow-4.0.4.1-selinux.diff"
S="${WORKDIR}/${P}"
HOMEPAGE="http://shadow.pld.org.pl/"