diff --git a/SOURCES/cronie-1.4.11-temp-name.patch b/SOURCES/cronie-1.4.11-temp-name.patch new file mode 100644 index 0000000..00291f4 --- /dev/null +++ b/SOURCES/cronie-1.4.11-temp-name.patch @@ -0,0 +1,66 @@ +diff -up cronie-1.4.11/src/crontab.c.temp-name cronie-1.4.11/src/crontab.c +--- cronie-1.4.11/src/crontab.c.temp-name 2016-02-23 15:32:33.754463457 +0100 ++++ cronie-1.4.11/src/crontab.c 2016-02-23 15:33:17.401466818 +0100 +@@ -104,7 +104,7 @@ edit_cmd(void), + poke_daemon(void), + check_error(const char *), parse_args(int c, char *v[]), die(int) ATTRIBUTE_NORETURN; + static int replace_cmd(void), hostset_cmd(void), hostget_cmd(void); +-static char *host_specific_filename(const char *filename, int prefix); ++static char *host_specific_filename(const char *prefix, const char *suffix); + static const char *tmp_path(void); + + static void usage(const char *msg) ATTRIBUTE_NORETURN; +@@ -445,26 +445,27 @@ static const char *tmp_path(void) { + return tmpdir ? tmpdir : "/tmp"; + } + +-static char *host_specific_filename(const char *filename, int prefix) ++static char *host_specific_filename(const char *prefix, const char *suffix) + { + /* + * For cluster-wide use, where there is otherwise risk of the same +- * name being generated on more than one host at once, prefix with +- * "hostname." or suffix with ".hostname" as requested, and return +- * static buffer or NULL on failure. ++ * name being generated on more than one host at once, insert hostname ++ * separated with dots, and return static buffer or NULL on failure. + */ + + static char safename[MAX_FNAME]; +- char hostname[MAXHOSTNAMELEN]; ++ char hostname[MAX_FNAME]; + + if (gethostname(hostname, sizeof hostname) != 0) + return NULL; + + if (prefix) { +- if (!glue_strings(safename, sizeof safename, hostname, filename, '.')) ++ if (!glue_strings(safename, sizeof safename, prefix, hostname, '.')) + return NULL; +- } else { +- if (!glue_strings(safename, sizeof safename, filename, hostname, '.')) ++ strcpy(hostname, safename); ++ } ++ if (suffix) { ++ if (!glue_strings(safename, sizeof safename, hostname, suffix, '.')) + return NULL; + } + +@@ -745,7 +746,7 @@ static int replace_cmd(void) { + char *safename; + + +- safename = host_specific_filename("tmp.XXXXXXXXXX", 1); ++ safename = host_specific_filename("#tmp", "XXXXXXXXXX"); + if (!safename || !glue_strings(TempFilename, sizeof TempFilename, SPOOL_DIR, + safename, '/')) { + TempFilename[0] = '\0'; +@@ -911,7 +912,7 @@ static int hostset_cmd(void) { + if (!HostSpecified) + gethostname(Host, sizeof Host); + +- safename = host_specific_filename("tmp.XXXXXXXXXX", 1); ++ safename = host_specific_filename("#tmp", "XXXXXXXXXX"); + if (!safename || !glue_strings(TempFilename, sizeof TempFilename, SPOOL_DIR, + safename, '/')) { + TempFilename[0] = '\0'; diff --git a/SPECS/cronie.spec b/SPECS/cronie.spec index e2cffa1..b5dbdfd 100644 --- a/SPECS/cronie.spec +++ b/SPECS/cronie.spec @@ -6,7 +6,7 @@ Summary: Cron daemon for executing programs at set times Name: cronie Version: 1.4.11 -Release: 14%{?dist} +Release: 14%{?dist}.1 License: MIT and BSD and ISC and GPLv2+ Group: System Environment/Base URL: https://fedorahosted.org/cronie @@ -19,6 +19,7 @@ Patch4: cronie-check-config-param.patch Patch5: cronie-unitfile.patch Patch6: cronie-1.4.11-refresh-users.patch Patch7: cronie-1.4.11-shutdown-msg.patch +Patch8: cronie-1.4.11-temp-name.patch Requires: dailyjobs @@ -91,6 +92,7 @@ extra features. %patch5 -p1 -b .unitfile %patch6 -p1 -b .refresh-users %patch7 -p1 -b .shutdown-msg +%patch8 -p1 -b .temp-name %build %configure \ @@ -215,6 +217,9 @@ exit 0 %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/cron.d/dailyjobs %changelog +* Tue Jan 23 2016 Tomáš Mráz - 1.4.11-14.1 +- crontab: use temporary filename properly ignored by crond + * Tue Apr 21 2015 Tomáš Mráz - 1.4.11-14 - mark the 0hourly and dailyjobs crontabs as config - properly handle users for whose getpwnam() returns NULL temporarily