diff --git a/.gitignore b/.gitignore index 5a61b54..e376a08 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ patch-2.6.1.tar.xz /patch-2.7.1.tar.xz /patch-2.7.2.tar.xz /patch-2.7.3.tar.xz +/patch-2.7.4.tar.xz diff --git a/patch-2.7.3.tar.xz.sig b/patch-2.7.3.tar.xz.sig deleted file mode 100644 index 0e6b530..0000000 --- a/patch-2.7.3.tar.xz.sig +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN PGP SIGNATURE----- -Version: GnuPG v1 - -iQIcBAABAgAGBQJUwWX8AAoJEMTJJ81dGzbXivMP/04QBTz249nmpzyFkjbZqTyw -IIvj30iNuRJLbvJb2EwPDWoUPG+IPH3n/zzF1ir0zvV/NUCBt6kGUrJ7jOx/EqNl -dZ+W7jycUos89B2XoPBZ5wL12ucj1OMD7bEMyiU2VNY3T5/0CbkBLtN9CbBcVk+K -rUwSEx8RSgWGj3zdoqagwfEjiWj/w0XHQP1c4Mt8FO6z3MHZTVeLlZtokcbrffGe -Jj9Jl4KvJNrluyHE23wt+CSR+oa6ocBmXjj1Mh/WMKYyjSM4tizSbFmd+MRiRvkj -MU4DI3IAQHxx/pTQVNykONmy9o3dbHzv+Z1NJLXPn39Z0OJdyL8ib9JgAate+Raf -M1LpT9oF2SNMhbS8MPY2cNv1COg86+iCEQcwupofvVfggs2woh7lKZxJmBQ+HMeb -xfVFebDyVpMYI5wyehIFu05ZbLqHKxgTkaAMch2NCzQK/t1pHcrSmYDaUxgsP8GE -rTetI6eTYsHHgRiJDzmXg82UDtVP+1IoxUfLTUzU7r4bftxYaexcKEJSJ2q1kiBd -Go1x1eg2lgndKy5+U5LnlG7SnsO6XbKPkxpIjV/4ndIZgKLftIsC1vRDNOVfJBBt -IuWvlHpChIzeq7Ny/QTmpDL54eLNOyQu1v7JgisEOQkiFwH15pqUrBf9hdGvzqJ9 -1oRiLPhsxkF9F4DDt4ZU -=kKpc ------END PGP SIGNATURE----- diff --git a/patch-2.7.4.tar.xz.sig b/patch-2.7.4.tar.xz.sig new file mode 100644 index 0000000..175be02 --- /dev/null +++ b/patch-2.7.4.tar.xz.sig @@ -0,0 +1,17 @@ +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v1 + +iQIcBAABAgAGBQJUzUcsAAoJEMTJJ81dGzbX6pEQAICeOZE5UxUX5zUTAJBM9yrS +NXwQJuD/BJ1whe4v+zHGvd21XjH1TMCiAyowj+lyWqkuRynl7o/2lsDIGjoAczwE +puaqMAMeheDcw/Sj5lEmXFfRcyxVy6+2gfHmL4GnxEZh3WKrH8BogcuVDzjk+43y +4U+orCIsG41jPULOzKUu4vxvXsduUZEYdon5Id8N8GMkF3jah4//FCUKEjzHSRLW +KXRYZjptKFdvk/pvbByeDswHAOx4ccOxSv1yIc9JXDfN+zNNIM4pmFLgBfjWC8ec +zTIx/Q3HoXalcgam7HvzyWChwuzDDIvF7YbJ1C3paQ55kDwqVwYZaS9GTXkVJBCy +EjhZySDUfr2g4HW115mJafZBwEHaSjMLKxVd60g24o2o9iEhxCVypdawETChgAl7 +fxglHgtTN10NP0soe19rmLq/1+Y0qBoHDqD4Z3L7OHJIf8ogJiw5qdLsQmjZps7R +kRLzM+LjCdhE8B5c9pBgJ/K+FsBD7oYznkWpZeq+AxnBn5FVUY7tLQY7HsvRuNeO +fXdHgxcsyfPq/AdUTajwJ9zNQhP8w0fNmNQUsqiJ5jTVGzDcsHoZzONhpBCcbfgn +c42jO2OucNUhpx1KXrJS8XWzNVDKe050c6fTPL/vQVyDoFiMTY4Mve0u/kDrmDPh +ZRiuW4+IkX1C1razrl4L +=H9Qq +-----END PGP SIGNATURE----- diff --git a/patch-selinux.patch b/patch-selinux.patch index 843bc1f..9b5c3fa 100644 --- a/patch-selinux.patch +++ b/patch-selinux.patch @@ -1,6 +1,6 @@ -diff -up patch-2.7.3/src/common.h.selinux patch-2.7.3/src/common.h ---- patch-2.7.3/src/common.h.selinux 2015-01-19 17:24:29.000000000 +0000 -+++ patch-2.7.3/src/common.h 2015-01-23 10:11:26.690195912 +0000 +diff -up patch-2.7.4/src/common.h.selinux patch-2.7.4/src/common.h +--- patch-2.7.4/src/common.h.selinux 2015-01-31 16:09:46.000000000 +0000 ++++ patch-2.7.4/src/common.h 2015-02-01 12:46:56.922818144 +0000 @@ -30,6 +30,8 @@ #include #include @@ -18,10 +18,10 @@ diff -up patch-2.7.3/src/common.h.selinux patch-2.7.3/src/common.h XTERN bool dry_run; XTERN bool posixly_correct; -diff -up patch-2.7.3/src/inp.c.selinux patch-2.7.3/src/inp.c ---- patch-2.7.3/src/inp.c.selinux 2014-11-26 13:17:55.000000000 +0000 -+++ patch-2.7.3/src/inp.c 2015-01-23 10:11:26.738196109 +0000 -@@ -144,7 +144,7 @@ get_input_file (char const *filename, ch +diff -up patch-2.7.4/src/inp.c.selinux patch-2.7.4/src/inp.c +--- patch-2.7.4/src/inp.c.selinux 2015-01-31 21:13:45.000000000 +0000 ++++ patch-2.7.4/src/inp.c 2015-02-01 12:46:56.922818144 +0000 +@@ -145,7 +145,7 @@ get_input_file (char const *filename, ch char *getbuf; if (inerrno == -1) @@ -30,7 +30,7 @@ diff -up patch-2.7.3/src/inp.c.selinux patch-2.7.3/src/inp.c /* Perhaps look for RCS or SCCS versions. */ if (S_ISREG (file_type) -@@ -189,7 +189,7 @@ get_input_file (char const *filename, ch +@@ -190,7 +190,7 @@ get_input_file (char const *filename, ch } if (cs && version_get (filename, cs, ! inerrno, elsewhere, getbuf, @@ -39,7 +39,7 @@ diff -up patch-2.7.3/src/inp.c.selinux patch-2.7.3/src/inp.c inerrno = 0; free (getbuf); -@@ -200,6 +200,7 @@ get_input_file (char const *filename, ch +@@ -201,6 +201,7 @@ get_input_file (char const *filename, ch { instat.st_mode = S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH; instat.st_size = 0; @@ -47,10 +47,10 @@ diff -up patch-2.7.3/src/inp.c.selinux patch-2.7.3/src/inp.c } else if (! ((S_ISREG (file_type) || S_ISLNK (file_type)) && (file_type & S_IFMT) == (instat.st_mode & S_IFMT))) -diff -up patch-2.7.3/src/Makefile.am.selinux patch-2.7.3/src/Makefile.am ---- patch-2.7.3/src/Makefile.am.selinux 2014-11-26 13:17:55.000000000 +0000 -+++ patch-2.7.3/src/Makefile.am 2015-01-23 10:11:26.738196109 +0000 -@@ -34,7 +34,7 @@ patch_SOURCES = \ +diff -up patch-2.7.4/src/Makefile.am.selinux patch-2.7.4/src/Makefile.am +--- patch-2.7.4/src/Makefile.am.selinux 2015-01-31 21:12:47.000000000 +0000 ++++ patch-2.7.4/src/Makefile.am 2015-02-01 12:46:56.922818144 +0000 +@@ -36,7 +36,7 @@ patch_SOURCES = \ AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib patch_LDADD = $(LDADD) $(top_builddir)/lib/libpatch.a $(LIB_CLOCK_GETTIME) \ @@ -59,10 +59,10 @@ diff -up patch-2.7.3/src/Makefile.am.selinux patch-2.7.3/src/Makefile.am if ENABLE_MERGE patch_SOURCES += merge.c -diff -up patch-2.7.3/src/Makefile.in.selinux patch-2.7.3/src/Makefile.in ---- patch-2.7.3/src/Makefile.in.selinux 2015-01-19 19:36:16.000000000 +0000 -+++ patch-2.7.3/src/Makefile.in 2015-01-23 10:11:26.738196109 +0000 -@@ -1047,7 +1047,7 @@ patch_SOURCES = bestmatch.h common.h inp +diff -up patch-2.7.4/src/Makefile.in.selinux patch-2.7.4/src/Makefile.in +--- patch-2.7.4/src/Makefile.in.selinux 2015-01-31 21:14:45.000000000 +0000 ++++ patch-2.7.4/src/Makefile.in 2015-02-01 12:46:56.923818145 +0000 +@@ -1062,7 +1062,7 @@ patch_SOURCES = bestmatch.h common.h inp AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib \ $(am__append_2) patch_LDADD = $(LDADD) $(top_builddir)/lib/libpatch.a $(LIB_CLOCK_GETTIME) \ @@ -71,10 +71,10 @@ diff -up patch-2.7.3/src/Makefile.in.selinux patch-2.7.3/src/Makefile.in all: all-am -diff -up patch-2.7.3/src/patch.c.selinux patch-2.7.3/src/patch.c ---- patch-2.7.3/src/patch.c.selinux 2015-01-21 15:32:41.000000000 +0000 -+++ patch-2.7.3/src/patch.c 2015-01-23 10:11:26.739196113 +0000 -@@ -260,19 +260,19 @@ main (int argc, char **argv) +diff -up patch-2.7.4/src/patch.c.selinux patch-2.7.4/src/patch.c +--- patch-2.7.4/src/patch.c.selinux 2015-01-31 21:14:01.000000000 +0000 ++++ patch-2.7.4/src/patch.c 2015-02-01 12:46:56.923818145 +0000 +@@ -261,19 +261,19 @@ main (int argc, char **argv) if (! strcmp (inname, outname)) { if (inerrno == -1) @@ -97,7 +97,7 @@ diff -up patch-2.7.3/src/patch.c.selinux patch-2.7.3/src/patch.c inerrno = -1; } if (! outerrno) -@@ -567,7 +567,7 @@ main (int argc, char **argv) +@@ -570,7 +570,7 @@ main (int argc, char **argv) mode, &new_time); else { @@ -106,7 +106,7 @@ diff -up patch-2.7.3/src/patch.c.selinux patch-2.7.3/src/patch.c set_file_attributes (TMPOUTNAME, attr, inname, &instat, mode, &new_time); } -@@ -627,7 +627,7 @@ main (int argc, char **argv) +@@ -630,7 +630,7 @@ main (int argc, char **argv) struct stat oldst; int olderrno; @@ -115,7 +115,7 @@ diff -up patch-2.7.3/src/patch.c.selinux patch-2.7.3/src/patch.c if (olderrno && olderrno != ENOENT) write_fatal (); if (! olderrno && lookup_file_id (&oldst) == CREATED) -@@ -1757,7 +1757,7 @@ delete_file_later (const char *name, con +@@ -1760,7 +1760,7 @@ delete_file_later (const char *name, con if (! st) { @@ -124,9 +124,9 @@ diff -up patch-2.7.3/src/patch.c.selinux patch-2.7.3/src/patch.c pfatal ("Can't get file attributes of %s %s", "file", name); st = &st_tmp; } -diff -up patch-2.7.3/src/pch.c.selinux patch-2.7.3/src/pch.c ---- patch-2.7.3/src/pch.c.selinux 2015-01-22 20:23:31.000000000 +0000 -+++ patch-2.7.3/src/pch.c 2015-01-23 10:11:26.740196117 +0000 +diff -up patch-2.7.4/src/pch.c.selinux patch-2.7.4/src/pch.c +--- patch-2.7.4/src/pch.c.selinux 2015-01-31 21:14:01.000000000 +0000 ++++ patch-2.7.4/src/pch.c 2015-02-01 12:46:56.924818146 +0000 @@ -1,6 +1,6 @@ /* reading patches */ @@ -135,7 +135,7 @@ diff -up patch-2.7.3/src/pch.c.selinux patch-2.7.3/src/pch.c Copyright (C) 1990-1993, 1997-2003, 2006, 2009-2012 Free Software Foundation, Inc. -@@ -292,7 +292,7 @@ there_is_another_patch (bool need_header +@@ -293,7 +293,7 @@ there_is_another_patch (bool need_header if (t > buf + 1 && *(t - 1) == '\n') { inname = xmemdup0 (buf, t - buf - 1); @@ -152,7 +152,7 @@ diff -up patch-2.7.3/src/pch.c.selinux patch-2.7.3/src/pch.c int stat_errno[3]; int version_controlled[3]; enum diff retval; -@@ -469,6 +470,7 @@ intuit_diff_type (bool need_header, mode +@@ -470,6 +471,7 @@ intuit_diff_type (bool need_header, mode version_controlled[OLD] = -1; version_controlled[NEW] = -1; version_controlled[INDEX] = -1; @@ -160,7 +160,7 @@ diff -up patch-2.7.3/src/pch.c.selinux patch-2.7.3/src/pch.c p_rfc934_nesting = 0; p_timestamp[OLD].tv_sec = p_timestamp[NEW].tv_sec = -1; p_says_nonexistent[OLD] = p_says_nonexistent[NEW] = 0; -@@ -876,7 +878,7 @@ intuit_diff_type (bool need_header, mode +@@ -879,7 +881,7 @@ intuit_diff_type (bool need_header, mode } else { @@ -169,7 +169,7 @@ diff -up patch-2.7.3/src/pch.c.selinux patch-2.7.3/src/pch.c if (! stat_errno[i]) { if (lookup_file_id (&st[i]) == DELETE_LATER) -@@ -915,7 +917,7 @@ intuit_diff_type (bool need_header, mode +@@ -918,7 +920,7 @@ intuit_diff_type (bool need_header, mode if (cs) { if (version_get (p_name[i], cs, false, readonly, @@ -178,7 +178,7 @@ diff -up patch-2.7.3/src/pch.c.selinux patch-2.7.3/src/pch.c stat_errno[i] = 0; else version_controlled[i] = 0; -@@ -978,7 +980,7 @@ intuit_diff_type (bool need_header, mode +@@ -981,7 +983,7 @@ intuit_diff_type (bool need_header, mode { if (inname) { @@ -187,7 +187,7 @@ diff -up patch-2.7.3/src/pch.c.selinux patch-2.7.3/src/pch.c if (inerrno || (instat.st_mode & S_IFMT) == file_type) maybe_reverse (inname, inerrno, inerrno || instat.st_size == 0); } -@@ -991,8 +993,14 @@ intuit_diff_type (bool need_header, mode +@@ -994,8 +996,14 @@ intuit_diff_type (bool need_header, mode inerrno = stat_errno[i]; invc = version_controlled[i]; instat = st[i]; @@ -202,10 +202,10 @@ diff -up patch-2.7.3/src/pch.c.selinux patch-2.7.3/src/pch.c return retval; } -diff -up patch-2.7.3/src/util.c.selinux patch-2.7.3/src/util.c ---- patch-2.7.3/src/util.c.selinux 2015-01-22 20:39:08.000000000 +0000 -+++ patch-2.7.3/src/util.c 2015-01-23 11:01:12.859170158 +0000 -@@ -295,6 +295,19 @@ set_file_attributes (char const *to, enu +diff -up patch-2.7.4/src/util.c.selinux patch-2.7.4/src/util.c +--- patch-2.7.4/src/util.c.selinux 2015-01-31 21:14:01.000000000 +0000 ++++ patch-2.7.4/src/util.c 2015-02-01 12:51:16.584224140 +0000 +@@ -300,6 +300,19 @@ set_file_attributes (char const *to, enu S_ISLNK (mode) ? "symbolic link" : "file", quotearg (to)); } @@ -225,7 +225,7 @@ diff -up patch-2.7.3/src/util.c.selinux patch-2.7.3/src/util.c } static void -@@ -458,7 +471,7 @@ move_file (char const *from, bool *from_ +@@ -446,7 +459,7 @@ move_file (char const *from, bool *from_ struct stat to_st; int to_errno; @@ -234,7 +234,7 @@ diff -up patch-2.7.3/src/util.c.selinux patch-2.7.3/src/util.c if (backup) create_backup (to, to_errno ? NULL : &to_st, false); if (! to_errno) -@@ -839,7 +852,8 @@ version_controller (char const *filename +@@ -816,7 +829,8 @@ version_controller (char const *filename Return true if successful. */ bool version_get (char const *filename, char const *cs, bool exists, bool readonly, @@ -244,9 +244,9 @@ diff -up patch-2.7.3/src/util.c.selinux patch-2.7.3/src/util.c { if (patch_get < 0) { -@@ -864,6 +878,13 @@ version_get (char const *filename, char +@@ -841,6 +855,13 @@ version_get (char const *filename, char fatal ("Can't get file %s from %s", quotearg (filename), cs); - if (stat (filename, filestat) != 0) + if (safe_stat (filename, filestat) != 0) pfatal ("%s", quotearg (filename)); + if (filecontext && getfilecon (filename, filecontext) == -1) + { @@ -258,7 +258,7 @@ diff -up patch-2.7.3/src/util.c.selinux patch-2.7.3/src/util.c } return 1; -@@ -1679,12 +1700,28 @@ make_tempfile (char const **name, char l +@@ -1664,12 +1685,28 @@ make_tempfile (char const **name, char l } } @@ -266,7 +266,7 @@ diff -up patch-2.7.3/src/util.c.selinux patch-2.7.3/src/util.c +int stat_file (char const *filename, struct stat *st, security_context_t *con) { int (*xstat)(char const *, struct stat *) = - follow_symlinks ? stat : lstat; + follow_symlinks ? safe_stat : safe_lstat; + int (*xgetfilecon)(char const *, security_context_t *) = + follow_symlinks ? getfilecon : lgetfilecon; + @@ -289,10 +289,10 @@ diff -up patch-2.7.3/src/util.c.selinux patch-2.7.3/src/util.c } /* Check if a filename is relative and free of ".." components. -diff -up patch-2.7.3/src/util.h.selinux patch-2.7.3/src/util.h ---- patch-2.7.3/src/util.h.selinux 2015-01-22 20:30:47.000000000 +0000 -+++ patch-2.7.3/src/util.h 2015-01-23 11:01:49.689364744 +0000 -@@ -45,7 +45,7 @@ char *parse_name (char const *, int, cha +diff -up patch-2.7.4/src/util.h.selinux patch-2.7.4/src/util.h +--- patch-2.7.4/src/util.h.selinux 2015-01-31 21:14:01.000000000 +0000 ++++ patch-2.7.4/src/util.h 2015-02-01 12:46:56.925818147 +0000 +@@ -44,7 +44,7 @@ char *parse_name (char const *, int, cha char *savebuf (char const *, size_t); char *savestr (char const *); char const *version_controller (char const *, bool, struct stat const *, char **, char **); @@ -301,7 +301,7 @@ diff -up patch-2.7.3/src/util.h.selinux patch-2.7.3/src/util.h int create_file (char const *, int, mode_t, bool); int systemic (char const *); char *format_linenum (char[LINENUM_LENGTH_BOUND + 1], lin); -@@ -68,7 +68,7 @@ void insert_file_id (struct stat const * +@@ -67,7 +67,7 @@ void insert_file_id (struct stat const * enum file_id_type lookup_file_id (struct stat const *); void set_queued_output (struct stat const *, bool); bool has_queued_output (struct stat const *); @@ -310,7 +310,7 @@ diff -up patch-2.7.3/src/util.h.selinux patch-2.7.3/src/util.h bool filename_is_safe (char const *); bool cwd_is_root (char const *); -@@ -76,7 +76,8 @@ enum file_attributes { +@@ -75,7 +75,8 @@ enum file_attributes { FA_TIMES = 1, FA_IDS = 2, FA_MODE = 4, diff --git a/patch.spec b/patch.spec index 5466015..8860c98 100644 --- a/patch.spec +++ b/patch.spec @@ -1,6 +1,6 @@ Summary: Utility for modifying/upgrading files Name: patch -Version: 2.7.3 +Version: 2.7.4 Release: 1%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/patch/patch.html @@ -54,6 +54,10 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/*/* %changelog +* Sun Feb 1 2015 Tim Waugh - 2.7.4-1 +- 2.7.4, including a better fix for CVE-2015-1196 that still allows + symlinks referencing ".." to be created. + * Fri Jan 23 2015 Tim Waugh - 2.7.3-1 - 2.7.3 (bug #1182157, CVE-2015-1196, bug #1184491, CVE-2014-9637). diff --git a/sources b/sources index 8d1ed20..b609262 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -29b87be845e4662ab0ca0d48a805ecc6 patch-2.7.3.tar.xz +abc59498fcdddd44e0d07764aa105fd2 patch-2.7.4.tar.xz