1 --- shadow-4.0.3/lib/commonio.h.selinux 2001-08-14 17:09:54.000000000 -0400
2 +++ shadow-4.0.3/lib/commonio.h 2003-06-20 15:52:54.000000000 -0400
7 +#include <selinux/selinux.h>
12 @@ -70,6 +73,9 @@ struct commonio_db {
17 + security_context_t scontext;
20 * Head, tail, current position in linked list.
22 --- shadow-4.0.3/lib/Makefile.am.selinux 2003-06-20 15:46:31.000000000 -0400
23 +++ shadow-4.0.3/lib/Makefile.am 2003-06-20 15:51:00.000000000 -0400
26 AUTOMAKE_OPTIONS = 1.0 foreign
29 +DEFS = -DWITH_SELINUX
30 INCLUDES = -I$(top_srcdir)
32 noinst_LTLIBRARIES = libshadow.la
34 libshadow_la_LDFLAGS = -version-info 0:0:0
35 libshadow_la_LIBADD = $(INTLLIBS) $(LIBCRYPT) $(LIBTCFS) $(LIBSKEY) $(LIBMD) \
36 - $(top_builddir)/libmisc/libmisc.la
37 + $(top_builddir)/libmisc/libmisc.la
39 libshadow_la_SOURCES = \
41 --- shadow-4.0.3/lib/commonio.c.selinux 2003-06-20 15:53:16.000000000 -0400
42 +++ shadow-4.0.3/lib/commonio.c 2003-07-08 13:53:32.033078008 -0400
43 @@ -15,7 +15,10 @@ RCSID("$Id: commonio.c,v 1.22 2001/11/17
49 +#include <selinux/selinux.h>
50 +static security_context_t old_context=NULL;
54 /* local function prototypes */
55 @@ -437,6 +440,15 @@ commonio_open(struct commonio_db *db, in
61 + if (is_selinux_enabled() && (! db->readonly)) {
62 + if (fgetfilecon(fileno(db->fp),&db->scontext) < 0) {
69 buf = (char *) malloc(buflen);
71 @@ -492,6 +504,12 @@ cleanup_buf:
76 + if (db->scontext!= NULL) {
77 + freecon(db->scontext);
84 @@ -627,6 +645,19 @@ commonio_close(struct commonio_db *db)
89 + if (db->scontext != NULL) {
90 + int stat=getfscreatecon(&old_context);
95 + if (setfscreatecon(db->scontext)<0) {
102 * Create backup file.
104 @@ -683,14 +714,26 @@ commonio_close(struct commonio_db *db)
107 nscd_need_reload = 1;
113 - free_linked_list(db);
118 + if (db->scontext != NULL) {
119 + if (setfscreatecon(old_context)<0) {
122 + if (old_context != NULL) {
123 + freecon(old_context);
126 + freecon(db->scontext);
130 free_linked_list(db);
136 --- shadow-4.0.3/src/Makefile.am.selinux 2003-06-20 15:50:17.000000000 -0400
137 +++ shadow-4.0.3/src/Makefile.am 2003-06-20 15:50:44.000000000 -0400
138 @@ -4,7 +4,7 @@ EXTRA_DOST = .indent.pro
139 ubindir = ${prefix}/bin
140 usbindir = ${prefix}/sbin
142 -DEFS = -D_HAVE_CONFIG_H -DLOCALEDIR=\"$(datadir)/locale\"
143 +DEFS = -D_HAVE_CONFIG_H -DLOCALEDIR=\"$(datadir)/locale\" -DWITH_SELINUX
145 INCLUDES = -I${top_srcdir} \
146 -I${top_srcdir}/lib \
147 @@ -35,7 +35,7 @@ suidbins = su
148 suidubins = chage chfn chsh expiry gpasswd newgrp passwd
150 LDADD = $(top_builddir)/libmisc/libmisc.la \
151 - $(top_builddir)/lib/libshadow.la
152 + $(top_builddir)/lib/libshadow.la -lselinux
154 chpasswd_LDADD = $(LDADD) $(LIBPAM)
155 chage_LDADD = $(LDADD) $(LIBPAM)