From faa2b36e6babeba0b2910bceb1765c918d7c2757 Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Tue, 4 Dec 2012 11:16:41 +0000 Subject: [PATCH] Small error handling improvements in the configuration migration script. --- cups.spec | 80 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 43 insertions(+), 37 deletions(-) diff --git a/cups.spec b/cups.spec index e1b3f9c..bd43172 100644 --- a/cups.spec +++ b/cups.spec @@ -10,7 +10,7 @@ Summary: Common Unix Printing System Name: cups Version: 1.6.1 -Release: 14%{?dist} +Release: 15%{?dist} License: GPLv2 Group: System Environment/Daemons Source: http://ftp.easysw.com/pub/cups/%{version}/cups-%{version}-source.tar.bz2 @@ -393,42 +393,6 @@ s:.*\('%{_datadir}'/\)\([^/_]\+\)\(.*\.po$\):%lang(\2) \1\2\3: %post -# Deal with config migration due to CVE-2012-5519 (STR #4223) -IN=%{_sysconfdir}/cups/cupsd.conf -OUT=%{_sysconfdir}/cups/cups-files.conf -copiedany=no -for keyword in AccessLog CacheDir ConfigFilePerm \ - DataDir DocumentRoot ErrorLog FatalErrors \ - FileDevice FontPath Group LogFilePerm \ - LPDConfigFile PageLog Printcap PrintcapFormat \ - RemoteRoot RequestRoot ServerBin ServerCertificate \ - ServerKey ServerRoot SMBConfigFile StateDir \ - SystemGroup SystemGroupAuthKey TempDir User; do - if ! /bin/grep -iq ^$keyword "$IN"; then continue; fi - copy=yes - if /bin/grep -iq ^$keyword "$OUT"; then - if [ "`/bin/grep -i ^$keyword "$IN"`" == \ - "`/bin/grep -i ^$keyword "$OUT"`" ]; then - copy=no - else - /bin/sed -i -e "s,^$keyword,#$keyword,i" "$OUT" - fi - fi - if [ "$copy" == "yes" ]; then - if [ "$copiedany" == "no" ]; then - cat >> "$OUT" <> "$OUT" - copiedany=yes - fi - - /bin/sed -i -e "s,^$keyword,#$keyword,i" "$IN" -done - %systemd_post %{name}.path %{name}.socket %{name}.service # Remove old-style certs directory; new-style is /var/run @@ -451,6 +415,44 @@ done --slave %{_mandir}/man1/lpstat.1.gz print-lpstatman %{_mandir}/man1/lpstat-cups.1.gz %endif rm -f %{_localstatedir}/cache/cups/*.ipp %{_localstatedir}/cache/cups/*.cache + +# Deal with config migration due to CVE-2012-5519 (STR #4223) +IN=%{_sysconfdir}/cups/cupsd.conf +OUT=%{_sysconfdir}/cups/cups-files.conf +copiedany=no +for keyword in AccessLog CacheDir ConfigFilePerm \ + DataDir DocumentRoot ErrorLog FatalErrors \ + FileDevice FontPath Group LogFilePerm \ + LPDConfigFile PageLog Printcap PrintcapFormat \ + RemoteRoot RequestRoot ServerBin ServerCertificate \ + ServerKey ServerRoot SMBConfigFile StateDir \ + SystemGroup SystemGroupAuthKey TempDir User; do + if ! /bin/grep -iq ^$keyword "$IN"; then continue; fi + copy=yes + if /bin/grep -iq ^$keyword "$OUT"; then + if [ "`/bin/grep -i ^$keyword "$IN"`" == \ + "`/bin/grep -i ^$keyword "$OUT"`" ]; then + copy=no + else + /bin/sed -i -e "s,^$keyword,#$keyword,i" "$OUT" || : + fi + fi + if [ "$copy" == "yes" ]; then + if [ "$copiedany" == "no" ]; then + (cat >> "$OUT" <> "$OUT") || : + copiedany=yes + fi + + /bin/sed -i -e "s,^$keyword,#$keyword,i" "$IN" || : +done + exit 0 %post libs -p /sbin/ldconfig @@ -623,6 +625,10 @@ rm -f %{cups_serverbin}/backend/smb %{_mandir}/man5/ipptoolfile.5.gz %changelog +* Tue Dec 4 2012 Tim Waugh 1:1.6.1-15 +- Small error handling improvements in the configuration migration + script. + * Mon Dec 3 2012 Jiri Popelka 1:1.6.1-14 - move ipptoolfile(5) to ipptool subpackage