From c65246e094527163ee0b2003041ff6c942e14e47 Mon Sep 17 00:00:00 2001 From: Tomas Mraz Date: Sep 09 2015 12:07:23 +0000 Subject: clear non-job files from at dir --- diff --git a/at-3.1.16-clear-nonjobs.patch b/at-3.1.16-clear-nonjobs.patch new file mode 100644 index 0000000..05fc2c2 --- /dev/null +++ b/at-3.1.16-clear-nonjobs.patch @@ -0,0 +1,42 @@ +diff -up at-3.1.16/atd.c.clear-nonjobs at-3.1.16/atd.c +--- at-3.1.16/atd.c.clear-nonjobs 2014-12-11 10:32:24.000000000 +0100 ++++ at-3.1.16/atd.c 2015-09-09 11:40:22.544679351 +0200 +@@ -414,10 +414,22 @@ run_file(const char *filename, uid_t uid + sprintf(fmt, "#!/bin/sh\n# atrun uid=%%d gid=%%d\n# mail %%%ds %%d", + mailsize ); + ++ /* Unlink the file unless there was an error reading it (perhaps ++ * temporary). ++ * If the file has a bogus format there is no reason in trying ++ * to run it again and again. ++ */ + if (fscanf(stream, fmt, +- &nuid, &ngid, mailname, &send_mail) != 4) +- pabort("File %.500s is in wrong format - aborting", +- filename); ++ &nuid, &ngid, mailname, &send_mail) != 4) { ++ if (ferror(stream)) ++ perr("Error reading the job file"); ++ ++ unlink(filename); ++ pabort("File %.500s is in wrong format - aborting", ++ filename); ++ } ++ ++ unlink(filename); + + if (mailname[0] == '-') + pabort("illegal mail name %.300s in job %8lu (%.300s)", mailname, +@@ -427,12 +439,6 @@ run_file(const char *filename, uid_t uid + pabort("Job %8lu (%.500s) - userid %d does not match file uid %d", + jobno, filename, nuid, uid); + +- /* We are now committed to executing this script. Unlink the +- * original. +- */ +- +- unlink(filename); +- + fclose(stream); + if (chdir(ATSPOOL_DIR) < 0) + perr("Cannot chdir to " ATSPOOL_DIR); diff --git a/at.spec b/at.spec index a541dc6..694999b 100644 --- a/at.spec +++ b/at.spec @@ -3,7 +3,7 @@ Summary: Job spooling tools Name: at Version: 3.1.16 -Release: 6%{?dist} +Release: 7%{?dist} # http://packages.debian.org/changelogs/pool/main/a/at/current/copyright # + install-sh is MIT license with changes under Public Domain License: GPLv3+ and GPLv2+ and ISC and MIT and Public Domain @@ -29,6 +29,7 @@ Patch10: at-3.1.14-usePOSIXtimers.patch Patch12: at-3.1.14-wrong_format.patch Patch13: at-3.1.16-noabort.patch Patch14: at-3.1.16-fclose-error.patch +Patch15: at-3.1.16-clear-nonjobs.patch BuildRequires: fileutils /etc/init.d BuildRequires: flex flex-static bison autoconf @@ -77,6 +78,7 @@ cp %{SOURCE1} . %patch12 -p1 -b .wrong %patch13 -p1 -b .noabort %patch14 -p1 -b .fclose +%patch15 -p1 -b .clear-nojobs %build # patch9 touches configure.in @@ -174,6 +176,9 @@ chown daemon:daemon %{_localstatedir}/spool/at/.SEQ %attr(0644,root,root) /%{_unitdir}/atd.service %changelog +* Wed Sep 9 2015 Tomáš Mráz - 3.1.16-7 +- clear non-job files from at dir + * Wed Jun 17 2015 Fedora Release Engineering - 3.1.16-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild