Compare commits

..

29 commits

Author SHA1 Message Date
Ondřej Pohořelský
f412c7853b Use systemd_tmpfiles to create files in /var directory
This is needed so Cronie works as expected in bootc
2025-12-17 12:05:29 +01:00
Ondřej Pohořelský
4a2f558b36 Forward XDG_SESSION_CLASS to PAM for session classification 2025-12-08 11:41:07 +01:00
Ondřej Pohořelský
05b2e8364b Fix backup failure when ~/.cache directory is missing 2025-08-06 15:26:33 +02:00
Fedora Release Engineering
d933913cca Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild 2025-07-23 18:50:18 +00:00
Ondřej Pohořelský
480a306600 tests: migrate from STI to TMT
Related: https://fedoraproject.org/wiki/Changes/DisableSTI
2025-07-07 15:59:57 +02:00
Ondřej Pohořelský
e32eaecd64 Move parsing code before separator check 2025-05-13 07:56:02 +02:00
Ondřej Pohořelský
c4ababaa6b Install crond.service into /usr/lib
The old installation path (bare /lib prefix) is probably a leftover
from before the /usr path migration.
2025-04-23 10:06:35 +02:00
Ondřej Pohořelský
cecc2437a1 Fix range parsing
Adds patch from this PR:
https://github.com/cronie-crond/cronie/pull/200
2025-04-07 18:52:00 +02:00
Ondřej Pohořelský
016dbce149 Remove sbin mentions from spec file 2025-01-27 14:59:43 +01:00
Ondřej Pohořelský
7bb78d8b2c Resolve build failure with GCC15 2025-01-27 14:46:00 +01:00
Fedora Release Engineering
d49463ff02 Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild 2025-01-16 14:52:49 +00:00
Ondřej Pohořelský
3efab80e2b Create anacron timestamp files with correct permissions 2024-12-09 16:24:40 +01:00
Fedora Release Engineering
a2b306c77a Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild 2024-07-17 20:12:45 +00:00
Jan Staněk
218115d9c9
Update to version 1.7.2 (rhbz#2294896)
- Polish bconds to use newer macros
- Patch leaks found by SAST scan
2024-07-01 14:59:23 +02:00
Ondřej Pohořelský
cfe037d46d Update to 1.7.1 2024-02-26 09:37:41 +01:00
Fedora Release Engineering
e5066e37c1 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-24 08:26:38 +00:00
Fedora Release Engineering
4800cc2ef5 Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild 2024-01-19 16:22:36 +00:00
Ondřej Pohořelský
c47c5cbbbe Adds -n option: wait on finnishing grandchild process
https://github.com/cronie-crond/cronie/pull/163
2024-01-02 11:16:09 +01:00
Ondřej Pohořelský
550f5c0f69 update to 1.7.0 2023-10-17 11:31:30 +02:00
Ondřej Pohořelský
edd602e23d Add -n option for crontab entries
In order to test this new feature before cronie upstream tags a new
version, I'm adding this patch directly. Now you can suppress mails
from crontabs when the job is successful.

This is done by using '-n' option in your crontab:
`* * * * * -n foo.sh`
2023-10-06 14:56:39 +02:00
Ondřej Pohořelský
a8c6ca5cdc Fixes indentation for one BuildRequire 2023-10-06 14:46:11 +02:00
Jan Staněk
dd16ce2491 Convert to %autorelease and %autochangelog
[skip changelog]
2023-09-11 13:55:34 +02:00
Jan Staněk
7d870efd9f
Migrated to SPDX license 2023-09-11 13:53:37 +02:00
Fedora Release Engineering
68c70a48c4 Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-07-19 16:36:11 +00:00
Fedora Release Engineering
af0ae624b5 Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-01-19 00:40:56 +00:00
Fedora Release Engineering
1baaa671fb Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-07-20 23:45:34 +00:00
Jan Staněk
28598172a8
Set 'missingok' for /etc/cron.deny
If the file was already deleted by administrator,
we do not want to recreate it on reinstall or update.
2022-06-28 16:18:28 +02:00
Ondřej Pohořelský
53825b708d New upstream release 1.6.1 2022-05-02 14:19:33 +02:00
Ondřej Pohořelský
8c06378e43 New upstream release 1.6.0 2022-03-22 16:43:27 +01:00
65 changed files with 951 additions and 1356 deletions

1
.fmf/version Normal file
View file

@ -0,0 +1 @@
1

9
.gitignore vendored
View file

@ -1,8 +1 @@
/cronie-1.5.0.tar.gz
/cronie-1.5.1.tar.gz
/cronie-1.5.2.tar.gz
/cronie-1.5.3.tar.gz
/cronie-1.5.4.tar.gz
/cronie-1.5.5.tar.gz
/cronie-1.5.6.tar.gz
/cronie-1.5.7.tar.gz
/cronie-*.tar.gz

View file

@ -1,114 +0,0 @@
From 09afe49c73cb495f32b96dce32728352c46ba865 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= <jstanek@redhat.com>
Date: Thu, 29 Apr 2021 16:03:05 +0200
Subject: [PATCH] Address issues found by coverity scan
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jan Staněk <jstanek@redhat.com>
---
anacron/main.c | 8 ++++++--
anacron/runjob.c | 2 ++
src/crontab.c | 1 +
src/database.c | 3 ++-
src/pw_dup.c | 1 +
5 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/anacron/main.c b/anacron/main.c
index d092970..65f8fed 100644
--- a/anacron/main.c
+++ b/anacron/main.c
@@ -44,8 +44,8 @@ int day_now;
int year, month, day_of_month; /* date anacron started */
char *program_name;
-char *anacrontab;
-char *spooldir;
+char *anacrontab = NULL;
+char *spooldir = NULL;
int serialize, force, update_only, now,
no_daemon, quiet, testing_only; /* command-line options */
char **job_args; /* vector of "job" command-line arguments */
@@ -128,12 +128,14 @@ parse_opts(int argc, char *argv[])
quiet = 1;
break;
case 't':
+ free(anacrontab);
anacrontab = strdup(optarg);
break;
case 'T':
testing_only = 1;
break;
case 'S':
+ free(spooldir);
spooldir = strdup(optarg);
break;
case 'V':
@@ -208,9 +210,11 @@ go_background(void)
/* stdin is already closed */
if (fclose(stdout)) die_e("Can't close stdout");
+ /* coverity[leaked_handle] fd 1 closed automatically */
xopen(1, "/dev/null", O_WRONLY);
if (fclose(stderr)) die_e("Can't close stderr");
+ /* coverity[leaked_handle] fd 2 closed automatically */
xopen(2, "/dev/null", O_WRONLY);
pid = xfork();
diff --git a/anacron/runjob.c b/anacron/runjob.c
index 341351f..04d6904 100644
--- a/anacron/runjob.c
+++ b/anacron/runjob.c
@@ -237,7 +237,9 @@ launch_mailer(job_rec *jr)
xcloselog();
/* Ensure stdout/stderr are sane before exec-ing sendmail */
+ /* coverity[leaked_handle] STDOUT closed automatically */
xclose(STDOUT_FILENO); xopen(STDOUT_FILENO, "/dev/null", O_WRONLY);
+ /* coverity[leaked_handle] STDERR closed automatically */
xclose(STDERR_FILENO); xopen(STDERR_FILENO, "/dev/null", O_WRONLY);
xclose(jr->output_fd);
diff --git a/src/crontab.c b/src/crontab.c
index 240c112..41c8984 100644
--- a/src/crontab.c
+++ b/src/crontab.c
@@ -872,6 +872,7 @@ static int replace_cmd(void) {
if ((error = check_syntax(tmp)) < 0) {
fprintf(stderr, "Invalid crontab file, can't install.\n");
+ fclose(tmp);
goto done;
}
diff --git a/src/database.c b/src/database.c
index c1e4593..bff0256 100644
--- a/src/database.c
+++ b/src/database.c
@@ -559,7 +559,8 @@ int load_database(cron_db * old_db) {
if (not_a_crontab(dp))
continue;
- strncpy(fname, dp->d_name, NAME_MAX + 1);
+ strncpy(fname, dp->d_name, NAME_MAX);
+ fname[NAME_MAX] = '\0';
if (!glue_strings(tabname, sizeof tabname, SPOOL_DIR, fname, '/'))
continue; /* XXX log? */
diff --git a/src/pw_dup.c b/src/pw_dup.c
index ea787cd..c6f7b00 100644
--- a/src/pw_dup.c
+++ b/src/pw_dup.c
@@ -121,6 +121,7 @@ pw_dup(const struct passwd *pw) {
cp += ssize;
}
+ /* cppcheck-suppress[memleak symbolName=cp] memory originally pointed to by cp returned via newpw */
return (newpw);
}
--
2.31.1

View file

@ -0,0 +1,61 @@
From b3a54d0b3561bc2ab46c11fd5c67350cc216b171 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= <jstanek@redhat.com>
Date: Wed, 26 Jun 2024 16:08:44 +0200
Subject: [PATCH] Do not leak file descriptors in backup_crontab
Originally, if anything went wrong during the backup,
the early return caused the crontab_file and possibly backup_file
pointers to leak.
Issue found by static scanner.
---
src/crontab.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/src/crontab.c b/src/crontab.c
index f61fd46..55d2aed 100644
--- a/src/crontab.c
+++ b/src/crontab.c
@@ -563,6 +563,7 @@ static int backup_crontab(const char *crontab_path) {
if (swap_uids() == -1) {
perror("swapping uids");
+ (void) fclose(crontab_file);
exit(ERROR_EXIT);
}
@@ -590,22 +591,29 @@ static int backup_crontab(const char *crontab_path) {
if (swap_uids_back() < OK) {
perror("swapping uids back");
+ if (backup_file != NULL) {
+ (void) fclose(backup_file);
+ }
+ (void) fclose(crontab_file);
exit(ERROR_EXIT);
}
if (retval != 0)
- return retval;
+ goto cleanup;
if (EOF != ch)
while (EOF != (ch = get_char(crontab_file)))
putc(ch, backup_file);
- (void) fclose(crontab_file);
- (void) fclose(backup_file);
-
printf("Backup of %s's previous crontab saved to %s\n", User, backup_path);
- return 0;
+cleanup:
+ if (backup_file != NULL) {
+ (void) fclose(backup_file);
+ }
+ (void) fclose(crontab_file);
+
+ return retval;
}
static void check_error(const char *msg) {

376
changelog Normal file
View file

@ -0,0 +1,376 @@
* Mon Sep 11 2023 Jan Staněk <jstanek@redhat.com> - 1.6.1-6
- Migrated to SPDX license
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.6.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.6.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Wed Jul 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.6.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Tue Jun 28 2022 Jan Staněk <jstanek@redhat.com> - 1.6.1-2
- Set 'missingok' for /etc/cron.deny to not recreate it on update
* Mon May 02 2022 Ondřej Pohořelský <opohorel@redhat.com> - 1.6.1-1
- New upstream release 1.6.1
* Tue Mar 22 2022 Ondřej Pohořelský <opohorel@redhat.com> - 1.6.0-1
- New upstream release 1.6.0
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.7-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.7-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Fri Apr 30 2021 Jan Staněk <jstanek@redhat.com> - 1.5.7-2
- Address issues found by static scanners
* Mon Mar 29 2021 Tomáš Mráz <tmraz@fedoraproject.org> - 1.5.7-1
- new upstream release 1.5.7 with bug fixes and enhancements
* Wed Mar 17 2021 Tomáš Mráz <tmraz@fedoraproject.org> - 1.5.6-1
- new upstream release 1.5.6 with bug fixes and enhancements
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.5-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.5-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Mon Jul 13 2020 Tom Stellard <tstellar@redhat.com> - 1.5.5-3
- Use make macros
- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Oct 31 2019 Tomáš Mráz <tmraz@redhat.com> - 1.5.5-1
- new upstream release 1.5.5 with multiple bug fixes and improvements
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Mon Mar 18 2019 Tomáš Mráz <tmraz@redhat.com> - 1.5.4-1
- new upstream release 1.5.4 with regression fix
* Fri Mar 15 2019 Tomáš Mráz <tmraz@redhat.com> - 1.5.3-1
- new upstream release 1.5.3 fixing CVE-2019-9704 and CVE-2019-9705
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Nov 30 2018 Tomáš Mráz <tmraz@redhat.com> - 1.5.2-4
- Do not hard-require systemd as crond is used in containers without
systemd (#1654659)
* Wed Oct 31 2018 Tomáš Mráz <tmraz@redhat.com> - 1.5.2-3
- use role from the current context for system crontabs (#1639381)
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Thu May 3 2018 Tomáš Mráz <tmraz@redhat.com> - 1.5.2-1
- new upstream release 1.5.2
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.1-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.1-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Thu May 4 2017 Tomáš Mráz <tmraz@redhat.com> - 1.5.1-6
- fix Y2038 problems in cron and anacron (#1445136)
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Tue Jan 3 2017 Tomáš Mráz <tmraz@redhat.com> - 1.5.1-4
- make failure of creation of the ghost files in /var non-fatal
* Mon Sep 5 2016 Tomáš Mráz <tmraz@redhat.com> - 1.5.1-3
- on some machines the power supply is named ADP0
* Tue Aug 23 2016 Tomáš Mráz <tmraz@redhat.com> - 1.5.1-2
- query power status directly from kernel
* Thu Jun 23 2016 Tomáš Mráz <tmraz@redhat.com> - 1.5.1-1
- new upstream release
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Mon Jul 13 2015 Tomáš Mráz <tmraz@redhat.com> - 1.5.0-3
- the temp file name used by crontab needs to be ignored by crond
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.5.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Thu May 28 2015 Tomáš Mráz <tmraz@redhat.com> - 1.5.0-1
- new upstream release
* Tue Apr 21 2015 Tomáš Mráz <tmraz@redhat.com> - 1.4.12-6
- mark the 0hourly and dailyjobs crontabs as config
- do not add already existing orphan on reload
* Tue Feb 3 2015 Tomáš Mráz <tmraz@redhat.com> - 1.4.12-5
- correct the permissions of the anacron timestamp files
* Fri Jan 2 2015 Tomáš Mráz <tmraz@redhat.com> - 1.4.12-4
- check for NULL pamh on two more places (#1176215)
* Tue Dec 2 2014 Tomáš Mráz <tmraz@redhat.com> - 1.4.12-3
- call PAM only for non-root user or non-system crontabs (#956157)
- bypass the PAM check in crontab for root (#1169175)
* Tue Nov 4 2014 Tomáš Mráz <tmraz@redhat.com> - 1.4.12-2
- refresh user entries when jobs are run
* Wed Sep 17 2014 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.12-1
- new release 1.4.12
- remove gpl2 license, because it's part of upstream COPYING now
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.11-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Fri Jul 11 2014 Tom Callaway <spot@fedoraproject.org> - 1.4.11-8
- fix license handling
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.11-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Wed Apr 30 2014 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.11-6
- unwanted fd could make trouble to SElinux 1075106
* Thu Jan 16 2014 Ville Skyttä <ville.skytta@iki.fi> - 1.4.11-5
- Drop INSTALL from docs, fix rpmlint tabs vs spaces warning.
* Wed Sep 25 2013 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.11-4
- some jobs are not executed because not all environment variables are set 995590
- cronie's systemd script use "KillMode=process" 919290
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.11-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Mon Jul 22 2013 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.11-2
- scriptlets are not created correctly if systemd is not in BR 986698
- remove sub-package sysvinit, which is not needed anymore
- update license, anacron is under GPLv2+
* Thu Jul 18 2013 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.11-1
- new release 1.4.11 (contains previous bug fixes from 1.4.10-5)
* Tue Jun 11 2013 Tomáš Mráz <tmraz@redhat.com> - 1.4.10-5
- add support for RANDOM_DELAY - delaying job startups
- pass some environment variables to processes (LANG, etc.) (#969761)
- do not use putenv() with string literals (#971516)
* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.10-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Wed Jan 2 2013 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.10-3
- change configuration files to 644
- change 6755 to 4755 for crontab binary
* Tue Nov 27 2012 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.10-1
- New release 1.4.10
* Thu Nov 22 2012 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.9-1
- New release 1.4.9
* Wed Sep 05 2012 Václav Pavlín <vpavlin@redhat.com> - 1.4.8-13
- Scriptlets replaced with new systemd macros (#850070)
* Fri Jul 27 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.8-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.8-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Wed Oct 26 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.8-10
- Rebuilt for glibc bug#747377
* Tue Oct 25 2011 Tomáš Mráz <tmraz@redhat.com> - 1.4.8-9
- make crond run a little bit later in the boot process (#747759)
* Mon Oct 17 2011 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.8-8
- change triggerun to fix 735802 during upgrade
* Wed Jul 27 2011 Karsten Hopp <karsten@redhat.com> 1.4.8-7
- rebuild again, ppc still had the broken rpm in the buildroots
* Thu Jul 21 2011 Rex Dieter <rdieter@fedoraproject.org> 1.4.8-6
- rebuild (broken rpm in buildroot)
* Thu Jul 21 2011 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.8-5
- fix permission of init.d/crond
* Thu Jun 30 2011 Tomáš Mráz <tmraz@redhat.com> - 1.4.8-4
- drop the without systemd build condition
- add the chkconfig readding trigger to the sysvinit subpackage
* Wed Jun 29 2011 Tomáš Mráz <tmraz@redhat.com> - 1.4.8-3
- start crond after auditd
* Wed Jun 29 2011 Tomáš Mráz <tmraz@redhat.com> - 1.4.8-2
- fix inotify support to not leak fds (#717505)
* Tue Jun 28 2011 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.8-1
- update to 1.4.8
- create sub-package sysvinit for initscript
* Mon May 9 2011 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.7-3
- missing requirement on systemd-sysv for scriptlets
* Thu May 05 2011 Tomáš Mráz <tmraz@redhat.com> - 1.4.7-2
- use only systemd units with systemd
- add trigger for restart on glibc, libselinux or pam upgrades (#699189)
* Tue Mar 15 2011 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.7-1
- new release 1.4.7
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.6-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Mon Jan 17 2011 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.6-8
- enable crond even with systemctl
* Thu Dec 16 2010 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.6-7
- 663193 rewritten selinux support
* Wed Dec 15 2010 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.6-6
- apply selinux patch from dwalsh
* Fri Dec 10 2010 Tomas Mraz <tmraz@redhat.com> - 1.4.6-5
- do not lock jobs that fall out of allowed range - 661966
* Thu Dec 02 2010 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.6-4
- fix post (thanks plautrba for review)
* Tue Nov 30 2010 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.6-3
- systemd init script 617320
* Tue Nov 30 2010 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.6-2
- fix typos in man pages
* Fri Oct 22 2010 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.6-1
- update to 1.4.6
* Fri Aug 13 2010 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.5-4
- 623908 fix fd leak in anacron, which caused denail of prelink
and others
* Mon Aug 9 2010 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.5-2
- remove sendmail from requirements. If it's not installed, it will
log into (r)syslog.
* Mon Aug 2 2010 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.5-1
- update to new release
* Fri Feb 19 2010 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.4-1
- update to new release
* Mon Feb 15 2010 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.3-3
- 564894 FTBFS DSOLinking
* Thu Nov 5 2009 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.3-2
- 533189 pam needs add a line and selinux needs defined one function
* Fri Oct 30 2009 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.3-1
- 531963 and 532482 creating noanacron package
* Mon Oct 19 2009 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.2-2
- 529632 service crond stop returns appropriate value
* Mon Oct 12 2009 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.2-1
- new release
* Fri Aug 21 2009 Tomas Mraz <tmraz@redhat.com> - 1.4.1-3
- rebuilt with new audit
* Fri Aug 14 2009 Tomas Mraz <tmraz@redhat.com> - 1.4.1-2
- create the anacron timestamps in correct post script
* Fri Aug 14 2009 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.1-1
- update to 1.4.1
- create and own /var/spool/anacron/cron.{daily,weekly,monthly} to
remove false warning about non existent files
- Resolves: 517398
* Wed Aug 5 2009 Tomas Mraz <tmraz@redhat.com> - 1.4-4
- 515762 move anacron provides and obsoletes to the anacron subpackage
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Mon Jul 20 2009 Marcela Mašláňová <mmaslano@redhat.com> - 1.4-2
- merge cronie and anacron in new release of cronie
- obsolete/provide anacron in spec
* Thu Jun 18 2009 Marcela Mašláňová <mmaslano@redhat.com> - 1.3-2
- 506560 check return value of access
* Mon Apr 27 2009 Marcela Mašláňová <mmaslano@redhat.com> - 1.3-1
- new release
* Fri Apr 24 2009 Marcela Mašláňová <mmaslano@redhat.com> - 1.2-8
- 496973 close file descriptors after exec
* Mon Mar 9 2009 Tomas Mraz <tmraz@redhat.com> - 1.2-7
- rebuild
* Tue Feb 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
* Tue Dec 23 2008 Marcela Mašláňová <mmaslano@redhat.com> - 1.2-5
- 477100 NO_FOLLOW was removed, reload after change in symlinked
crontab is needed, man updated.
* Fri Oct 24 2008 Marcela Mašláňová <mmaslano@redhat.com> - 1.2-4
- update init script
* Thu Sep 25 2008 Marcela Maslanova <mmaslano@redhat.com> - 1.2-3
- add sendmail file into requirement, cause it's needed some MTA
* Thu Sep 18 2008 Marcela Maslanova <mmaslano@redhat.com> - 1.2-2
- 462252 /etc/sysconfig/crond does not need to be executable
* Thu Jun 26 2008 Marcela Maslanova <mmaslano@redhat.com> - 1.2-1
- update to 1.2
* Tue Jun 17 2008 Tomas Mraz <tmraz@redhat.com> - 1.1-3
- fix setting keycreate context
- unify logging a bit
- cleanup some warnings and fix a typo in TZ code
- 450993 improve and fix inotify support
* Wed Jun 4 2008 Marcela Maslanova <mmaslano@redhat.com> - 1.1-2
- 49864 upgrade/update problem. Syntax error in spec.
* Wed May 28 2008 Marcela Maslanova <mmaslano@redhat.com> - 1.1-1
- release 1.1
* Tue May 20 2008 Marcela Maslanova <mmaslano@redhat.com> - 1.0-6
- 446360 check for lock didn't call chkconfig
* Tue Feb 12 2008 Marcela Maslanova <mmaslano@redhat.com> - 1.0-5
- upgrade from less than cronie-1.0-4 didn't add chkconfig
* Wed Feb 6 2008 Marcela Maslanova <mmaslano@redhat.com> - 1.0-4
- 431366 after reboot wasn't cron in chkconfig
* Tue Feb 5 2008 Marcela Maslanova <mmaslano@redhat.com> - 1.0-3
- 431366 trigger part => after update from vixie-cron on cronie will
be daemon running.
* Wed Jan 30 2008 Marcela Maslanova <mmaslano@redhat.com> - 1.0-2
- change the provides on higher version than obsoletes
* Tue Jan 8 2008 Marcela Maslanova <mmaslano@redhat.com> - 1.0-1
- packaging cronie
- thank's for help with packaging to my reviewers

View file

@ -0,0 +1,9 @@
# systemd-tmpfiles configuration for cronie-anacron
# Create the anacron spool directory
d /var/spool/anacron 0755 root root -
# Create anacron timestamp files
f /var/spool/anacron/cron.daily 0600 root root -
f /var/spool/anacron/cron.weekly 0600 root root -
f /var/spool/anacron/cron.monthly 0600 root root -

4
cronie-tmpfiles.conf Normal file
View file

@ -0,0 +1,4 @@
# systemd-tmpfiles configuration for cronie
# Create the cron spool directory
d /var/spool/cron 0700 root root -

View file

@ -1,17 +1,29 @@
%bcond_without selinux
%bcond_without pam
%bcond_without audit
%bcond_without inotify
%bcond selinux 1
%bcond pam 1
%bcond audit 1
%bcond inotify 1
Summary: Cron daemon for executing programs at set times
Name: cronie
Version: 1.5.7
Release: 5%{?dist}
License: MIT and BSD and ISC and GPLv2+
Version: 1.7.2
Release: %autorelease
License: GPL-2.0-or-later AND BSD-3-Clause AND BSD-2-Clause AND ISC AND LGPL-2.1-or-later
URL: https://github.com/cronie-crond/cronie
Source0: https://github.com/cronie-crond/cronie/releases/download/cronie-%{version}/cronie-%{version}.tar.gz
Source1: cronie-tmpfiles.conf
Source2: cronie-anacron-tmpfiles.conf
Patch: 0001-Address-issues-found-by-coverity-scan.patch
Patch: 0001-do-no-leak-file-descriptors.patch
# https://github.com/cronie-crond/cronie/issues/193
Patch: make_error_func_prototype_complete.patch
# https://github.com/cronie-crond/cronie/pull/200
Patch: fix_range_parsing.patch
# https://github.com/cronie-crond/cronie/pull/201
Patch: move_parsing_code.patch
# https://github.com/cronie-crond/cronie/pull/206
Patch: crontab-fix-backup-failure.patch
# https://github.com/cronie-crond/cronie/pull/210
Patch: forward-XDG_SESSION_CLASS-to-PAM-for-session-classification.patch
Requires: dailyjobs
@ -29,7 +41,7 @@ Buildrequires: audit-libs-devel >= 1.4.1
BuildRequires: gcc
BuildRequires: systemd
BuildRequires: make
BuildRequires: make
Obsoletes: %{name}-sysvinit
Requires(post): coreutils sed
@ -82,27 +94,18 @@ extra features.
%build
%configure \
%if %{with pam}
--with-pam \
%endif
%if %{with selinux}
--with-selinux \
%endif
%if %{with audit}
--with-audit \
%endif
%if %{with inotify}
--with-inotify \
%endif
--enable-anacron \
--enable-pie \
--enable-relro
%{?with_pam:--with-pam} \
%{?with_selinux:--with-selinux} \
%{?with_audit:--with-audit} \
%{?with_inotify:--with-inotify} \
--enable-anacron \
--enable-pie \
--enable-relro
%make_build V=2
%install
%make_install DESTMAN=$RPM_BUILD_ROOT%{_mandir}
mkdir -pm700 $RPM_BUILD_ROOT%{_localstatedir}/spool/cron
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/
mkdir -pm755 $RPM_BUILD_ROOT%{_sysconfdir}/cron.d/
%if ! %{with pam}
@ -114,26 +117,26 @@ install -m 644 contrib/anacrontab $RPM_BUILD_ROOT%{_sysconfdir}/anacrontab
install -c -m755 contrib/0hourly $RPM_BUILD_ROOT%{_sysconfdir}/cron.d/0hourly
mkdir -pm 755 $RPM_BUILD_ROOT%{_sysconfdir}/cron.hourly
install -c -m755 contrib/0anacron $RPM_BUILD_ROOT%{_sysconfdir}/cron.hourly/0anacron
mkdir -p $RPM_BUILD_ROOT/var/spool/anacron
touch $RPM_BUILD_ROOT/var/spool/anacron/cron.daily
touch $RPM_BUILD_ROOT/var/spool/anacron/cron.weekly
touch $RPM_BUILD_ROOT/var/spool/anacron/cron.monthly
# noanacron package
install -m 644 contrib/dailyjobs $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/dailyjobs
# install systemd initscript
mkdir -p $RPM_BUILD_ROOT/lib/systemd/system/
install -m 644 contrib/cronie.systemd $RPM_BUILD_ROOT/lib/systemd/system/crond.service
install -m 644 -D contrib/cronie.systemd $RPM_BUILD_ROOT/usr/lib/systemd/system/crond.service
# install tmpfiles.d configuration for bootc compatibility
install -m 644 -D %{SOURCE1} $RPM_BUILD_ROOT%{_tmpfilesdir}/cronie.conf
install -m 644 -D %{SOURCE2} $RPM_BUILD_ROOT%{_tmpfilesdir}/cronie-anacron.conf
%post
# run after an installation
%systemd_post crond.service
# create directories via tmpfiles.d for bootc compatibility
systemd-tmpfiles --create %{_tmpfilesdir}/cronie.conf 2>/dev/null || :
%post anacron
[ -e /var/spool/anacron/cron.daily ] || touch /var/spool/anacron/cron.daily 2>/dev/null || :
[ -e /var/spool/anacron/cron.weekly ] || touch /var/spool/anacron/cron.weekly 2>/dev/null || :
[ -e /var/spool/anacron/cron.monthly ] || touch /var/spool/anacron/cron.monthly 2>/dev/null || :
# create directories and files via tmpfiles.d for bootc compatibility
systemd-tmpfiles --create %{_tmpfilesdir}/cronie-anacron.conf 2>/dev/null || :
%preun
# run before a package is removed
@ -161,7 +164,7 @@ exit 0
# The package is allowed to autostart:
/bin/systemctl enable crond.service >/dev/null 2>&1
/sbin/chkconfig --del crond >/dev/null 2>&1 || :
/bin/chkconfig --del crond >/dev/null 2>&1 || :
/bin/systemctl try-restart crond.service >/dev/null 2>&1 || :
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
@ -174,7 +177,7 @@ exit 0
%doc AUTHORS README ChangeLog
%{!?_licensedir:%global license %%doc}
%license COPYING
%attr(755,root,root) %{_sbindir}/crond
%attr(755,root,root) %{_bindir}/crond
%attr(4755,root,root) %{_bindir}/crontab
%attr(755,root,root) %{_bindir}/cronnext
%{_mandir}/man8/crond.*
@ -182,7 +185,6 @@ exit 0
%{_mandir}/man5/crontab.*
%{_mandir}/man1/crontab.*
%{_mandir}/man1/cronnext.*
%dir %{_localstatedir}/spool/cron
%dir %{_sysconfdir}/cron.d
%if %{with pam}
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/pam.d/crond
@ -190,378 +192,24 @@ exit 0
%config(noreplace) %{_sysconfdir}/sysconfig/crond
%config(noreplace,missingok) %{_sysconfdir}/cron.deny
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/cron.d/0hourly
%attr(0644,root,root) /lib/systemd/system/crond.service
%attr(0644,root,root) /usr/lib/systemd/system/crond.service
%{_tmpfilesdir}/cronie.conf
%ghost %dir %attr(0700,root,root) %{_localstatedir}/spool/cron
%files anacron
%{_sbindir}/anacron
%{_bindir}/anacron
%attr(0755,root,root) %{_sysconfdir}/cron.hourly/0anacron
%config(noreplace) %{_sysconfdir}/anacrontab
%dir /var/spool/anacron
%ghost %dir %attr(0755,root,root) /var/spool/anacron
%ghost %attr(0600,root,root) %verify(not md5 size mtime) /var/spool/anacron/cron.daily
%ghost %attr(0600,root,root) %verify(not md5 size mtime) /var/spool/anacron/cron.weekly
%ghost %attr(0600,root,root) %verify(not md5 size mtime) /var/spool/anacron/cron.monthly
%{_mandir}/man5/anacrontab.*
%{_mandir}/man8/anacron.*
%{_tmpfilesdir}/cronie-anacron.conf
%files noanacron
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/cron.d/dailyjobs
%changelog
* Tue Jun 28 2022 Jan Staněk <jstanek@redhat.com> - 1.5.7-5
- Set 'missingok' for /etc/cron.deny to not recreate it on update
* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.7-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Wed Jul 21 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.7-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Fri Apr 30 2021 Jan Staněk <jstanek@redhat.com> - 1.5.7-2
- Address issues found by static scanners
* Mon Mar 29 2021 Tomáš Mráz <tmraz@fedoraproject.org> - 1.5.7-1
- new upstream release 1.5.7 with bug fixes and enhancements
* Wed Mar 17 2021 Tomáš Mráz <tmraz@fedoraproject.org> - 1.5.6-1
- new upstream release 1.5.6 with bug fixes and enhancements
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.5-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.5-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Mon Jul 13 2020 Tom Stellard <tstellar@redhat.com> - 1.5.5-3
- Use make macros
- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Oct 31 2019 Tomáš Mráz <tmraz@redhat.com> - 1.5.5-1
- new upstream release 1.5.5 with multiple bug fixes and improvements
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Mon Mar 18 2019 Tomáš Mráz <tmraz@redhat.com> - 1.5.4-1
- new upstream release 1.5.4 with regression fix
* Fri Mar 15 2019 Tomáš Mráz <tmraz@redhat.com> - 1.5.3-1
- new upstream release 1.5.3 fixing CVE-2019-9704 and CVE-2019-9705
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Nov 30 2018 Tomáš Mráz <tmraz@redhat.com> - 1.5.2-4
- Do not hard-require systemd as crond is used in containers without
systemd (#1654659)
* Wed Oct 31 2018 Tomáš Mráz <tmraz@redhat.com> - 1.5.2-3
- use role from the current context for system crontabs (#1639381)
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Thu May 3 2018 Tomáš Mráz <tmraz@redhat.com> - 1.5.2-1
- new upstream release 1.5.2
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.1-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.1-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Thu May 4 2017 Tomáš Mráz <tmraz@redhat.com> - 1.5.1-6
- fix Y2038 problems in cron and anacron (#1445136)
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Tue Jan 3 2017 Tomáš Mráz <tmraz@redhat.com> - 1.5.1-4
- make failure of creation of the ghost files in /var non-fatal
* Mon Sep 5 2016 Tomáš Mráz <tmraz@redhat.com> - 1.5.1-3
- on some machines the power supply is named ADP0
* Tue Aug 23 2016 Tomáš Mráz <tmraz@redhat.com> - 1.5.1-2
- query power status directly from kernel
* Thu Jun 23 2016 Tomáš Mráz <tmraz@redhat.com> - 1.5.1-1
- new upstream release
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Mon Jul 13 2015 Tomáš Mráz <tmraz@redhat.com> - 1.5.0-3
- the temp file name used by crontab needs to be ignored by crond
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.5.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Thu May 28 2015 Tomáš Mráz <tmraz@redhat.com> - 1.5.0-1
- new upstream release
* Tue Apr 21 2015 Tomáš Mráz <tmraz@redhat.com> - 1.4.12-6
- mark the 0hourly and dailyjobs crontabs as config
- do not add already existing orphan on reload
* Tue Feb 3 2015 Tomáš Mráz <tmraz@redhat.com> - 1.4.12-5
- correct the permissions of the anacron timestamp files
* Fri Jan 2 2015 Tomáš Mráz <tmraz@redhat.com> - 1.4.12-4
- check for NULL pamh on two more places (#1176215)
* Tue Dec 2 2014 Tomáš Mráz <tmraz@redhat.com> - 1.4.12-3
- call PAM only for non-root user or non-system crontabs (#956157)
- bypass the PAM check in crontab for root (#1169175)
* Tue Nov 4 2014 Tomáš Mráz <tmraz@redhat.com> - 1.4.12-2
- refresh user entries when jobs are run
* Wed Sep 17 2014 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.12-1
- new release 1.4.12
- remove gpl2 license, because it's part of upstream COPYING now
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.11-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Fri Jul 11 2014 Tom Callaway <spot@fedoraproject.org> - 1.4.11-8
- fix license handling
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.11-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Wed Apr 30 2014 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.11-6
- unwanted fd could make trouble to SElinux 1075106
* Thu Jan 16 2014 Ville Skyttä <ville.skytta@iki.fi> - 1.4.11-5
- Drop INSTALL from docs, fix rpmlint tabs vs spaces warning.
* Wed Sep 25 2013 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.11-4
- some jobs are not executed because not all environment variables are set 995590
- cronie's systemd script use "KillMode=process" 919290
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.11-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Mon Jul 22 2013 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.11-2
- scriptlets are not created correctly if systemd is not in BR 986698
- remove sub-package sysvinit, which is not needed anymore
- update license, anacron is under GPLv2+
* Thu Jul 18 2013 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.11-1
- new release 1.4.11 (contains previous bug fixes from 1.4.10-5)
* Tue Jun 11 2013 Tomáš Mráz <tmraz@redhat.com> - 1.4.10-5
- add support for RANDOM_DELAY - delaying job startups
- pass some environment variables to processes (LANG, etc.) (#969761)
- do not use putenv() with string literals (#971516)
* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.10-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Wed Jan 2 2013 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.10-3
- change configuration files to 644
- change 6755 to 4755 for crontab binary
* Tue Nov 27 2012 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.10-1
- New release 1.4.10
* Thu Nov 22 2012 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.9-1
- New release 1.4.9
* Wed Sep 05 2012 Václav Pavlín <vpavlin@redhat.com> - 1.4.8-13
- Scriptlets replaced with new systemd macros (#850070)
* Fri Jul 27 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.8-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.8-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
* Wed Oct 26 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.8-10
- Rebuilt for glibc bug#747377
* Tue Oct 25 2011 Tomáš Mráz <tmraz@redhat.com> - 1.4.8-9
- make crond run a little bit later in the boot process (#747759)
* Mon Oct 17 2011 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.8-8
- change triggerun to fix 735802 during upgrade
* Wed Jul 27 2011 Karsten Hopp <karsten@redhat.com> 1.4.8-7
- rebuild again, ppc still had the broken rpm in the buildroots
* Thu Jul 21 2011 Rex Dieter <rdieter@fedoraproject.org> 1.4.8-6
- rebuild (broken rpm in buildroot)
* Thu Jul 21 2011 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.8-5
- fix permission of init.d/crond
* Thu Jun 30 2011 Tomáš Mráz <tmraz@redhat.com> - 1.4.8-4
- drop the without systemd build condition
- add the chkconfig readding trigger to the sysvinit subpackage
* Wed Jun 29 2011 Tomáš Mráz <tmraz@redhat.com> - 1.4.8-3
- start crond after auditd
* Wed Jun 29 2011 Tomáš Mráz <tmraz@redhat.com> - 1.4.8-2
- fix inotify support to not leak fds (#717505)
* Tue Jun 28 2011 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.8-1
- update to 1.4.8
- create sub-package sysvinit for initscript
* Mon May 9 2011 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.7-3
- missing requirement on systemd-sysv for scriptlets
* Thu May 05 2011 Tomáš Mráz <tmraz@redhat.com> - 1.4.7-2
- use only systemd units with systemd
- add trigger for restart on glibc, libselinux or pam upgrades (#699189)
* Tue Mar 15 2011 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.7-1
- new release 1.4.7
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.6-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Mon Jan 17 2011 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.6-8
- enable crond even with systemctl
* Thu Dec 16 2010 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.6-7
- 663193 rewritten selinux support
* Wed Dec 15 2010 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.6-6
- apply selinux patch from dwalsh
* Fri Dec 10 2010 Tomas Mraz <tmraz@redhat.com> - 1.4.6-5
- do not lock jobs that fall out of allowed range - 661966
* Thu Dec 02 2010 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.6-4
- fix post (thanks plautrba for review)
* Tue Nov 30 2010 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.6-3
- systemd init script 617320
* Tue Nov 30 2010 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.6-2
- fix typos in man pages
* Fri Oct 22 2010 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.6-1
- update to 1.4.6
* Fri Aug 13 2010 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.5-4
- 623908 fix fd leak in anacron, which caused denail of prelink
and others
* Mon Aug 9 2010 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.5-2
- remove sendmail from requirements. If it's not installed, it will
log into (r)syslog.
* Mon Aug 2 2010 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.5-1
- update to new release
* Fri Feb 19 2010 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.4-1
- update to new release
* Mon Feb 15 2010 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.3-3
- 564894 FTBFS DSOLinking
* Thu Nov 5 2009 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.3-2
- 533189 pam needs add a line and selinux needs defined one function
* Fri Oct 30 2009 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.3-1
- 531963 and 532482 creating noanacron package
* Mon Oct 19 2009 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.2-2
- 529632 service crond stop returns appropriate value
* Mon Oct 12 2009 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.2-1
- new release
* Fri Aug 21 2009 Tomas Mraz <tmraz@redhat.com> - 1.4.1-3
- rebuilt with new audit
* Fri Aug 14 2009 Tomas Mraz <tmraz@redhat.com> - 1.4.1-2
- create the anacron timestamps in correct post script
* Fri Aug 14 2009 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.1-1
- update to 1.4.1
- create and own /var/spool/anacron/cron.{daily,weekly,monthly} to
remove false warning about non existent files
- Resolves: 517398
* Wed Aug 5 2009 Tomas Mraz <tmraz@redhat.com> - 1.4-4
- 515762 move anacron provides and obsoletes to the anacron subpackage
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Mon Jul 20 2009 Marcela Mašláňová <mmaslano@redhat.com> - 1.4-2
- merge cronie and anacron in new release of cronie
- obsolete/provide anacron in spec
* Thu Jun 18 2009 Marcela Mašláňová <mmaslano@redhat.com> - 1.3-2
- 506560 check return value of access
* Mon Apr 27 2009 Marcela Mašláňová <mmaslano@redhat.com> - 1.3-1
- new release
* Fri Apr 24 2009 Marcela Mašláňová <mmaslano@redhat.com> - 1.2-8
- 496973 close file descriptors after exec
* Mon Mar 9 2009 Tomas Mraz <tmraz@redhat.com> - 1.2-7
- rebuild
* Tue Feb 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
* Tue Dec 23 2008 Marcela Mašláňová <mmaslano@redhat.com> - 1.2-5
- 477100 NO_FOLLOW was removed, reload after change in symlinked
crontab is needed, man updated.
* Fri Oct 24 2008 Marcela Mašláňová <mmaslano@redhat.com> - 1.2-4
- update init script
* Thu Sep 25 2008 Marcela Maslanova <mmaslano@redhat.com> - 1.2-3
- add sendmail file into requirement, cause it's needed some MTA
* Thu Sep 18 2008 Marcela Maslanova <mmaslano@redhat.com> - 1.2-2
- 462252 /etc/sysconfig/crond does not need to be executable
* Thu Jun 26 2008 Marcela Maslanova <mmaslano@redhat.com> - 1.2-1
- update to 1.2
* Tue Jun 17 2008 Tomas Mraz <tmraz@redhat.com> - 1.1-3
- fix setting keycreate context
- unify logging a bit
- cleanup some warnings and fix a typo in TZ code
- 450993 improve and fix inotify support
* Wed Jun 4 2008 Marcela Maslanova <mmaslano@redhat.com> - 1.1-2
- 49864 upgrade/update problem. Syntax error in spec.
* Wed May 28 2008 Marcela Maslanova <mmaslano@redhat.com> - 1.1-1
- release 1.1
* Tue May 20 2008 Marcela Maslanova <mmaslano@redhat.com> - 1.0-6
- 446360 check for lock didn't call chkconfig
* Tue Feb 12 2008 Marcela Maslanova <mmaslano@redhat.com> - 1.0-5
- upgrade from less than cronie-1.0-4 didn't add chkconfig
* Wed Feb 6 2008 Marcela Maslanova <mmaslano@redhat.com> - 1.0-4
- 431366 after reboot wasn't cron in chkconfig
* Tue Feb 5 2008 Marcela Maslanova <mmaslano@redhat.com> - 1.0-3
- 431366 trigger part => after update from vixie-cron on cronie will
be daemon running.
* Wed Jan 30 2008 Marcela Maslanova <mmaslano@redhat.com> - 1.0-2
- change the provides on higher version than obsoletes
* Tue Jan 8 2008 Marcela Maslanova <mmaslano@redhat.com> - 1.0-1
- packaging cronie
- thank's for help with packaging to my reviewers
%autochangelog

View file

@ -0,0 +1,38 @@
From fd56df9b6d5fa9932edc6bd41d307e2453a6b442 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Poho=C5=99elsk=C3=BD?= <opohorel@redhat.com>
Date: Wed, 30 Jul 2025 12:40:17 +0200
Subject: [PATCH] crontab: Fix backup failure when ~/.cache directory missing
Create ~/.cache parent directory before creating ~/.cache/crontab backup
directory to prevent "mkdir: No such file or directory" errors when users
edit crontabs and their cache directory doesn't exist.
---
src/crontab.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/crontab.c b/src/crontab.c
index c11dc81..14d02dd 100644
--- a/src/crontab.c
+++ b/src/crontab.c
@@ -578,7 +578,21 @@ static int backup_crontab(const char *crontab_path) {
exit(ERROR_EXIT);
}
+ /* Ensure the backup directory and its parent exist, creating them if necessary */
if (stat(backup_dir, &sb) < OK && errno == ENOENT) {
+ char *last_slash = strrchr(backup_dir, '/');
+ if (last_slash && last_slash != backup_dir) {
+ char parent_dir[MAX_FNAME];
+ size_t parent_len = last_slash - backup_dir;
+ if (parent_len < sizeof(parent_dir)) {
+ strncpy(parent_dir, backup_dir, parent_len);
+ parent_dir[parent_len] = '\0';
+ /* Check if parent directory exists before creating */
+ if (stat(parent_dir, &sb) < OK && errno == ENOENT) {
+ mkdir(parent_dir, 0700);
+ }
+ }
+ }
if (OK != mkdir(backup_dir, 0755)) {
fprintf(stderr, "%s: ", backup_dir);
perror("mkdir");

26
fix_range_parsing.patch Normal file
View file

@ -0,0 +1,26 @@
From d037042129eacdd9d7760d74437842ee5a2d116e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Poho=C5=99elsk=C3=BD?= <opohorel@redhat.com>
Date: Tue, 11 Mar 2025 15:12:38 +0100
Subject: [PATCH] get_range() fix range parsing for Sunday as 0 or 7
In fc8b0e5, we changed how the ranges are parsed. This created a
regression for parsing Sunday at the end of the range. This commit adds
the logic to correctly handle Sunday as the end of the range.
---
src/entry.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/entry.c b/src/entry.c
index a2077e8..30bedb3 100644
--- a/src/entry.c
+++ b/src/entry.c
@@ -642,6 +642,9 @@ get_range(bitstr_t * bits, int low, int high, const char *names[],
state = R_FINISH;
break;
}
+ if (low_ > high_ && high_ == 0) {
+ high_ = 7;
+ }
return (EOF);
case R_RANDOM:

View file

@ -0,0 +1,70 @@
From 5f9f16b5663becefdd0dd70df31c0ef5ac36f943 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Poho=C5=99elsk=C3=BD?= <opohorel@redhat.com>
Date: Thu, 27 Nov 2025 14:38:47 +0100
Subject: [PATCH] Forward XDG_SESSION_CLASS to PAM for session classification
Allow users to set the XDG_SESSION_CLASS environment variable in their
crontab to control the systemd session class for cron jobs. When set,
this value is forwarded to the PAM environment so that pam_systemd can
use it for session classification (e.g., "background-light").
This enables cron jobs to run in lighter-weight sessions that consume
fewer system resources.
---
man/crontab.5 | 10 ++++++++++
src/security.c | 21 +++++++++++++++++++++
2 files changed, 31 insertions(+)
diff --git a/man/crontab.5 b/man/crontab.5
index 68380c6..7487cc5 100644
--- a/man/crontab.5
+++ b/man/crontab.5
@@ -157,6 +157,16 @@ upper limit specified by the variable. The random scaling factor is
determined during the cron daemon startup so it remains constant for
the whole run time of the daemon.
.PP
+The
+.I XDG_SESSION_CLASS
+variable specifies the session class to be used when PAM creates a systemd
+session for the cron job. If set (e.g., to "background-light"), this value
+is forwarded to the PAM environment so that
+.BR pam_systemd (8)
+can use it for session classification. This allows cron jobs to run in
+lighter-weight sessions that consume fewer system resources. This variable
+has no effect if crond was built without PAM support.
+.PP
The format of a cron command is similar to the V7 standard, with a number
of upward-compatible extensions. Each line has five time-and-date fields
followed by a
diff --git a/src/security.c b/src/security.c
index 14a514a..67b6d26 100644
--- a/src/security.c
+++ b/src/security.c
@@ -131,6 +131,27 @@ int cron_set_job_security_context(entry *e, user *u ATTRIBUTE_UNUSED,
pam_strerror(pamh, ret), 0);
return -1;
}
+
+ /* Forward XDG_SESSION_CLASS from crontab environment to PAM
+ * so that pam_systemd.so can use it for session classification */
+#ifdef HAVE_PAM_PUTENV
+ if (pamh != NULL) {
+ char *xdg_session_class = env_get("XDG_SESSION_CLASS", e->envp);
+ if (xdg_session_class != NULL) {
+ char *xdg_session_class_env = NULL;
+ if (asprintf(&xdg_session_class_env, "XDG_SESSION_CLASS=%s",
+ xdg_session_class) >= 0) {
+ ret = pam_putenv(pamh, xdg_session_class_env);
+ if (ret != PAM_SUCCESS) {
+ log_it(e->pwd->pw_name, getpid(),
+ "WARNING: Failed to set XDG_SESSION_CLASS in PAM environment",
+ pam_strerror(pamh, ret), 0);
+ }
+ free(xdg_session_class_env);
+ }
+ }
+ }
+#endif
#endif
#ifdef WITH_SELINUX

View file

@ -0,0 +1,37 @@
From 09c630c654b2aeff06a90a412cce0a60ab4955a4 Mon Sep 17 00:00:00 2001
From: Tomas Mraz <tmraz@fedoraproject.org>
Date: Mon, 18 Nov 2024 21:02:30 +0100
Subject: [PATCH] load_entry(): Make error_func prototype complete
Fixes #193
---
src/entry.c | 2 +-
src/funcs.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/entry.c b/src/entry.c
index 586eb9d..a2077e8 100644
--- a/src/entry.c
+++ b/src/entry.c
@@ -90,7 +90,7 @@ void free_entry(entry * e) {
/* return NULL if eof or syntax error occurs;
* otherwise return a pointer to a new entry.
*/
-entry *load_entry(FILE * file, void (*error_func) (), struct passwd *pw,
+entry *load_entry(FILE * file, void (*error_func) (const char *), struct passwd *pw,
char **envp) {
/* this function reads one crontab entry -- the next -- from a file.
* it skips any leading blank lines, ignores comments, and returns
diff --git a/src/funcs.h b/src/funcs.h
index 427e027..f28d634 100644
--- a/src/funcs.h
+++ b/src/funcs.h
@@ -89,7 +89,7 @@ char *env_get(const char *, char **),
user *load_user(int, struct passwd *, const char *, const char *, const char *),
*find_user(cron_db *, const char *, const char *);
-entry *load_entry(FILE *, void (*)(), struct passwd *, char **);
+entry *load_entry(FILE *, void (*)(const char *), struct passwd *, char **);
FILE *cron_popen(char *, const char *, struct passwd *, char **);

36
move_parsing_code.patch Normal file
View file

@ -0,0 +1,36 @@
From e6c2853856c3103a4add4c3673b3306cc21d341e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Poho=C5=99elsk=C3=BD?= <opohorel@redhat.com>
Date: Wed, 7 May 2025 13:25:19 +0200
Subject: [PATCH] get_range() move parsing code before separator check
In the previous commit the parsing fix was added after a separator check
by accident, making it not execute properly. This commit moves it into the
right place.
---
src/entry.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/entry.c b/src/entry.c
index 30bedb3..da1a02c 100644
--- a/src/entry.c
+++ b/src/entry.c
@@ -638,13 +638,13 @@ get_range(bitstr_t * bits, int low, int high, const char *names[],
state = R_STEP;
break;
}
+ if (low_ > high_ && high_ == 0) {
+ high_ = 7;
+ }
if (is_separator(ch)) {
state = R_FINISH;
break;
}
- if (low_ > high_ && high_ == 0) {
- high_ = 7;
- }
return (EOF);
case R_RANDOM:
--
2.49.0

5
plans/default.fmf Normal file
View file

@ -0,0 +1,5 @@
summary: Default plan for cronie tests
discover:
how: fmf
execute:
how: tmt

View file

@ -1 +1 @@
SHA512 (cronie-1.5.7.tar.gz) = c306468d2e8d618a168e55204796f15d845520130d9601395e6413c55a71e94b4264a73e2e3f5d7011b3e53af9dad812f56662de3a7c9e50977d57b2a49a6893
SHA512 (cronie-1.7.2.tar.gz) = 5b55c677a5b812dbfa70f6ee25e41907e99cc63a4883974c6bb8115ad65155d66665704808c338d2f7be6b0a57028c319f2d1115c69bb5f3efdda1efafd144de

View file

@ -0,0 +1,13 @@
summary: Test for Can't remove crontab from expired accounts
description: ''
contact: Karel Volny <kvolny@redhat.com>
component:
- cronie
test: ./runtest.sh
framework: beakerlib
recommend:
- cronie
duration: 5m
extra-summary:
/CoreOS/cronie/Regression/Can-t-remove-crontab-from-expired-accounts
extra-task: /CoreOS/cronie/Regression/Can-t-remove-crontab-from-expired-accounts

View file

@ -26,7 +26,6 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/bin/rhts-environment.sh || exit 1
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="cronie"

View file

@ -0,0 +1,14 @@
summary: Test for Cron does uid lookups for non-existent users
description: "Bug summary: Cron does uid lookups for non-existent users\n"
contact: Vaclav Danek <vdanek@redhat.com>
component:
- cronie
test: ./runtest.sh
framework: beakerlib
recommend:
- cronie
duration: 5m
extra-summary:
/CoreOS/cronie/Regression/Cron-does-uid-lookups-for-non-existent-users
extra-task:
/CoreOS/cronie/Regression/Cron-does-uid-lookups-for-non-existent-users

View file

@ -26,7 +26,6 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/bin/rhts-environment.sh || exit 1
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="cronie"
@ -39,8 +38,8 @@ rlJournalStart
rlPhaseEnd
rlPhaseStartTest
rlRun "sleep 61 | crontab -" 0
rlRun -s "tail /var/log/cron" 0
rlRun "sleep 61 | crontab -" 0 "when you run crontab -, it creates a tmp file in /var/spool/cron/"
rlRun -s "tail /var/log/cron" 0,1 "crond should not do uid lookup against the name of the file"
rlAssertNotGrep "ORPHAN (no passwd entry)" $rlRun_LOG
rm -f $rlRun_LOG
rlPhaseEnd

View file

@ -1,62 +0,0 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/cronie/Regression/MAILTO-problem-with-anacron
# Description: Test for MAILTO problem with anacron
# Author: Karel Volny <kvolny@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2017 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/CoreOS/cronie/Regression/MAILTO-problem-with-anacron
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE anacrontab
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Karel Volny <kvolny@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test for MAILTO problem with anacron" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 15m" >> $(METADATA)
@echo "RunFor: cronie" >> $(METADATA)
@echo "Requires: cronie" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -1,4 +0,0 @@
PURPOSE of /CoreOS/cronie/Regression/MAILTO-problem-with-anacron
Description: Test for MAILTO problem with anacron
Author: Karel Volny <kvolny@redhat.com>
Bug summary: MAILTO problem with anacron

View file

@ -1,5 +0,0 @@
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=testuser1
1 0 test echo "Hello anacron!"

View file

@ -1,155 +0,0 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/cronie/Regression/MAILTO-problem-with-anacron
# Description: Test for MAILTO problem with anacron
# Author: Karel Volny <kvolny@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2017 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/bin/rhts-environment.sh || exit 1
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="cronie"
TestDir=$PWD
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlRun "useradd testuser1" 0 "Adding the testing user"
rlFileBackup --clean /var/spool/mail/root /var/log/cron
# stop cron not to interfere with our logs
rlServiceStop crond
rlPhaseEnd
# email should be sent to user specified via MAILTO (testuser1)
rlPhaseStartTest anacronmail
rlRun "truncate --size 0 /var/spool/mail/testuser1" 0 "Truncating mail queue for the user 'testuser1'"
rlRun "truncate --size 0 /var/log/cron" 0 "Truncating cron log"
# DEBUG
echo "anacrontab:"
echo "***********"
cat ${TestDir}/anacrontab
rlRun "anacron -f -n -d -t ${TestDir}/anacrontab" 0 "Forcing anacron to run job"
sleep 5
# DEBUG
echo "/var/spool/mail/testuser1:"
echo "**************************"
cat /var/spool/mail/testuser1
rlAssertGrep "anacron" "/var/spool/mail/testuser1"
rlAssertGrep "To: testuser1" "/var/spool/mail/testuser1"
# DEBUG
echo "/var/log/cron:"
echo "**************"
cat /var/log/cron
rlAssertGrep "\(produced output\)" /var/log/cron
rlAssertNotGrep "not mailing" /var/log/cron -i
rlPhaseEnd
# email should NOT be sent with empty MAILTO
rlPhaseStartTest noanacronmail-empty
rlRun "truncate --size 0 /var/spool/mail/root" 0 "Truncating mail queue for root"
rlRun "truncate --size 0 /var/log/cron" 0 "Truncating cron log"
rlRun "sed -i -e 's/MAILTO=testuser1/MAILTO=/' ${TestDir}/anacrontab" 0 "Removing mailto user from anacrontab"
# DEBUG
echo "anacrontab:"
echo "***********"
cat ${TestDir}/anacrontab
rlRun "anacron -f -n -d -t ${TestDir}/anacrontab" 0 "Forcing anacron to run job"
sleep 5
# DEBUG
echo "/var/spool/mail/root:"
echo "*********************"
cat /var/spool/mail/root
rlAssertNotGrep "anacron" "/var/spool/mail/root"
# DEBUG
echo "/var/log/cron:"
echo "**************"
cat /var/log/cron
rlAssertGrep "\(produced output\)" /var/log/cron
rlAssertGrep "not mailing" /var/log/cron -i
rlPhaseEnd
# email should be sent to nonexisting user double-doublequotes, as the string after '=' is treated literally
rlPhaseStartTest anacronmail-quotes
rlRun "truncate --size 0 /var/spool/mail/root" 0 "Truncating mail queue for root"
rlRun "truncate --size 0 /var/log/cron" 0 "Truncating cron log"
rlRun "sed -i -e 's/MAILTO=/MAILTO=\"\"/' ${TestDir}/anacrontab" 0 "Setting mailto to double quotes in anacrontab"
# DEBUG
echo "anacrontab:"
echo "***********"
cat ${TestDir}/anacrontab
rlRun "anacron -f -n -d -t ${TestDir}/anacrontab" 0 "Forcing anacron to run job"
sleep 5
# DEBUG
echo "/var/spool/mail/root:"
echo "*********************"
cat /var/spool/mail/root
rlAssertGrep "anacron" "/var/spool/mail/root"
#rlAssertGrep "To: \"\"" "/var/spool/mail/root"
# ^ this doesn't work in Beaker for some reason, check the quotes in 'Received: ... for "";'
rlAssertGrep "for \"\"" "/var/spool/mail/root"
# DEBUG
echo "/var/log/cron:"
echo "**************"
cat /var/log/cron
rlAssertGrep "\(produced output\)" /var/log/cron
rlAssertNotGrep "not mailing" /var/log/cron -i
rlPhaseEnd
# email should be sent to the user running anacron, when MAILTO is missing
rlPhaseStartTest anacronmail-missing
rlRun "truncate --size 0 /var/spool/mail/root" 0 "Truncating mail queue for root"
rlRun "truncate --size 0 /var/log/cron" 0 "Truncating cron log"
rlRun "sed -i -e '/MAILTO/d' ${TestDir}/anacrontab" 0 "Removing mailto from anacrontab"
# DEBUG
echo "anacrontab:"
echo "***********"
cat ${TestDir}/anacrontab
rlRun "anacron -f -n -d -t ${TestDir}/anacrontab" 0 "Forcing anacron to run job"
sleep 5
# DEBUG
echo "/var/spool/mail/root:"
echo "*********************"
cat /var/spool/mail/root
rlAssertGrep "anacron" "/var/spool/mail/root"
# DEBUG
echo "/var/log/cron:"
echo "**************"
cat /var/log/cron
rlAssertGrep "\(produced output\)" /var/log/cron
rlAssertNotGrep "not mailing" /var/log/cron -i
rlPhaseEnd
rlPhaseStartCleanup
rlRun "userdel testuser1"
rlServiceRestore crond
rlFileRestore
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
#avoid systemd failing to start crond due start-limit
sleep 10
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,13 @@
summary: What the test does
description: ''
contact: Jakub Prokes <jprokes@redhat.com>
component:
- cronie
test: ./runtest.sh
framework: beakerlib
recommend:
- cronie
- elfutils
duration: 5m
extra-summary: /CoreOS/Regression/Make-crontab-a-PIE
extra-task: /CoreOS/Regression/Make-crontab-a-PIE

1
tests/Make-crontab-a-PIE/runtest.sh Normal file → Executable file
View file

@ -27,7 +27,6 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/bin/rhts-environment.sh || exit 1
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGES="cronie vixie-cron"

View file

@ -0,0 +1,14 @@
summary: try some invalid configs for anacron to check config parser
description: ''
contact: Jakub Prokes <jprokes@redhat.com>
component:
- cronie
test: ./runtest.sh
framework: beakerlib
recommend:
- cronie
duration: 5m
extra-summary:
/CoreOS/cronie/Regression/anacron-segfaults-with-certain-config-data-2
extra-task:
/CoreOS/cronie/Regression/anacron-segfaults-with-certain-config-data-2

View file

@ -26,7 +26,6 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/bin/rhts-environment.sh || exit 1
. /usr/share/beakerlib/beakerlib.sh || exit 1
assertRpms() {

View file

@ -0,0 +1,13 @@
summary: Test for anacron segfaults with certain config data
description: ''
contact: Robin Hack <rhack@redhat.com>
component:
- cronie
test: ./runtest.sh
framework: beakerlib
recommend:
- cronie
duration: 20m
extra-summary:
/CoreOS/cronie/Regression/anacron-segfaults-with-certain-config-data
extra-task: /CoreOS/cronie/Regression/anacron-segfaults-with-certain-config-data

View file

@ -26,7 +26,6 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/bin/rhts-environment.sh || exit 1
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="cronie"

1
tests/config-parsing-issue/runtest.sh Normal file → Executable file
View file

@ -26,7 +26,6 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/bin/rhts-environment.sh || exit 1
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="cronie-anacron"

View file

@ -0,0 +1,14 @@
summary: Test for cron daemon fails to log that it is shutting down.
description: "Bug summary: cron daemon fails to log that it is shutting down.\n"
contact: Robin Hack <rhack@redhat.com>
component:
- cronie
test: ./runtest.sh
framework: beakerlib
recommend:
- cronie
duration: 20m
extra-summary:
/CoreOS/cronie/Regression/cron-daemon-fails-to-log-that-it-is-shutting-down
extra-task:
/CoreOS/cronie/Regression/cron-daemon-fails-to-log-that-it-is-shutting-down

View file

@ -26,7 +26,6 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/bin/rhts-environment.sh || exit 1
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="cronie"

View file

@ -0,0 +1,13 @@
summary: Test for crond is missing RELRO flags
description: "Bug summary: crond is missing RELRO flags\n\n"
contact: Martin Cermak <mcermak@redhat.com>
component:
- cronie
test: ./runtest.sh
framework: beakerlib
recommend:
- cronie
- elfutils
duration: 15m
extra-summary: /CoreOS/cronie/Regression/crond-is-missing-RELRO-flags
extra-task: /CoreOS/cronie/Regression/crond-is-missing-RELRO-flags

1
tests/crond-is-missing-RELRO-flags/runtest.sh Normal file → Executable file
View file

@ -27,7 +27,6 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include rhts environment
. /usr/bin/rhts-environment.sh || exit 1
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="cronie"

View file

@ -0,0 +1,15 @@
summary: Test for crond subtask abnormal termination removes pid
description: "Bug summary: crond subtask abnormal termination removes pid file in
error\n"
contact: Robin Hack <rhack@redhat.com>
component:
- cronie
test: ./runtest.sh
framework: beakerlib
recommend:
- cronie
duration: 20m
extra-summary:
/CoreOS/cronie/Regression/crond-subtask-abnormal-termination-removes-pid-file-in-error
extra-task:
/CoreOS/cronie/Regression/crond-subtask-abnormal-termination-removes-pid-file-in-error

View file

@ -26,7 +26,6 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/bin/rhts-environment.sh || exit 1
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="cronie"

View file

@ -1,63 +0,0 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/cronie/Regression/cronie-jobs-environment
# Description: testing EUID with jobs are executed and if LANG is correctly set
# Author: Jakub Prokes <jprokes@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2013 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/CoreOS/cronie/Regression/cronie-jobs-environment
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE libfaketime-0.9.1.tar.gz crontab.temp cron_test.sh
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Jakub Prokes <jprokes@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: testing EUID with jobs are executed and if LANG is correctly set" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 10m" >> $(METADATA)
@echo "RunFor: cronie" >> $(METADATA)
@echo "Requires: cronie" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -1,3 +0,0 @@
PURPOSE of /CoreOS/cronie/Regression/cronie-jobs-environment
Description: testing EUID with jobs are executed and if LANG is correctly set
Author: Jakub Prokes <jprokes@redhat.com>

View file

@ -1,5 +0,0 @@
#!/bin/bash
printf "LANG=$LANG\n" > /tmp/cronie-jobs-environment.log;
printf "EUID=$EUID\n" >> /tmp/cronie-jobs-environment.log;

View file

@ -1,12 +0,0 @@
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * command to be executed
CRON_CORRECT_MAIL_HEADER=1
* * * * * %TMPDIR/cron_test.sh

View file

@ -1,124 +0,0 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/cronie/Regression/cronie-jobs-environment
# Description: testing EUID with jobs are executed and if LANG is correctly set
# Author: Jakub Prokes <jprokes@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2013 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing
# to use, modify, copy, or redistribute it subject to the terms
# and conditions of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/bin/rhts-environment.sh || exit 1
. /usr/share/beakerlib/beakerlib.sh || exit 1
## Is nice to know when things going wrong
trap 'errorHandler ${LINENO}' ERR;
function errorHandler() {
local code="${?}";
local lineNO="$1";
case $code in
127)
rlFail "Command not found on line $lineNO"
;;
*)
rlFail "Unhandled error $code near line $lineNO";
;;
esac
}
function makeUser() {
local userName="$(tr -dc "[:lower:]" < /dev/urandom | head -c 5 | sed 's/^/qa_/')";
while getent passwd $userName; do
userName="$(tr -dc "[:lower:]" < /dev/urandom | head -c 5 | sed 's/^/qa_/')";
done
useradd -d $tmpDir $userName;
echo $userName;
}
PACKAGE="cronie"
declare -r LIBFAKETTIMEPACKAGE="libfaketime-0.9.1.tar.gz";
declare -r LIBFAKETIME="libfaketime.so.1";
rlJournalStart
rlPhaseStartSetup "Setup test environment"
rlAssertRpm $PACKAGE
rlRun "tmpDir=\$(mktemp -d)" 0 "Creating tmp directory";
testDir="$(pwd)";
rlRun "chmod 755 $tmpDir" 0 "Setting permissions for tmp directory";
ls -lahdZ $tmpDir;
rlRun "pushd $tmpDir"
testUser="$(makeUser)";
rlRun "getent passwd $testUser" 0 "Test user $testUser created";
rlServiceStop crond;
rlPhaseEnd
rlPhaseStartSetup "Prepare libfaketime";
rlRun "cp ${testDir}/$LIBFAKETTIMEPACKAGE ./" 0 "Get library sources";
rlRun "tar -xvzf $LIBFAKETTIMEPACKAGE" 0 "Unpack library sources";
pushd ${LIBFAKETTIMEPACKAGE%.tar.gz};
rlRun "make &>/dev/null" 0 "Building library from sources";
rlRun "cp ./src/$LIBFAKETIME ../" 0 "Coping library to working directory";
popd;
LD_PRELOAD=./libfaketime.so.1 FAKETIME='1994-07-29 12:00:01' date +%G | { year="$(cat)"; [[ $year -eq 1994 ]]; };
rlAssert0 "Library preloading working well" $?;
rlPhaseEnd
rlPhaseStartSetup "Prepare tests";
rlRun "sed 's#%TMPDIR#$tmpDir#' $testDir/crontab.temp > crontab.source" #0 "Crontab prepared from template";
rlRun "crontab -u $testUser crontab.source" 0 "Set crontab for test user";
crontab -lu $testUser;
rlRun "cp $testDir/cron_test.sh ./" 0 "Copyed script for cron job";
rlRun "chmod a+x cron_test.sh" 0 "Permissions to executed set";
rlRun "[[ -e /var/spool/mail/$testUser ]] && printf '' > /var/spool/mail/$testUser" 0 "Clean up mails"
rlLog "Execute crond with faked time";
LD_PRELOAD=./libfaketime.so.1 FAKETIME='@1994-07-29 12:12:50' /usr/sbin/crond -n -x sch &
cronPID=$!;
pstree -Aph
rlRun "kill -0 $cronPID" 0 "crond is running";
rlLog "Security timeout for 30 sec to ensure all configs are loaded and crontab is succesfully processed";
sleep 30;
rlPhaseEnd
rlPhaseStartTest "cronie drops \$LANG and never passes it on to jobs run"
rlRun "[[ $(sed -n '/^LANG/s/LANG=//p' /tmp/cronie-jobs-environment.log) = $LANG ]]" 0 "LANG is set"
rlPhaseEnd
rlPhaseStartTest "cronie doesn't drop privileges before popen"
rlRun "[[ $(sed -n '/^EUID/s/EUID=//p' /tmp/cronie-jobs-environment.log) -eq $(id -u $testUser) ]]" 0 \
"Crontab is executed with correct EUID";
rlPhaseEnd
rlPhaseStartCleanup
rlRun "kill $cronPID" 0 "Terminating crond"
rlRun "crontab -ru $testUser" 0 "Crontab removed"
rlRun "popd"
rlRun "rm -r $tmpDir" 0 "Removing tmp directory"
rlRun "userdel -rf $testUser";
rlServiceRestore crond;
#avoid systemd failing to start crond due start-limit
sleep 10
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,14 @@
summary: Test for Cron does uid lookups for non-existent users
description: "Bug summary: Cron does uid lookups for non-existent users\n"
contact: Jakub Prokes <jprokes@redhat.com>
component:
- cronie
test: ./runtest.sh
framework: beakerlib
recommend:
- cronie
duration: 10m
extra-summary:
/CoreOS/cronie/Regression/crontab-can-invoke-lookup-for-nonexisted-user
extra-task:
/CoreOS/cronie/Regression/crontab-can-invoke-lookup-for-nonexisted-user

View file

@ -26,7 +26,6 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/bin/rhts-environment.sh || exit 1
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="cronie"

View file

@ -0,0 +1,12 @@
summary: What the test does
description: ''
contact: Jakub Prokes <jprokes@redhat.com>
component:
- cronie
test: ./runtest.sh
framework: beakerlib
recommend:
- cronie
duration: 5m
extra-summary: /CoreOS/cronie/Regression/crontab-has-wrong-permissions
extra-task: /CoreOS/cronie/Regression/crontab-has-wrong-permissions

1
tests/crontab-has-wrong-permissions/runtest.sh Normal file → Executable file
View file

@ -27,7 +27,6 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/bin/rhts-environment.sh || exit 1
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGES="cronie vixie-cron"

View file

@ -0,0 +1,12 @@
summary: Test for echos "OK" twice in init script
description: ''
contact: Martin Cermak <mcermak@redhat.com>
component:
- cronie
test: ./runtest.sh
framework: beakerlib
recommend:
- cronie
duration: 15m
extra-summary: /CoreOS/cronie/Regression/echos-OK-twice-in-init-script
extra-task: /CoreOS/cronie/Regression/echos-OK-twice-in-init-script

57
tests/echos-OK-twice-in-init-script/runtest.sh Normal file → Executable file
View file

@ -27,50 +27,45 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include rhts environment
. /usr/bin/rhts-environment.sh
. /usr/lib/beakerlib/beakerlib.sh
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="cronie"
function makeUser() {
local userName="$(tr -dc "[:lower:]" < /dev/urandom | head -c 5 | sed 's/^/qa_/')";
while getent passwd $userName; do
userName="$(tr -dc "[:lower:]" < /dev/urandom | head -c 5 | sed 's/^/qa_/')";
done
useradd -d $tmpDir $userName;
echo $userName;
}
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "TEMPDIR=\`mktemp -d\`" 0 "Creating tmp directory"
rlRun "pushd $TEMPDIR"
rlFileBackup "/etc/rc.d/init.d/crond"
rlServiceStop crond
cat > /etc/rc.d/init.d/functions2 <<EOF1
success() {
echo OK >> $TEMPDIR/log.txt
}
EOF1
rlRun "cat /etc/rc.d/init.d/functions2"
sed -i "s/^\..*$/\0\n\. \/etc\/rc\.d\/init\.d\/functions2/" /etc/rc.d/init.d/crond
rlRun "grep ^\\\. /etc/rc.d/init.d/crond"
rlRun "tmpDir=\$(mktemp -d)" 0 "Creating tmp directory";
testUser="$(makeUser)";
rlPhaseEnd
rlPhaseStartTest
rlAssertNotExists log.txt
rlServiceStart crond
rlAssertExists log.txt
rlRun "TIMES_PRINTED_OK=`grep OK log.txt | wc -l`"
rlRun "test $TIMES_PRINTED_OK -eq 1"
rlServiceStop crond
rlRun -s "service crond restart"
rlAssertNotGrep "FAILED" $rlRun_LOG
rlPhaseEnd
if ! rpm -q systemd &>/dev/null; then
rlPhaseStartTest
su -l $testUser -c "service crond restart";
rlAssertEquals "Expected result of call initscript by unprivileged user is 4" $? 4
rlPhaseEnd
fi
rlPhaseStartCleanup
rlBundleLogs TESTLOGS /etc/rc.d/init.d/functions2 /etc/rc.d/init.d/crond
rlRun "rm -f /etc/rc.d/init.d/functions2"
rlFileRestore
rm -f $rlRun_LOG
rm -rf $tmpDir;
userdel -rf $testUser;
rlServiceRestore crond
rlRun "popd"
rlRun "rm -r $TEMPDIR" 0 "Removing tmp directory"
#avoid systemd failing to start crond due start-limit
sleep 10
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,12 @@
summary: Testing some init script failures
description: ''
contact: Jakub Prokes <jprokes@redhat.com>
component:
- cronie
test: ./runtest.sh
framework: beakerlib
recommend:
- cronie
duration: 5m
extra-summary: /CoreOS/cronie/Regression/init-script-failure
extra-task: /CoreOS/cronie/Regression/init-script-failure

1
tests/init-script-failure/runtest.sh Normal file → Executable file
View file

@ -27,7 +27,6 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/bin/rhts-environment.sh || exit 1
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="cronie"

View file

@ -0,0 +1,12 @@
summary: Init script should meet LSB specifications
description: ''
contact: Petr Sklenar <psklenar@redhat.com>
component:
- cronie
test: ./runtest.sh
framework: shell
recommend:
- cronie
duration: 5m
extra-summary: /CoreOS/cronie/Sanity/init-script-LSB
extra-task: /CoreOS/cronie/Sanity/init-script-LSB

3
tests/init-scripts-LSB/runtest.sh Normal file → Executable file
View file

@ -27,8 +27,7 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include rhts environment
. /usr/bin/rhts-environment.sh
. /usr/share/rhts-library/rhtslib.sh
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="cronie"

View file

@ -1,63 +0,0 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/cronie/Regression/ldap-users
# Description: Test for cronie not creating jobs for ldap users if ldap
# Author: Jakub Prokes <jprokes@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2016 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
export TEST=/CoreOS/cronie/Regression/ldap-users
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE data.ldif slapd.conf user1.cron
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
test -x runtest.sh || chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Jakub Prokes <jprokes@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test for cronie not creating jobs for ldap users if ldap" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 10m" >> $(METADATA)
@echo "RunFor: cronie openldap" >> $(METADATA)
@echo "Requires: cronie authconfig openldap openldap-servers openldap-clients sssd sssd-ldap" >> $(METADATA)
@echo "RhtsRequires: library(authconfig/basic)" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -1,5 +0,0 @@
PURPOSE of /CoreOS/cronie/Regression/ldap-users
Description: Test for cronie not creating jobs for ldap users if ldap
Author: Jakub Prokes <jprokes@redhat.com>
Bug summary: cronie not creating jobs for ldap users if ldap server is temporarily down.

View file

@ -1,26 +0,0 @@
dn: dc=foo,dc=bar,dc=com
dc: foo
objectClass: top
objectClass: domain
dn: ou=people,dc=foo,dc=bar,dc=com
ou: people
objectClass: top
objectClass: organizationalUnit
dn: uid=user1,ou=people,dc=foo,dc=bar,dc=com
uid: user1
cn: user1
objectClass: account
objectClass: posixAccount
objectClass: top
objectClass: shadowAccount
userPassword: {CRYPT}hebc0ErNA0uXY
shadowLastChange: 14460
shadowMax: 99999
shadowWarning: 7
loginShell: /bin/bash
uidNumber: 1001
gidNumber: 1000
homeDirectory: /home/ldap/user1
gecos: user1

View file

@ -1,133 +0,0 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/cronie/Regression/ldap-users
# Description: Test for cronie not creating jobs for ldap users if ldap
# Author: Jakub Prokes <jprokes@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2016 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/bin/rhts-environment.sh || exit 1
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="cronie"
rlJournalStart
rlPhaseStart FAIL "General Setup"
rlAssertRpm $PACKAGE
rlRun "tmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "testDir=\"$(pwd)\""
rlRun "pushd $tmpDir"
rlRun "rlImport --all"
rlServiceStart "crond"
rlFileBackup /var/log/cron
echo > /var/log/cron
/bin/kill -HUP $(cat /var/run/syslogd.pid)
rlRun "getent passwd user1" 2
rlPhaseEnd
rlPhaseStart FAIL "LDAP Server Setup"
rlServiceStop "slapd"
rlFileBackup --clean "/etc/openldap"
rlFileBackup --clean "/var/run/openldap"
rlFileBackup --clean "/var/lib/ldap"
rlRun "rm -rf /etc/openldap/slapd.d/* /var/lib/ldap/* /var/run/openldap/*" 0 "Cleaning LDAP directories"
rlRun "slapadd -l ${testDir}/data.ldif -f ${testDir}/slapd.conf" 0 "Importing testing user into LDAP"
rlRun "chown ldap:ldap /var/run/openldap/*" 0 "Fixing permissions on '/var/run/openldap/*'"
rlRun "restorecon -Rv /etc/" 0 "Fixing SELinux contexts"
rlRun "slaptest -f ${testDir}/slapd.conf -F /etc/openldap/slapd.d" 0 "Importing LDAP configuration"
rlRun "chown -R ldap:ldap /etc/openldap/slapd.d" 0 "Fixing permissions on '/etc/openldap/slapd.d'"
rlServiceStart "slapd"
rlPhaseEnd
rlPhaseStart FAIL "LDAP auth setup"
rlServiceStop "sssd"
rlRun "authconfig_setup"
rlRun "authconfig --savebackup=CoreOS_cronie_Regression_ldap-users"
rlRun "authconfig --enableldap --enableldapauth --ldapserver=ldap://127.0.0.1/ \
--ldapbasedn=dc=foo,dc=bar,dc=com --update"
rlRun "getent passwd user1"
rlRun "mkdir -p /home/ldap/user1"
rlRun "chown user1 /home/ldap/user1"
rlPhaseEnd
rlPhaseStartTest
rlRun "su user1 -c 'crontab ${testDir}/user1.cron'" 0 "Creating user cronjob" && \
cat ${testDir}/user1.cron;
rlFileBackup /etc/crontab
rlRun "rlServiceStop slapd"
rlRun "service sssd stop"
rlRun "rm -rf /var/lib/sss/db/*"
rlRun "service sssd start"
rlRun "getent passwd user1" 2
rlRun "echo \"* * * * * user1 /bin/echo foo > /tmp/cron.out\" > /etc/crontab" 0 \
"Create record in system crontab"
cat /etc/crontab
rlRun "service crond restart"
rlRun "rlServiceStart slapd"
rlRun "service sssd stop"
rlRun "rm -rf /var/lib/sss/db/*"
rlRun "service sssd start"
waitCounter=60;
echo "Waiting for LDAP"
while ! getent passwd user1; do
sleep 1;
echo -n .
[[ waitCounter -le 0 ]] && break;
waitCounter=$((waitCounter-1));
done
echo;
rlRun "getent passwd user1"
rm -f /home/ldap/user1/cron.out
echo "Waiting for cronjob execution"
sleep 65;
if rlRun "[[ -f /home/ldap/user1/cron.out ]]" 0 "User cronjob executed successfully"; then
rlAssertGrep "foo" /home/ldap/user1/cron.out;
fi
if rlRun "[[ -f /tmp/cron.out ]]" 0 "Crontab cronjob executed successfully"; then
rlAssertGrep "foo" /tmp/cron.out;
fi
rlRun "service crond stop"
cat /var/log/cron
rlPhaseEnd
rlPhaseStart WARN "Cleanup"
rlRun "service crond restart"
rlRun "crontab -r -u user1"
rlRun "rlServiceStop slapd"
rlRun "authconfig --disableldap --disableldapauth --update"
rlRun "authconfig --restorebackup=CoreOS_cronie_Regression_ldap-users"
rlRun "authconfig_cleanup"
rlRun "popd"
rlRun "rm -r $tmpDir" 0 "Removing tmp directory"
rlRun "rm -r /home/ldap/user1"
rlRun "rm -r /home/ldap"
rlFileRestore
rlServiceRestore slapd
rlServiceRestore sssd
/bin/kill -HUP $(cat /var/run/syslogd.pid)
rlServiceRestore crond
#avoid systemd failing to start crond due start-limit
sleep 10
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -1,32 +0,0 @@
include /etc/openldap/schema/core.schema
include /etc/openldap/schema/cosine.schema
include /etc/openldap/schema/inetorgperson.schema
include /etc/openldap/schema/nis.schema
allow bind_v2
pidfile /var/run/openldap/slapd.pid
argsfile /var/run/openldap/slapd.args
database bdb
suffix "dc=foo,dc=bar,dc=com"
rootdn "cn=admin,dc=foo,dc=bar,dc=com"
# Password is 'x'.
rootpw {SSHA}GPhzu7pTYP4I+nGeujpBkODiPxX0v8n8
directory /var/run/openldap/
index objectClass eq,pres
index ou,cn,mail,surname,givenname eq,pres,sub
index uidNumber,gidNumber,loginShell eq,pres
index uid,memberUid eq,pres,sub
index nisMapName,nisMapEntry eq,pres,sub
index entryCSN,entryUUID eq
access to attrs=shadowLastChange,userPassword
by self write
by * auth
access to *
by * read

View file

@ -1,10 +0,0 @@
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * command to be executed
* * * * * /bin/echo foo > $HOME/cron.out

View file

@ -0,0 +1,14 @@
summary: When crond is running in multiple instance, then cron jobs are executed
multiple times. Is neccesary to prevent multiple instances of crond running
in time.
description: ''
contact: Jakub Prokes <jprokes@redhat.com>
component:
- cronie
test: ./runtest.sh
framework: beakerlib
recommend:
- cronie
duration: 5m
extra-summary: /CoreOS/cronie/Regression/only-one-running-instance-in-time
extra-task: /CoreOS/cronie/Regression/only-one-running-instance-in-time

1
tests/only-one-running-instance-in-time/runtest.sh Normal file → Executable file
View file

@ -27,7 +27,6 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/bin/rhts-environment.sh || exit 1
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="cronie"

View file

@ -0,0 +1,13 @@
summary: Test for cronie has a bug when run with syslog flag
description: "Bug summary: cronie has a bug when run with syslog flag\n"
contact: Jakub Prokes <jprokes@redhat.com>
component:
- cronie
test: ./runtest.sh
framework: beakerlib
recommend:
- cronie
- rsyslog
duration: 10m
extra-summary: /CoreOS/cronie/Regression/run-with-syslog-flag
extra-task: /CoreOS/cronie/Regression/run-with-syslog-flag

1
tests/run-with-syslog-flag/runtest.sh Normal file → Executable file
View file

@ -26,7 +26,6 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include Beaker environment
. /usr/bin/rhts-environment.sh || exit 1
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="cronie"

View file

@ -1,82 +0,0 @@
---
# Tests to run in a classic environment
- hosts: localhost
roles:
- role: standard-test-beakerlib
tags:
- classic
tests:
- anacron-segfaults-with-certain-config-data
- anacron-segfaults-with-certain-config-data-2
- Can-t-remove-crontab-from-expired-accounts
- Cron-does-uid-lookups-for-non-existent-users
- cron-daemon-fails-to-log-that-it-is-shutting-down
- crond-is-missing-RELRO-flags
- crond-subtask-abnormal-termination-removes-pid-file-in-error
- config-parsing-issue
- cronie-jobs-environment
- crontab-can-invoke-lookup-for-nonexisted-user
- crontab-has-wrong-permissions
# - echos-OK-twice-in-init-script Does not work on Fedora-26
- init-script-failure
# - init-scripts-LSB Does not work on Fedora-26
# - ldap-users Does not work on Fedora-26
# - MAILTO-problem-with-anacron Does not work on Fedora-26
- Make-crontab-a-PIE
- only-one-running-instance-in-time
- run-with-syslog-flag
- usr-bin-crontab-has-wrong-permissions
required_packages:
- authconfig # ldap-users needs this package
- findutils # beakerlib needs find command
- elfutils # crond-is-missing-RELRO-flags needs eu-readelf tool
- gcc # cronie-jobs-environment needs gcc command
- openldap # ldap-users needs this package
- openldap-servers # ldap-users needs this package
- openldap-clients # ldap-users needs this package
- procps-ng # multiple tests need ps and pidof commands
- psmisc # multiple tests need killall command
- rsyslog # run-with-syslog-flag requires this package
- sendmail # MAILTO-problem-with-anacron needs sendmail command
- sssd # ldap-users needs this package
- sssd-ldap # ldap-users needs this package
# Tests to run in a container environment
- hosts: localhost
roles:
- role: standard-test-beakerlib
tags:
- container
tests:
- Can-t-remove-crontab-from-expired-accounts
- Make-crontab-a-PIE
- config-parsing-issue
- crond-is-missing-RELRO-flags
- crontab-has-wrong-permissions
- usr-bin-crontab-has-wrong-permissions
required_packages:
- cronie # everything needs cronie package
- findutils # beakerlib needs find command
- procps-ng # multiple tests need ps and pidof commands
- psmisc # multiple tests need killall command
- elfutils # multiple tests need eu-readelf tool
# Tests to run in an Atomic Host VM
- hosts: localhost
roles:
- role: standard-test-beakerlib
tags:
- atomic
tests:
- Can-t-remove-crontab-from-expired-accounts
- Make-crontab-a-PIE
- config-parsing-issue
- crond-is-missing-RELRO-flags
- crontab-has-wrong-permissions
- usr-bin-crontab-has-wrong-permissions
required_packages:
- cronie # everything needs cronie package
- findutils # beakerlib needs find command
- procps-ng # multiple tests need ps and pidof commands
- psmisc # multiple tests need killall command
- elfutils # multiple tests need eu-readelf tool

View file

@ -0,0 +1,12 @@
summary: Test for /usr/bin/crontab has wrong permissions
description: "Bug summary: /usr/bin/crontab has wrong permissions\n\n"
contact: Martin Cermak <mcermak@redhat.com>
component:
- cronie
test: ./runtest.sh
framework: beakerlib
recommend:
- cronie
duration: 15m
extra-summary: /CoreOS/cronie/Regression/usr-bin-crontab-has-wrong-permissions
extra-task: /CoreOS/cronie/Regression/usr-bin-crontab-has-wrong-permissions

3
tests/usr-bin-crontab-has-wrong-permissions/runtest.sh Normal file → Executable file
View file

@ -27,8 +27,7 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Include rhts environment
. /usr/bin/rhts-environment.sh
. /usr/lib/beakerlib/beakerlib.sh
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="cronie"