- Don't set SELinux file context if it is already correct.
This commit is contained in:
parent
403790b2e1
commit
ffc4fff55b
@ -1,69 +1,26 @@
|
|||||||
--- patch-2.5.4/patch.c 2008-06-12 11:09:17.000000000 +0100
|
diff -up patch-2.5.4/common.h.selinux patch-2.5.4/common.h
|
||||||
+++ patch-2.5.4/patch.c 2008-06-30 10:56:48.000000000 +0100
|
--- patch-2.5.4/common.h.selinux 1999-08-30 07:20:08.000000000 +0100
|
||||||
@@ -414,6 +414,13 @@
|
+++ patch-2.5.4/common.h 2009-02-17 15:33:13.000000000 +0000
|
||||||
if (! inerrno && chmod (outname, instat.st_mode) != 0)
|
@@ -39,6 +39,8 @@
|
||||||
pfatal ("Can't set permissions on file %s",
|
#include <sys/types.h>
|
||||||
quotearg (outname));
|
#include <time.h>
|
||||||
+ if (! inerrno && incontext &&
|
|
||||||
+ setfilecon (outname, incontext) != 0)
|
|
||||||
+ {
|
|
||||||
+ if (errno != ENOTSUP && errno != EPERM)
|
|
||||||
+ pfatal ("Can't set security context on file %s",
|
|
||||||
+ quotearg (outname));
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
--- patch-2.5.4/util.c.selinux 2008-06-12 11:09:17.000000000 +0100
|
|
||||||
+++ patch-2.5.4/util.c 2008-06-12 11:12:01.000000000 +0100
|
|
||||||
@@ -375,7 +375,8 @@ version_controller (char const *filename
|
|
||||||
Return nonzero if successful. */
|
|
||||||
int
|
|
||||||
version_get (char const *filename, char const *cs, int exists, int readonly,
|
|
||||||
- char const *getbuf, struct stat *filestat)
|
|
||||||
+ char const *getbuf, struct stat *filestat,
|
|
||||||
+ security_context_t *filecontext)
|
|
||||||
{
|
|
||||||
if (patch_get < 0)
|
|
||||||
{
|
|
||||||
@@ -400,6 +401,13 @@ version_get (char const *filename, char
|
|
||||||
fatal ("Can't get file %s from %s", quotearg (filename), cs);
|
|
||||||
if (stat (filename, filestat) != 0)
|
|
||||||
pfatal ("%s", quotearg (filename));
|
|
||||||
+ if (filecontext && getfilecon (filename, filecontext) == -1)
|
|
||||||
+ {
|
|
||||||
+ if (errno == ENODATA || errno == ENOTSUP)
|
|
||||||
+ *filecontext = NULL;
|
|
||||||
+ else
|
|
||||||
+ pfatal ("%s", quotearg (filename));
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
+#include <selinux/selinux.h>
|
||||||
--- patch-2.5.4/util.h.selinux 1999-08-30 07:20:08.000000000 +0100
|
+
|
||||||
+++ patch-2.5.4/util.h 2008-06-12 11:09:17.000000000 +0100
|
#include <sys/stat.h>
|
||||||
@@ -21,7 +21,7 @@ char *fetchname PARAMS ((char *, int, ti
|
#if ! defined S_ISDIR && defined S_IFDIR
|
||||||
char *savebuf PARAMS ((char const *, size_t));
|
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
||||||
char *savestr PARAMS ((char const *));
|
@@ -168,6 +170,7 @@ XTERN char *outfile;
|
||||||
char const *version_controller PARAMS ((char const *, int, struct stat const *, char **, char **));
|
XTERN int inerrno;
|
||||||
-int version_get PARAMS ((char const *, char const *, int, int, char const *, struct stat *));
|
XTERN int invc;
|
||||||
+int version_get PARAMS ((char const *, char const *, int, int, char const *, struct stat *, security_context_t *));
|
XTERN struct stat instat;
|
||||||
int create_file PARAMS ((char const *, int, mode_t));
|
+XTERN security_context_t incontext;
|
||||||
int systemic PARAMS ((char const *));
|
XTERN bool dry_run;
|
||||||
char *format_linenum PARAMS ((char[LINENUM_LENGTH_BOUND + 1], LINENUM));
|
XTERN bool posixly_correct;
|
||||||
--- patch-2.5.4/Makefile.in.selinux 1999-08-30 07:37:54.000000000 +0100
|
|
||||||
+++ patch-2.5.4/Makefile.in 2008-06-12 11:09:17.000000000 +0100
|
diff -up patch-2.5.4/inp.c.selinux patch-2.5.4/inp.c
|
||||||
@@ -36,7 +36,7 @@ DEFS = @DEFS@
|
--- patch-2.5.4/inp.c.selinux 2009-02-17 15:33:13.000000000 +0000
|
||||||
EXEEXT = @EXEEXT@
|
+++ patch-2.5.4/inp.c 2009-02-17 15:33:13.000000000 +0000
|
||||||
LDFLAGS = @LDFLAGS@
|
|
||||||
LIBOBJS = @LIBOBJS@
|
|
||||||
-LIBS = @LIBS@
|
|
||||||
+LIBS = @LIBS@ -lselinux
|
|
||||||
PACKAGE = @PACKAGE@
|
|
||||||
U = @U@
|
|
||||||
VERSION = @VERSION@
|
|
||||||
--- patch-2.5.4/inp.c.selinux 2008-06-12 11:09:17.000000000 +0100
|
|
||||||
+++ patch-2.5.4/inp.c 2008-06-12 11:11:08.000000000 +0100
|
|
||||||
@@ -154,7 +154,20 @@ get_input_file (char const *filename, ch
|
@@ -154,7 +154,20 @@ get_input_file (char const *filename, ch
|
||||||
char *getbuf;
|
char *getbuf;
|
||||||
|
|
||||||
@ -103,8 +60,41 @@
|
|||||||
}
|
}
|
||||||
else if (! S_ISREG (instat.st_mode))
|
else if (! S_ISREG (instat.st_mode))
|
||||||
fatal ("File %s is not a regular file -- can't patch",
|
fatal ("File %s is not a regular file -- can't patch",
|
||||||
--- patch-2.5.4/pch.c.selinux 2008-06-12 11:09:17.000000000 +0100
|
diff -up patch-2.5.4/Makefile.in.selinux patch-2.5.4/Makefile.in
|
||||||
+++ patch-2.5.4/pch.c 2008-06-12 11:11:48.000000000 +0100
|
--- patch-2.5.4/Makefile.in.selinux 1999-08-30 07:37:54.000000000 +0100
|
||||||
|
+++ patch-2.5.4/Makefile.in 2009-02-17 15:33:13.000000000 +0000
|
||||||
|
@@ -36,7 +36,7 @@ DEFS = @DEFS@
|
||||||
|
EXEEXT = @EXEEXT@
|
||||||
|
LDFLAGS = @LDFLAGS@
|
||||||
|
LIBOBJS = @LIBOBJS@
|
||||||
|
-LIBS = @LIBS@
|
||||||
|
+LIBS = @LIBS@ -lselinux
|
||||||
|
PACKAGE = @PACKAGE@
|
||||||
|
U = @U@
|
||||||
|
VERSION = @VERSION@
|
||||||
|
diff -up patch-2.5.4/patch.c.selinux patch-2.5.4/patch.c
|
||||||
|
--- patch-2.5.4/patch.c.selinux 2009-02-17 15:33:13.000000000 +0000
|
||||||
|
+++ patch-2.5.4/patch.c 2009-02-17 15:34:42.000000000 +0000
|
||||||
|
@@ -414,6 +414,16 @@ main (int argc, char **argv)
|
||||||
|
if (! inerrno && chmod (outname, instat.st_mode) != 0)
|
||||||
|
pfatal ("Can't set permissions on file %s",
|
||||||
|
quotearg (outname));
|
||||||
|
+ if (! inerrno && incontext) {
|
||||||
|
+ security_context_t outcontext;
|
||||||
|
+ getfilecon (outname, &outcontext);
|
||||||
|
+ if (strcmp(outcontext, incontext) &&
|
||||||
|
+ setfilecon (outname, incontext) != 0) {
|
||||||
|
+ if (errno != ENOTSUP && errno != EPERM)
|
||||||
|
+ pfatal ("Can't set security context on file %s",
|
||||||
|
+ quotearg (outname));
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diff -up patch-2.5.4/pch.c.selinux patch-2.5.4/pch.c
|
||||||
|
--- patch-2.5.4/pch.c.selinux 2009-02-17 15:33:13.000000000 +0000
|
||||||
|
+++ patch-2.5.4/pch.c 2009-02-17 15:33:13.000000000 +0000
|
||||||
@@ -258,7 +258,12 @@ there_is_another_patch (void)
|
@@ -258,7 +258,12 @@ there_is_another_patch (void)
|
||||||
{
|
{
|
||||||
if (stat (inname, &instat) == 0)
|
if (stat (inname, &instat) == 0)
|
||||||
@ -136,22 +126,42 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (i = OLD; i <= INDEX; i++)
|
for (i = OLD; i <= INDEX; i++)
|
||||||
--- patch-2.5.4/common.h.selinux 1999-08-30 07:20:08.000000000 +0100
|
diff -up patch-2.5.4/util.c.selinux patch-2.5.4/util.c
|
||||||
+++ patch-2.5.4/common.h 2008-06-12 11:09:17.000000000 +0100
|
--- patch-2.5.4/util.c.selinux 2009-02-17 15:33:13.000000000 +0000
|
||||||
@@ -39,6 +39,8 @@
|
+++ patch-2.5.4/util.c 2009-02-17 15:33:13.000000000 +0000
|
||||||
#include <sys/types.h>
|
@@ -375,7 +375,8 @@ version_controller (char const *filename
|
||||||
#include <time.h>
|
Return nonzero if successful. */
|
||||||
|
int
|
||||||
+#include <selinux/selinux.h>
|
version_get (char const *filename, char const *cs, int exists, int readonly,
|
||||||
+
|
- char const *getbuf, struct stat *filestat)
|
||||||
#include <sys/stat.h>
|
+ char const *getbuf, struct stat *filestat,
|
||||||
#if ! defined S_ISDIR && defined S_IFDIR
|
+ security_context_t *filecontext)
|
||||||
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
|
{
|
||||||
@@ -168,6 +170,7 @@ XTERN char *outfile;
|
if (patch_get < 0)
|
||||||
XTERN int inerrno;
|
{
|
||||||
XTERN int invc;
|
@@ -400,6 +401,13 @@ version_get (char const *filename, char
|
||||||
XTERN struct stat instat;
|
fatal ("Can't get file %s from %s", quotearg (filename), cs);
|
||||||
+XTERN security_context_t incontext;
|
if (stat (filename, filestat) != 0)
|
||||||
XTERN bool dry_run;
|
pfatal ("%s", quotearg (filename));
|
||||||
XTERN bool posixly_correct;
|
+ if (filecontext && getfilecon (filename, filecontext) == -1)
|
||||||
|
+ {
|
||||||
|
+ if (errno == ENODATA || errno == ENOTSUP)
|
||||||
|
+ *filecontext = NULL;
|
||||||
|
+ else
|
||||||
|
+ pfatal ("%s", quotearg (filename));
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
diff -up patch-2.5.4/util.h.selinux patch-2.5.4/util.h
|
||||||
|
--- patch-2.5.4/util.h.selinux 1999-08-30 07:20:08.000000000 +0100
|
||||||
|
+++ patch-2.5.4/util.h 2009-02-17 15:33:13.000000000 +0000
|
||||||
|
@@ -21,7 +21,7 @@ char *fetchname PARAMS ((char *, int, ti
|
||||||
|
char *savebuf PARAMS ((char const *, size_t));
|
||||||
|
char *savestr PARAMS ((char const *));
|
||||||
|
char const *version_controller PARAMS ((char const *, int, struct stat const *, char **, char **));
|
||||||
|
-int version_get PARAMS ((char const *, char const *, int, int, char const *, struct stat *));
|
||||||
|
+int version_get PARAMS ((char const *, char const *, int, int, char const *, struct stat *, security_context_t *));
|
||||||
|
int create_file PARAMS ((char const *, int, mode_t));
|
||||||
|
int systemic PARAMS ((char const *));
|
||||||
|
char *format_linenum PARAMS ((char[LINENUM_LENGTH_BOUND + 1], LINENUM));
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Summary: Utility for modifying/upgrading files
|
Summary: Utility for modifying/upgrading files
|
||||||
Name: patch
|
Name: patch
|
||||||
Version: 2.5.4
|
Version: 2.5.4
|
||||||
Release: 36%{?dist}
|
Release: 37%{?dist}
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
URL: http://www.gnu.org/software/patch/patch.html
|
URL: http://www.gnu.org/software/patch/patch.html
|
||||||
Group: Development/Tools
|
Group: Development/Tools
|
||||||
@ -68,6 +68,9 @@ rm -rf $RPM_BUILD_ROOT
|
|||||||
%{_mandir}/*/*
|
%{_mandir}/*/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Feb 17 2009 Tim Waugh <twaugh@redhat.com> 2.5.4-37
|
||||||
|
- Don't set SELinux file context if it is already correct.
|
||||||
|
|
||||||
* Mon Nov 24 2008 Tim Waugh <twaugh@redhat.com> 2.5.4-36
|
* Mon Nov 24 2008 Tim Waugh <twaugh@redhat.com> 2.5.4-36
|
||||||
- Better summary.
|
- Better summary.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user