Compare commits

..

87 commits

Author SHA1 Message Date
Fedora Release Engineering
1fc0da4465 Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild 2026-07-15 21:21:33 +00:00
Fedora Release Engineering
6057f3c46f Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild 2026-01-16 09:31:48 +00:00
Fedora Release Engineering
8f728760f9 Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild 2026-01-16 05:32:24 +00:00
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
Fedora Release Engineering
693b5e7757 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2022-01-20 00:00:23 +00:00
Fedora Release Engineering
0430abfa30 - Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-07-21 20:07:31 +00:00
Jan Staněk
3aacb38dac
Address issues found by static scanners 2021-04-30 12:26:12 +02:00
Tomas Mraz
06a5d6d9be new upstream release 1.5.7 with bug fixes and enhancements 2021-03-29 14:02:34 +02:00
Tomas Mraz
6eddeae803 Correcting my current e-mail address. 2021-03-17 17:32:14 +01:00
Tomas Mraz
84fb0bd593 new upstream release 1.5.6 with bug fixes and enhancements 2021-03-17 17:04:28 +01:00
Fedora Release Engineering
7a7103845d - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2021-01-26 02:42:40 +00:00
Tom Stellard
5424c5f037 Add BuildRequires: make
https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot
2020-12-17 04:01:16 +00:00
Fedora Release Engineering
e304e4268e - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-07-27 14:44:01 +00:00
Tom Stellard
1b8ed91a4d Use make macros
https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro
2020-07-13 18:57:08 +00:00
Fedora Release Engineering
4b24659787 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2020-01-28 15:00:26 +00:00
Tomas Mraz
272435829e new upstream release 1.5.5 with multiple bug fixes and improvements 2019-10-31 17:37:35 +01:00
Fedora Release Engineering
555e64aab6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-07-24 21:11:21 +00:00
Tomas Mraz
65ba1488c9 new upstream release 1.5.4 with regression fix 2019-03-18 11:50:48 +01:00
Tomas Mraz
c28ae405c5 new upstream release 1.5.3 fixing CVE-2019-9704 and CVE-2019-9705 2019-03-15 11:31:56 +01:00
Fedora Release Engineering
592f27bf38 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2019-01-31 16:25:47 +00:00
6467f59601 Remove obsolete Group tag
References: https://fedoraproject.org/wiki/Changes/Remove_Group_Tag
2019-01-28 20:23:58 +01:00
Tomas Mraz
4d665d4d53 Do not hard-require systemd as crond is used in containers without systemd
(#1654659)
2018-11-30 11:35:36 +01:00
Tomas Mraz
b372458e40 use role from the current context for system crontabs (#1639381) 2018-10-31 13:34:14 +01:00
Fedora Release Engineering
16ea7b2230 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-07-12 22:21:16 +00:00
Tomas Mraz
8c79b167a4 new upstream release 1.5.2 2018-05-03 19:06:15 +02:00
Tomas Mraz
27b8ae70a1 Add gcc to BuildRequires 2018-02-21 14:54:51 +01:00
Fedora Release Engineering
56e143a8cd - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2018-02-07 05:55:18 +00:00
Serhii Turivnyi
2a1211843d Add CI tests for Atomic Host using the standard test interface 2017-12-13 16:46:36 +02:00
Tomas Mraz
7b42a698ab Fix the URL and Source URL. 2017-10-16 16:12:41 +02:00
Andrei Stepanov
6743dfe08f Add CI tests using the standard test interface
Adds tests according to the CI wiki [0] specifically the standard test interface in the spec [1].

[0]: https://fedoraproject.org/wiki/CI
[1]: https://fedoraproject.org/wiki/Changes/InvokingTests
2017-10-06 10:38:34 +00:00
Fedora Release Engineering
ef22e6ea33 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild 2017-08-02 19:16:38 +00:00
Fedora Release Engineering
c15b627504 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild 2017-07-26 05:38:45 +00:00
Tomas Mraz
876d673618 fix Y2038 problems in cron and anacron (#1445136) 2017-05-04 17:20:52 +02:00
Fedora Release Engineering
d4e9ad734e - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild 2017-02-10 07:58:48 +00:00
Tomas Mraz
d33f223a28 make failure of creation of the ghost files in /var non-fatal 2017-01-03 10:20:45 +01:00
Tomas Mraz
2393c64c86 on some machines the power supply is named ADP0 2016-09-05 10:58:35 +02:00
Tomas Mraz
a1d815b665 query power status directly from kernel 2016-08-23 15:33:09 +02:00
Tomas Mraz
63359d0bd6 new upstream release 2016-06-23 19:31:23 +02:00
Dennis Gilmore
defc50d8e0 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild 2016-02-03 18:13:18 +00:00
Tomas Mraz
3fe8250dee the temp file name used by crontab needs to be ignored by crond 2015-07-13 13:34:08 +02:00
Dennis Gilmore
847f386cc7 - Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild 2015-06-17 03:23:30 +00:00
Tomas Mraz
058f85b74e new upstream release 2015-05-28 16:25:48 +02:00
Tomas Mraz
bb7b26ebbb Two small fixes.
- mark the 0hourly and dailyjobs crontabs as config
- do not add already existing orphan on reload
2015-04-21 15:40:08 +02:00
Tomas Mraz
e118cfddd7 correct the permissions of the anacron timestamp files 2015-02-03 12:33:18 +01:00
Tomas Mraz
fc778cf11f check for NULL pamh on two more places (#1176215) 2015-01-02 11:38:53 +01:00
Tomas Mraz
bc9aef5aa3 call PAM only for non-root user or non-system crontabs (#956157)
- bypass the PAM check in crontab for root (#1169175)
2014-12-02 17:08:20 +01:00
Tomas Mraz
17fb400cbb refresh user entries when jobs are run 2014-11-04 17:50:14 +01:00
Marcela Mašláňová
42a8554864 New release 1.4.12. 2014-09-17 17:13:50 +02:00
7fc0c974c9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild 2014-08-16 01:35:48 +00:00
Tom Callaway
d306dacd57 fix license handling 2014-07-11 16:58:39 -04:00
Dennis Gilmore
063a8fb9e9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild 2014-06-07 01:10:23 -05:00
Marcela Mašláňová
baf9308b21 Close all unwanted open file descriptors before executing commands and mail.
There might be file descriptors open by things like pam_systemd that
we do not want to keep open for the child process.

Original idea by: Jakub Jelen <jjelen@redhat.com>
Upstream commit: b2c8cbcef8c97b5a175d6e71995249b288707b0f
2014-04-30 14:49:02 +02:00
Ville Skyttä
33d5961320 Drop INSTALL from docs, fix rpmlint tabs vs spaces warning. 2014-01-16 22:05:22 +02:00
Marcela Mašláňová
ed73090ea1 Cronies systemd script use KillMode=process. rhbz#919290 2013-09-25 12:39:11 +02:00
Marcela Mašláňová
bce1943a1d Some jobs are not executed because not all environment variables are set. rhbz#995590 2013-09-25 12:35:40 +02:00
Dennis Gilmore
64608df465 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild 2013-08-03 01:07:34 -05:00
Marcela Mašláňová
14b82f418a update license, anacron is under GPLv2+. 2013-07-22 14:31:06 +02:00
Marcela Mašláňová
2da563359d Scriptlets are not created correctly if systemd is not in BR 986698.
Remove sub-package sysvinit, which is not needed anymore
2013-07-22 14:10:15 +02:00
Marcela Mašláňová
773adb9501 new release 1.4.11 (contains previous bug fixes from 1.4.10-5) 2013-07-18 16:24:54 +02:00
97 changed files with 3363 additions and 848 deletions

1
.fmf/version Normal file
View file

@ -0,0 +1 @@
1

5
.gitignore vendored
View file

@ -1,4 +1 @@
cronie-1.4.7.tar.gz
/cronie-1.4.8.tar.gz
/cronie-1.4.9.tar.gz
/cronie-1.4.10.tar.gz
/cronie-*.tar.gz

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

@ -1,56 +0,0 @@
diff -up cronie-1.4.11/src/security.c.old cronie-1.4.11/src/security.c
--- cronie-1.4.11/src/security.c.old 2013-07-18 14:27:08.000000000 +0200
+++ cronie-1.4.11/src/security.c 2013-09-25 12:29:19.467145843 +0200
@@ -129,15 +129,13 @@ int cron_set_job_security_context(entry
}
#endif
- *jobenv = build_env(e->envp);
-
#ifdef WITH_SELINUX
/* we must get the crontab context BEFORE changing user, else
* we'll not be permitted to read the cron spool directory :-)
*/
security_context_t ucontext = 0;
- if (cron_get_job_range(u, &ucontext, *jobenv) < OK) {
+ if (cron_get_job_range(u, &ucontext, e->envp) < OK) {
log_it(e->pwd->pw_name, getpid(), "ERROR",
"failed to get SELinux context", 0);
return -1;
@@ -165,6 +163,8 @@ int cron_set_job_security_context(entry
return -1;
}
+ *jobenv = build_env(e->envp);
+
time_t job_run_time = time(0L);
if ((minutely_time > 0) && ((job_run_time / 60) != (minutely_time / 60))) {
@@ -615,16 +615,23 @@ int crontab_security_access(void) {
*/
static char **build_env(char **cronenv) {
#ifdef WITH_PAM
- char **jobenv;
- char **pamenv = pam_getenvlist(pamh);
+ char **jobenv = pam_getenvlist(pamh);
char *cronvar;
int count = 0;
- jobenv = env_copy(pamenv);
/* Now add the cron environment variables. Since env_set()
* overwrites existing variables, this will let cron's
* environment settings override pam's */
+ if (jobenv == NULL) {
+ jobenv = env_init();
+ if (jobenv == NULL) {
+ log_it("CRON", getpid(),
+ "ERROR", "Initialization of cron environment variables failed", 0);
+ return NULL;
+ }
+ }
+
while ((cronvar = cronenv[count++])) {
if (!(jobenv = env_set(jobenv, cronvar))) {
log_it("CRON", getpid(),

View file

@ -1,172 +0,0 @@
diff -up cronie-1.4.10/src/env.c.copy-env cronie-1.4.10/src/env.c
--- cronie-1.4.10/src/env.c.copy-env 2012-11-27 08:32:13.000000000 +0100
+++ cronie-1.4.10/src/env.c 2013-06-11 17:41:08.533094913 +0200
@@ -25,6 +25,7 @@
#include <errno.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include "globals.h"
#include "funcs.h"
@@ -67,7 +68,7 @@ char **env_copy(char **envp) {
return (p);
}
-char **env_set(char **envp, char *envstr) {
+char **env_set(char **envp, const char *envstr) {
int count, found;
char **p, *envtmp;
@@ -112,6 +113,47 @@ char **env_set(char **envp, char *envstr
return (p);
}
+int env_set_from_environ(char ***envpp) {
+ static const char *names[] = {
+ "LANG",
+ "LC_CTYPE",
+ "LC_NUMERIC",
+ "LC_TIME",
+ "LC_COLLATE",
+ "LC_MONETARY",
+ "LC_MESSAGES",
+ "LC_PAPER",
+ "LC_NAME",
+ "LC_ADDRESS",
+ "LC_TELEPHONE",
+ "LC_MEASUREMENT",
+ "LC_IDENTIFICATION",
+ "LC_ALL",
+ "LANGUAGE",
+ NULL
+ };
+ const char **name;
+ char **procenv;
+
+ for (procenv = environ; *procenv != NULL; ++procenv) {
+ for (name = names; *name != NULL; ++name) {
+ size_t namelen;
+
+ namelen = strlen(*name);
+ if (strncmp(*name, *procenv, namelen) == 0
+ && (*procenv)[namelen] == '=') {
+ char **tmpenv;
+
+ tmpenv = env_set(*envpp, *procenv);
+ if (tmpenv == NULL)
+ return FALSE;
+ *envpp = tmpenv;
+ }
+ }
+ }
+ return TRUE;
+}
+
/* The following states are used by load_env(), traversed in order: */
enum env_state {
NAMEI, /* First char of NAME, may be quote */
diff -up cronie-1.4.10/src/funcs.h.copy-env cronie-1.4.10/src/funcs.h
--- cronie-1.4.10/src/funcs.h.copy-env 2012-11-27 10:22:14.000000000 +0100
+++ cronie-1.4.10/src/funcs.h 2013-06-11 17:08:36.462019472 +0200
@@ -67,6 +67,7 @@ int load_database(cron_db *),
swap_uids(void),
swap_uids_back(void),
load_env(char *, FILE *),
+ env_set_from_environ(char ***envpp),
cron_pclose(FILE *),
glue_strings(char *, size_t, const char *, const char *, char),
strcmp_until(const char *, const char *, char),
@@ -81,7 +82,7 @@ char *env_get(const char *, char **),
*first_word(const char *, const char *),
**env_init(void),
**env_copy(char **),
- **env_set(char **, char *);
+ **env_set(char **, const char *);
user *load_user(int, struct passwd *, const char *, const char *, const char *),
*find_user(cron_db *, const char *, const char *);
diff -up cronie-1.4.10/src/user.c.copy-env cronie-1.4.10/src/user.c
--- cronie-1.4.10/src/user.c.copy-env 2012-11-27 08:32:13.000000000 +0100
+++ cronie-1.4.10/src/user.c 2013-06-11 17:34:51.000000000 +0200
@@ -63,7 +63,7 @@ load_user (int crontab_fd, struct passwd
FILE *file;
user *u;
entry *e;
- int status, save_errno = errno;
+ int status = TRUE, save_errno = 0;
char **envp = NULL, **tenvp;
if (!(file = fdopen(crontab_fd, "r"))) {
@@ -84,26 +84,24 @@ load_user (int crontab_fd, struct passwd
if (((u->name = strdup(fname)) == NULL)
|| ((u->tabname = strdup(tabname)) == NULL)) {
save_errno = errno;
- free_user(u);
- u = NULL;
goto done;
}
-
/* init environment. this will be copied/augmented for each entry.
*/
if ((envp = env_init()) == NULL) {
save_errno = errno;
- free_user(u);
- u = NULL;
+ goto done;
+ }
+
+ if (env_set_from_environ(&envp) == FALSE) {
+ save_errno = errno;
goto done;
}
#ifdef WITH_SELINUX
if (get_security_context(pw == NULL ? NULL : uname,
crontab_fd, &u->scontext, tabname) != 0) {
- free_user (u);
- u = NULL;
goto done;
}
#endif
@@ -111,15 +109,10 @@ load_user (int crontab_fd, struct passwd
*/
while ((status = load_env (envstr, file)) >= OK) {
switch (status) {
- case ERR:
- save_errno = errno;
- free_user(u);
- u = NULL;
- goto done;
case FALSE:
FileName = tabname;
e = load_entry(file, log_error, pw, envp);
- if (e) {
+ if (e) {
e->next = u->crontab;
u->crontab = e;
}
@@ -127,16 +120,18 @@ load_user (int crontab_fd, struct passwd
case TRUE:
if ((tenvp = env_set (envp, envstr)) == NULL) {
save_errno = errno;
- free_user(u);
- u = NULL;
goto done;
}
- envp = tenvp;
- break;
+ envp = tenvp;
+ break;
}
}
done:
+ if (status == TRUE) {
+ free_user(u);
+ u = NULL;
+ }
if (envp)
env_free(envp);
fclose(file);

View file

@ -1,163 +0,0 @@
diff --git a/man/crontab.5 b/man/crontab.5
index 740e393..bfc8414 100644
--- a/man/crontab.5
+++ b/man/crontab.5
@@ -143,6 +143,13 @@ specifications of the particular security context. For more information,
see
.BR crontab (1)\ -s\ option.
.PP
+The
+.I RANDOM_DELAY
+variable allows delaying job startups by random amount of minutes with
+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 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/cron.c b/src/cron.c
index 6fd0c31..ec4ace7 100644
--- a/src/cron.c
+++ b/src/cron.c
@@ -39,6 +39,7 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
+#include <sys/time.h>
#ifdef WITH_INOTIFY
# include <sys/inotify.h>
@@ -202,6 +203,9 @@ int main(int argc, char *argv[]) {
char *cs;
pid_t pid = getpid();
long oldGMToff;
+ struct timeval tv;
+ struct timezone tz;
+ char buf[256];
if ((ProgramName=strrchr(argv[0], '/')) == NULL) {
ProgramName = argv[0];
@@ -298,6 +302,15 @@ int main(int argc, char *argv[]) {
}
pid = getpid();
+
+ /* obtain a random scaling factor for RANDOM_DELAY */
+ if (gettimeofday(&tv, &tz) != 0)
+ tv.tv_usec = 0;
+ srandom(pid + tv.tv_usec);
+ RandomScale = random() / (double)RAND_MAX;
+ snprintf(buf, sizeof(buf), "RANDOM_DELAY will be scaled with factor %d%% if used.", (int)(RandomScale*100));
+ log_it("CRON", pid, "INFO", buf, 0);
+
acquire_daemonlock(0);
database.head = NULL;
database.tail = NULL;
@@ -508,8 +521,6 @@ static void run_reboot_jobs(cron_db * db) {
static void find_jobs(int vtime, cron_db * db, int doWild, int doNonWild, long vGMToff) {
char *orig_tz, *job_tz;
- time_t virtualSecond = vtime * SECONDS_PER_MINUTE;
- time_t virtualGMTSecond = virtualSecond - vGMToff;
struct tm *tm;
int minute, hour, dom, month, dow;
user *u;
@@ -542,11 +553,7 @@ static void find_jobs(int vtime, cron_db * db, int doWild, int doNonWild, long v
} while (0)
orig_tz = getenv("TZ");
- maketime(NULL, orig_tz);
- Debug(DSCH, ("[%ld] tick(%d,%d,%d,%d,%d) %s %s\n",
- (long) getpid(), minute, hour, dom, month, dow,
- doWild ? " " : "No wildcard", doNonWild ? " " : "Wildcard only"));
/* the dom/dow situation is odd. '* * 1,15 * Sun' will run on the
* first and fifteenth AND every Sunday; '* * * * Sun' will run *only*
* on Sundays; '* * 1,15 * *' will run *only* the 1st and 15th. this
@@ -561,6 +568,8 @@ static void find_jobs(int vtime, cron_db * db, int doWild, int doNonWild, long v
uname = e->pwd->pw_name;
/* check if user exists in time of job is being run f.e. ldap */
if (getpwnam(uname) != NULL) {
+ time_t virtualSecond = (vtime - e->delay) * SECONDS_PER_MINUTE;
+ time_t virtualGMTSecond = virtualSecond - vGMToff;
job_tz = env_get("CRON_TZ", e->envp);
maketime(job_tz, orig_tz);
/* here we test whether time is NOW */
diff --git a/src/entry.c b/src/entry.c
index e9142f5..fa69524 100644
--- a/src/entry.c
+++ b/src/entry.c
@@ -35,6 +35,7 @@
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
+#include <errno.h>
#include "bitstring.h"
#include "funcs.h"
@@ -97,6 +98,7 @@ entry *load_entry(FILE * file, void (*error_func) (), struct passwd *pw,
char cmd[MAX_COMMAND];
char envstr[MAX_ENVSTR];
char **tenvp;
+ char *p;
Debug(DPARS, ("load_entry()...about to eat comments\n"));
@@ -297,6 +299,20 @@ entry *load_entry(FILE * file, void (*error_func) (), struct passwd *pw,
}
memset(e->pwd->pw_passwd, 0, strlen(e->pwd->pw_passwd));
+ p = env_get("RANDOM_DELAY", envp);
+ if (p) {
+ char *endptr;
+ long val;
+
+ errno = 0; /* To distinguish success/failure after call */
+ val = strtol(p, &endptr, 10);
+ if (errno != 0 || val < 0 || val > 24*60) {
+ log_it("CRON", getpid(), "ERROR", "bad value of RANDOM_DELAY", 0);
+ } else {
+ e->delay = val * RandomScale;
+ }
+ }
+
/* copy and fix up environment. some variables are just defaults and
* others are overrides.
*/
diff --git a/src/env.c b/src/env.c
index 1ebea62..3ad8bf7 100644
--- a/src/env.c
+++ b/src/env.c
@@ -130,6 +130,7 @@ int env_set_from_environ(char ***envpp) {
"LC_IDENTIFICATION",
"LC_ALL",
"LANGUAGE",
+ "RANDOM_DELAY",
NULL
};
const char **name;
diff --git a/src/globals.h b/src/globals.h
index 4370974..e957c9a 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -81,6 +81,7 @@ XTRN char MailCmd[MAX_COMMAND];
XTRN char cron_default_mail_charset[MAX_ENVSTR];
XTRN int EnableClustering;
XTRN int ChangePath;
+XTRN double RandomScale;
#if DEBUGGING
XTRN int DebugFlags INIT(0);
diff --git a/src/structs.h b/src/structs.h
index 200d20d..272777a 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -41,6 +41,7 @@ typedef struct _entry {
bitstr_t bit_decl(month, MONTH_COUNT);
bitstr_t bit_decl(dow, DOW_COUNT);
int flags;
+ int delay;
#define MIN_STAR 0x01
#define HR_STAR 0x02
#define DOM_STAR 0x04

View file

@ -1,27 +0,0 @@
From 5ac31751adfa31c5e5e316afc2f800037bd1cdca Mon Sep 17 00:00:00 2001
From: Tomas Mraz <tmraz@fedoraproject.org>
Date: Thu, 6 Jun 2013 20:13:26 +0200
Subject: [PATCH] Do not use putenv with string literal.
---
src/cron.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/cron.c b/src/cron.c
index 9974887..08d0812 100644
--- a/src/cron.c
+++ b/src/cron.c
@@ -244,8 +244,8 @@ int main(int argc, char *argv[]) {
check_spool_dir();
if (ChangePath) {
- if (putenv("PATH=" _PATH_DEFPATH) < 0) {
- log_it("CRON", pid, "DEATH", "can't putenv PATH",
+ if (setenv("PATH", _PATH_DEFPATH, 1) < 0) {
+ log_it("CRON", pid, "DEATH", "can't setenv PATH",
errno);
exit(1);
}
--
1.7.7.6

View file

@ -1,94 +0,0 @@
diff --git a/src/cron.c b/src/cron.c
index 7dc2958..7917589 100644
--- a/src/cron.c
+++ b/src/cron.c
@@ -64,11 +64,19 @@ static int DisableInotify;
int wd[NUM_WATCHES];
const char *watchpaths[NUM_WATCHES] = {SPOOL_DIR, SYS_CROND_DIR, SYSCRONTAB};
+static void reset_watches(void) {
+ int i;
+
+ for (i = 0; i < sizeof (wd) / sizeof (wd[0]); ++i) {
+ wd[i] = -2;
+ }
+}
+
void set_cron_unwatched(int fd) {
int i;
for (i = 0; i < sizeof (wd) / sizeof (wd[0]); ++i) {
- if (wd[i] < 0) {
+ if (wd[i] > 0) {
inotify_rm_watch(fd, wd[i]);
wd[i] = -1;
}
@@ -87,22 +95,21 @@ void set_cron_watched(int fd) {
for (i = 0; i < sizeof (wd) / sizeof (wd[0]); ++i) {
int w;
- if (open(watchpaths[i], O_RDONLY | O_NONBLOCK, 0) != -1) {
- w = inotify_add_watch(fd, watchpaths[i],
- IN_CREATE | IN_CLOSE_WRITE | IN_ATTRIB | IN_MODIFY | IN_MOVED_TO |
- IN_MOVED_FROM | IN_MOVE_SELF | IN_DELETE | IN_DELETE_SELF);
- if (w < 0) {
- if (wd[i] != -1) {
- log_it("CRON", pid, "This directory or file can't be watched",
- watchpaths[i], errno);
- log_it("CRON", pid, "INFO", "running without inotify support", 0);
- }
- inotify_enabled = 0;
- set_cron_unwatched(fd);
- return;
+ w = inotify_add_watch(fd, watchpaths[i],
+ IN_CREATE | IN_CLOSE_WRITE | IN_ATTRIB | IN_MODIFY | IN_MOVED_TO |
+ IN_MOVED_FROM | IN_MOVE_SELF | IN_DELETE | IN_DELETE_SELF);
+ if (w < 0 && errno != ENOENT) {
+ if (wd[i] != -1) {
+ log_it("CRON", pid, "This directory or file can't be watched",
+ watchpaths[i], errno);
+ log_it("CRON", pid, "INFO", "running without inotify support",
+ 0);
}
- wd[i] = w;
+ inotify_enabled = 0;
+ set_cron_unwatched(fd);
+ return;
}
+ wd[i] = w;
}
if (!inotify_enabled) {
@@ -120,6 +127,7 @@ static void handle_signals(cron_db * database) {
/* watches must be reinstated on reload */
if (inotify_enabled && (EnableClustering != 1)) {
set_cron_unwatched(database->ifd);
+ reset_watches();
inotify_enabled = 0;
}
#endif
@@ -158,9 +166,6 @@ int main(int argc, char *argv[]) {
char *cs;
pid_t pid = getpid();
long oldGMToff;
-#if defined WITH_INOTIFY
- int i;
-#endif
ProgramName = argv[0];
MailCmd[0] = '\0';
@@ -261,13 +266,7 @@ int main(int argc, char *argv[]) {
"", 0);
}
else {
- for (i = 0; i < sizeof (wd) / sizeof (wd[0]); ++i) {
- /* initialize to negative number other than -1
- * so an eventual error is reported for the first time
- */
- wd[i] = -2;
- }
-
+ reset_watches();
database.ifd = fd = inotify_init();
fcntl(fd, F_SETFD, FD_CLOEXEC);
if (fd < 0)

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,6 +0,0 @@
diff -up cronie-1.4.8/NEWS.old cronie-1.4.8/NEWS
--- cronie-1.4.8/NEWS.old 2010-12-16 09:59:02.000000000 +0100
+++ cronie-1.4.8/NEWS 2011-08-02 13:11:16.818463245 +0200
@@ -0,0 +1 @@
+agjljg
\ No newline at end of file

View file

@ -1,21 +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.4.10
Release: 7%{?dist}
License: MIT and BSD and ISC and GPLv2
Group: System Environment/Base
URL: https://fedorahosted.org/cronie
Source0: https://fedorahosted.org/releases/c/r/cronie/%{name}-%{version}.tar.gz
Patch1: cronie-1.4.10-use-setenv.patch
Patch2: cronie-1.4.10-copy-env.patch
Patch3: cronie-1.4.10-random-delay.patch
Patch4: correct-env.patch
Patch5: unitfile-killprocess.patch
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-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
@ -30,13 +38,20 @@ Buildrequires: pam-devel >= 1.0.1
%if %{with audit}
Buildrequires: audit-libs-devel >= 1.4.1
%endif
BuildRequires: systemd
BuildRequires: gcc
BuildRequires: systemd
BuildRequires: make
Obsoletes: %{name}-sysvinit
Requires(post): coreutils sed
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
Requires(post): systemd
%if 0%{?fedora} && 0%{?fedora} < 28 || 0%{?rhel} && 0%{?rhel} < 8
%{?systemd_requires}
%else
%{?systemd_ordering} # does not exist on Fedora27/RHEL7
%endif
%description
Cronie contains the standard UNIX daemon crond that runs specified programs at
@ -47,7 +62,6 @@ SELinux.
%package anacron
Summary: Utility for running regular jobs
Requires: crontabs
Group: System Environment/Base
Provides: dailyjobs
Provides: anacron = 2.4
Obsoletes: anacron <= 2.3
@ -67,7 +81,6 @@ for better utilization of resources shared among multiple systems.
%package noanacron
Summary: Utility for running simple regular jobs in old cron style
Group: System Environment/Base
Provides: dailyjobs
Requires: crontabs
Requires: %{name} = %{version}-%{release}
@ -76,47 +89,23 @@ Requires: %{name} = %{version}-%{release}
Old style of running {hourly,daily,weekly,monthly}.jobs without anacron. No
extra features.
%package sysvinit
Summary: SysV init script for cronie
Group: System Environment/Base
Requires: %{name} = %{version}-%{release}
Requires(post): /sbin/chkconfig
%description sysvinit
SysV style init script for cronie. It needs to be installed only if systemd
is not used as the system init process.
%prep
%setup -q
%patch1 -p1 -b .setenv
%patch2 -p1 -b .copy-env
%patch3 -p1 -b .random-delay
%patch4 -p1 -b .env
%patch5 -p1
%autosetup -p1
%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 %{?_smp_mflags}
%make_build V=2
%install
make install DESTDIR=$RPM_BUILD_ROOT DESTMAN=$RPM_BUILD_ROOT%{_mandir}
mkdir -pm700 $RPM_BUILD_ROOT%{_localstatedir}/spool/cron
%make_install DESTMAN=$RPM_BUILD_ROOT%{_mandir}
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/
mkdir -pm755 $RPM_BUILD_ROOT%{_sysconfdir}/cron.d/
%if ! %{with pam}
@ -128,29 +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 sysvinit initscript into sub-package
mkdir -pm755 $RPM_BUILD_ROOT%{_initrddir}
install -m 755 cronie.init $RPM_BUILD_ROOT%{_initrddir}/crond
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
[ -e /var/spool/anacron/cron.weekly ] || touch /var/spool/anacron/cron.weekly
[ -e /var/spool/anacron/cron.monthly ] || touch /var/spool/anacron/cron.monthly
# 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
@ -178,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 || :
@ -187,258 +173,43 @@ exit 0
# when it calls pam
/bin/systemctl try-restart crond.service >/dev/null 2>&1 || :
%triggerpostun -n cronie-sysvinit -- cronie < 1.4.8-1
/sbin/chkconfig --add crond >/dev/null 2>&1 || :
%files
%doc AUTHORS COPYING INSTALL README ChangeLog
%attr(755,root,root) %{_sbindir}/crond
%doc AUTHORS README ChangeLog
%{!?_licensedir:%global license %%doc}
%license COPYING
%attr(755,root,root) %{_bindir}/crond
%attr(4755,root,root) %{_bindir}/crontab
%attr(755,root,root) %{_bindir}/cronnext
%{_mandir}/man8/crond.*
%{_mandir}/man8/cron.*
%{_mandir}/man5/crontab.*
%{_mandir}/man1/crontab.*
%dir %{_localstatedir}/spool/cron
%{_mandir}/man1/cronnext.*
%dir %{_sysconfdir}/cron.d
%if %{with pam}
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/pam.d/crond
%endif
%config(noreplace) %{_sysconfdir}/sysconfig/crond
%config(noreplace) %{_sysconfdir}/cron.deny
%attr(0644,root,root) %{_sysconfdir}/cron.d/0hourly
%attr(0644,root,root) /lib/systemd/system/crond.service
%config(noreplace,missingok) %{_sysconfdir}/cron.deny
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/cron.d/0hourly
%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 %verify(not md5 size mtime) /var/spool/anacron/cron.daily
%ghost %verify(not md5 size mtime) /var/spool/anacron/cron.weekly
%ghost %verify(not md5 size mtime) /var/spool/anacron/cron.monthly
%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) %{_sysconfdir}/cron.d/dailyjobs
%files sysvinit
%attr(0755,root,root) %{_initrddir}/crond
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/cron.d/dailyjobs
%changelog
* Thu Sep 26 2013 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.10-7
- forgot to add BR on systemd, which leads to failure of scriptlets
* Wed Sep 25 2013 Marcela Mašláňová <mmaslano@redhat.com> - 1.4.10-6
- some jobs are not executed because not all environment variables are set. rhbz#995590
- cronies systemd script use KillMode=process. rhbz#919290
* 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

@ -1,11 +0,0 @@
[Unit]
Description=Command Scheduler
After=syslog.target auditd.service sssd.service ypbind.service
[Service]
EnvironmentFile=/etc/sysconfig/crond
ExecStart=/usr/sbin/crond -n $CRONDARGS
[Install]
WantedBy=multi-user.target

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 @@
710f0c184d0455e75f984cb4ca45c90e cronie-1.4.10.tar.gz
SHA512 (cronie-1.7.2.tar.gz) = 5b55c677a5b812dbfa70f6ee25e41907e99cc63a4883974c6bb8115ad65155d66665704808c338d2f7be6b0a57028c319f2d1115c69bb5f3efdda1efafd144de

View file

@ -0,0 +1,62 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/cronie/Regression/Can-t-remove-crontab-from-expired-accounts
# Description: Test for Can't remove crontab from expired accounts
# 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/Can-t-remove-crontab-from-expired-accounts
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.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 Can't remove crontab from expired accounts" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(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

@ -0,0 +1,3 @@
PURPOSE of /CoreOS/cronie/Regression/Can-t-remove-crontab-from-expired-accounts
Description: Test for Can't remove crontab from expired accounts
Author: Karel Volny <kvolny@redhat.com>

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

@ -0,0 +1,62 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/cronie/Regression/Can-t-remove-crontab-from-expired-accounts
# Description: Test for Can't remove crontab from expired accounts
# 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/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="cronie"
TestUser="usertest"
ct_file="/var/spool/cron/$TestUser"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlRun "useradd $TestUser" 0 "Adding the testing user"
rlPhaseEnd
rlPhaseStartTest
rlRun "echo '1 1 1 1 1 nonsense' | crontab -u $TestUser -" 0 "Setting up crontab for the testing user"
rlRun -s "crontab -u $TestUser -l" 0 "Checking the testing crontab"
rlAssertGrep "nonsense" $rlRun_LOG
rlRun "chage -E 1 $TestUser" 0 "Expiring the testing user account"
rlRun "crontab -u $TestUser -r" 0 "Removing the testing crontab"
rlAssertNotGrep "not allowed" $rlRun_LOG
rlRun -s "crontab -u $TestUser -l" 1 "Checking the testing crontab (should not exist)"
rlAssertGrep "no crontab for $TestUser" $rlRun_LOG
rlAssertNotGrep "not allowed" $rlRun_LOG
rlAssertNotExists "$ct_file"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "userdel $TestUser" 0 "Deleting the testing user"
rlRun "popd"
rlRun "rm -rf $TmpDir $ct_file" 0 "Removing tmp directory and possible cruft"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,62 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/cronie/Regression/Cron-does-uid-lookups-for-non-existent-users
# Description: Test for Cron does uid lookups for non-existent users
# Author: Vaclav Danek <vdanek@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2015 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/Cron-does-uid-lookups-for-non-existent-users
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.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: Vaclav Danek <vdanek@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test for Cron does uid lookups for non-existent users" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(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

@ -0,0 +1,4 @@
PURPOSE of /CoreOS/cronie/Regression/Cron-does-uid-lookups-for-non-existent-users
Description: Test for Cron does uid lookups for non-existent users
Author: Vaclav Danek <vdanek@redhat.com>
Bug summary: Cron does uid lookups for non-existent users

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

@ -0,0 +1,52 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/cronie/Regression/Cron-does-uid-lookups-for-non-existent-users
# Description: Test for Cron does uid lookups for non-existent users
# Author: Vaclav Danek <vdanek@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2015 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/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="cronie"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest
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
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,63 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/Regression/Regression/Make-crontab-a-PIE
# Description: What the test does
# 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/Regression/Make-crontab-a-PIE
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.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: What the test does" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: cronie" >> $(METADATA)
@echo "Requires: cronie elfutils" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,3 @@
PURPOSE of /CoreOS/Regression/Regression/Make-crontab-a-PIE
Description: What the test does
Author: Jakub Prokes <jprokes@redhat.com>

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

View file

@ -0,0 +1,55 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/Regression/Regression/Make-crontab-a-PIE
# Description: What the test does
# 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/share/beakerlib/beakerlib.sh || exit 1
PACKAGES="cronie vixie-cron"
function myAssertRpms() {
rlRun "rpm -q $*" $((${#@}-1)) "One of required packages was found";
}
rlJournalStart
rlPhaseStartSetup
myAssertRpms $PACKAGES
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest
rlRun "eu-readelf -h /usr/bin/crontab | grep -E 'Type:[[:space:]]+DYN[[:space:]]+\(Shared object file\)'"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,62 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/cronie/Regression/anacron-segfaults-with-certain-config-data
# Description: try some invalid configs for anacron to check config parser
# Author: Jakub Prokes <jprokes@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2014 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/anacron-segfaults-with-certain-config-data-2
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE configs
.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: try some invalid configs for anacron to check config parser" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(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

@ -0,0 +1,3 @@
PURPOSE of /CoreOS/cronie/Regression/anacron-segfaults-with-certain-config-data-2
Description: try some invalid configs for anacron to check config parser
Author: Jakub Prokes <jprokes@redhat.com>

View file

@ -0,0 +1,16 @@
# /etc/anacrontab: configuration file for anacron
# See anacron(8) and anacrontab(5) for details.
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=45
# the jobs will be started during the following hours only
START_HOURS_RANGE=0
#period in days delay in minutes job-identifier command
1 5 cron.daily nice run-parts /etc/cron.daily
7 25 cron.weekly nice run-parts /etc/cron.weekly
@monthly 45 cron.monthly nice run-parts /etc/cron.monthly

View file

@ -0,0 +1,16 @@
# /etc/anacrontab: configuration file for anacron
# See anacron(8) and anacrontab(5) for details.
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=45
# the jobs will be started during the following hours only
START_HOURS_RANGE=3-8
#period in days delay in minutes job-identifier command
1 5 cron.daily nice run-parts /etc/cron.daily
7 25 cron.weekly nice run-parts /etc/cron.weekly
@monthly 45 cron.monthly nice run-parts /etc/cron.monthly

View file

@ -0,0 +1,18 @@
# /etc/anacrontab: configuration file for anacron
# See anacron(8) and anacrontab(5) for details.
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=45
VAR=8
# the jobs will be started during the following hours only
START_HOURS_RANGE=3-$VAR
#START_HOURS_RANGE=0
#period in days delay in minutes job-identifier command
1 5 cron.daily nice run-parts /etc/cron.daily
7 25 cron.weekly nice run-parts /etc/cron.weekly
@monthly 45 cron.monthly nice run-parts /etc/cron.monthly

View file

@ -0,0 +1,17 @@
# /etc/anacrontab: configuration file for anacron
# See anacron(8) and anacrontab(5) for details.
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=45
%@$&=^^^^
# the jobs will be started during the following hours only
START_HOURS_RANGE=%@$&=^^^^
#period in days delay in minutes job-identifier command
1 5 cron.daily nice run-parts /etc/cron.daily
7 25 cron.weekly nice run-parts /etc/cron.weekly
@monthly 45 cron.monthly nice run-parts /etc/cron.monthly

View file

@ -0,0 +1,14 @@
# /etc/anacrontab: configuration file for anacron
# See anacron(8) and anacrontab(5) for details.
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=%@$&=^^^^
#period in days delay in minutes job-identifier command
1 5 cron.daily nice run-parts /etc/cron.daily
7 25 cron.weekly nice run-parts /etc/cron.weekly
@monthly 45 cron.monthly nice run-parts /etc/cron.monthly

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

@ -0,0 +1,65 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/cronie/Regression/anacron-segfaults-with-certain-config-data-2
# Description: try some invalid configs for anacron to check config parser
# Author: Jakub Prokes <jprokes@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2014 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/share/beakerlib/beakerlib.sh || exit 1
assertRpms() {
rlRun "rpm -q $*" 0-$((${#@}-1)) "One of required packages was found";
RC=$?;
[[ $RC -lt ${#@} ]] && return 0;
return $RC;
}
PACKAGES="${PACKAGES:-cronie vixie-cron}"
rlJournalStart
rlPhaseStartSetup
assertRpms $PACKAGES
rlPhaseEnd
rlPhaseStartTest
for scenario in ./configs/*; do
[[ ! -f $scenario ]] && rlFail "$scenario isn't regular file";
## File name has 'special' format: scenario-X_Y where X is scenario number and Y is expected
## exit code. And of course there must be some issues related to RHEL 5 :-)
if rlIsRHEL 5; then
rlRun "anacron -f -u -d -t $(readlink -f $scenario)" 0 "Testing $(basename ${scenario%_[0-9]})";
else
if rlRun "anacron -T -t $scenario;" ${scenario##*_} "Verifying $(basename ${scenario%_[0-9]})"; then
rlRun "anacron -f -u -d -t $scenario" 0 "Testing $(basename ${scenario%_[0-9]})";
else
[[ $? -eq 139 ]] && cat $scenario;
fi
fi
done
rlPhaseEnd
rlPhaseStartCleanup
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,62 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/cronie/Regression/anacron-segfaults-with-certain-config-data
# Description: Test for anacron segfaults with certain config data
# Author: Robin Hack <rhack@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2015 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/anacron-segfaults-with-certain-config-data
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE core.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: Robin Hack <rhack@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test for anacron segfaults with certain config data" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 20m" >> $(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

@ -0,0 +1,3 @@
PURPOSE of /CoreOS/cronie/Regression/anacron-segfaults-with-certain-config-data
Description: anacron segfaults with certain config data
Author: Robin Hack <rhack@redhat.com>

View file

@ -0,0 +1,3 @@
#!/bin/bash
echo "$1" > /tmp/core.lock

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

@ -0,0 +1,75 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/cronie/Regression/anacron-segfaults-with-certain-config-data
# Description: Test for anacron segfaults with certain config data
# Author: Robin Hack <rhack@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2015 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/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="cronie"
rlJournalStart
rlPhaseStartSetup "Set anacron"
rlAssertRpm $PACKAGE
TESTDIR="${PWD}"
rlFileBackup "/etc/anacrontab"
rlRun "echo 'START_HOURS_RANGE=0' > /etc/anacrontab"
# Prepare coredump handler
rlServiceStop crond
rlRun "chmod +x ${TESTDIR}/core.sh"
rlRun "cat /proc/sys/kernel/core_pattern > /tmp/core_pattern"
rlRun "echo \"|${TESTDIR}/core.sh %e\" > /proc/sys/kernel/core_pattern"
rlPhaseEnd
rlPhaseStartTest
rlRun "anacron"
rlRun "sleep 2" 0 "Wait for kernel"
# Anacron segfaults
rlAssertNotExists "/tmp/core.lock"
if [ -s "/tmp/core.lock" ]; then
rlAssertNotGrep "anacron" "/tmp/core.lock"
fi
rlPhaseEnd
rlPhaseStartCleanup
rlRun "cat /tmp/core_pattern > /proc/sys/kernel/core_pattern"
rm -f /tmp/core.lock
rm -f /tmp/core_pattern
killall anacron
rlFileRestore
rlServiceRestore crond
#avoid systemd failing to start crond due start-limit
sleep 10
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,62 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/cronie/Regression/config-parsing-issue
# Description: Test for cronie-anacron-1.4.4-14.el6.x86_64 doesn't like
# Author: Jakub Prokes <jprokes@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2015 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/config-parsing-issue
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.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-anacron-1.4.4-14.el6.x86_64 doesn't like" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(METADATA)
@echo "RunFor: cronie" >> $(METADATA)
@echo "Requires: cronie-anacron" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,4 @@
PURPOSE of /CoreOS/cronie/Regression/config-parsing-issue
Description: Test for cronie-anacron-1.4.4-14.el6.x86_64 doesn't like
Author: Jakub Prokes <jprokes@redhat.com>
Bug summary: cronie-anacron-1.4.4-14.el6.x86_64 doesn't like its own /etc/anacrontab syntax

View file

@ -0,0 +1,52 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/cronie/Regression/config-parsing-issue
# Description: Test for cronie-anacron-1.4.4-14.el6.x86_64 doesn't like
# Author: Jakub Prokes <jprokes@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2015 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/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="cronie-anacron"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlRun "grep '^SHELL' /etc/anacrontab";
rlRun "grep '^PATH' /etc/anacrontab";
rlRun "grep '^MAILTO' /etc/anacrontab";
rlPhaseEnd
rlPhaseStartTest
rlRun "anacron -T"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,62 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/cronie/Regression/cron-daemon-fails-to-log-that-it-is-shutting-down
# Description: Test for cron daemon fails to log that it is shutting down.
# Author: Robin Hack <rhack@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2015 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/cron-daemon-fails-to-log-that-it-is-shutting-down
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.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: Robin Hack <rhack@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test for cron daemon fails to log that it is shutting down." >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 20m" >> $(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

@ -0,0 +1,4 @@
PURPOSE of /CoreOS/cronie/Regression/cron-daemon-fails-to-log-that-it-is-shutting-down
Description: Test for cron daemon fails to log that it is shutting down.
Author: Robin Hack <rhack@redhat.com>
Bug summary: cron daemon fails to log that it is shutting down.

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

@ -0,0 +1,58 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/cronie/Regression/cron-daemon-fails-to-log-that-it-is-shutting-down
# Description: Test for cron daemon fails to log that it is shutting down.
# Author: Robin Hack <rhack@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2015 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/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="cronie"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlServiceStop crond
rlPhaseEnd
rlPhaseStartTest
start_time=$(timedatectl | grep "Local time" | awk '{print$4" "$5}')
rlServiceStart crond
sleep 20
rlRun "journalctl --since \"$start_time\" | grep \"(CRON) INFO\"" 0 "cron startup"
rlServiceStop crond
# give dbus and cronie some time to shut down...
sleep 20
rlRun "journalctl --since \"$start_time\" | grep \"(CRON) INFO (Shutting down)\"" 0 "cron shutdown"
# DEBUG
journalctl _COMM=cron --since="$start_time"
rlPhaseEnd
rlPhaseStartCleanup
rlServiceRestore crond
#avoid systemd failing to start crond due start-limit
sleep 10
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,63 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/cronie/Regression/crond-is-missing-RELRO-flags
# Description: Test for crond is missing RELRO flags
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2011 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/crond-is-missing-RELRO-flags
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Martin Cermak <mcermak@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test for crond is missing RELRO flags" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 15m" >> $(METADATA)
@echo "RunFor: cronie" >> $(METADATA)
@echo "Requires: cronie elfutils" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,5 @@
PURPOSE of /CoreOS/cronie/Regression/crond-is-missing-RELRO-flags
Description: Test for crond is missing RELRO flags
Author: Martin Cermak <mcermak@redhat.com>
Bug summary: crond is missing RELRO flags

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

View file

@ -0,0 +1,42 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/cronie/Regression/crond-is-missing-RELRO-flags
# Description: Test for crond is missing RELRO flags
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2011 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 rhts environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="cronie"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlPhaseEnd
rlPhaseStartTest
rlRun "eu-readelf -l /usr/sbin/crond | fgrep -q 'GNU_RELRO'" 0 "Binary was compiled with RELRO."
rlPhaseEnd
rlJournalEnd

View file

@ -0,0 +1,62 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/cronie/Regression/crond-subtask-abnormal-termination-removes-pid-file-in-error
# Description: Test for crond subtask abnormal termination removes pid
# Author: Robin Hack <rhack@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2015 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/crond-subtask-abnormal-termination-removes-pid-file-in-error
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE crontab-job run-job.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: Robin Hack <rhack@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test for crond subtask abnormal termination removes pid" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 20m" >> $(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

@ -0,0 +1,4 @@
PURPOSE of /CoreOS/cronie/Regression/crond-subtask-abnormal-termination-removes-pid-file-in-error
Description: Test for crond subtask abnormal termination removes pid
Author: Robin Hack <rhack@redhat.com>
Bug summary: crond subtask abnormal termination removes pid file in error

View file

@ -0,0 +1 @@
*/1 * * * * /tmp/run-job.sh

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

@ -0,0 +1,9 @@
#!/bin/bash
if [ -s /tmp/run-job.lock ]; then
exit 0
fi
echo $PPID > /tmp/run-job.lock
sleep 1234567
exit 0

View file

@ -0,0 +1,78 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/cronie/Regression/crond-subtask-abnormal-termination-removes-pid-file-in-error
# Description: Test for crond subtask abnormal termination removes pid
# Author: Robin Hack <rhack@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2015 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/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="cronie"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "cp ./run-job.sh /tmp/"
rlRun "chmod +x /tmp/run-job.sh"
rm -f /tmp/run-job.lock
rlServiceStop crond
rlServiceStart crond
rlRun "crontab -u root ./crontab-job"
rlRun "sleep 60" 0 "Wait for cron job to run"
rlPhaseEnd
rlPhaseStartTest
if [ -s /var/run/crond.pid ]; then
rlPass "Crond pid file exists";
else
rlFail "Cront pid file doesn't exists or is empty"
fi
# /tmp/run-job.lock contains PPID of my job
rlRun "kill -SIGTERM $(cat /tmp/run-job.lock)"
# Cut and pasta! Check file again!
# We love boiler plate code in our tests!
if [ -s /var/run/crond.pid ]; then
rlPass "Crond pid file exists";
else
rlFail "Cront pid file doesn't exists or is empty"
fi
rlPhaseEnd
rlPhaseStartCleanup
killall sleep
crontab -u root -r
rm -f /tmp/run-job.sh
rm -f /tmp/run-job.lock
rlServiceStop crond
rlServiceRestore crond
#avoid systemd failing to start crond due start-limit
sleep 10
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,62 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/cronie/Regression/crontab-can-invoke-lookup-for-nonexisted-user
# Description: Test for Cron does uid lookups for non-existent users
# 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/crontab-can-invoke-lookup-for-nonexisted-user
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.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 Cron does uid lookups for non-existent users" >> $(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

@ -0,0 +1,4 @@
PURPOSE of /CoreOS/cronie/Regression/crontab-can-invoke-lookup-for-nonexisted-user
Description: Test for Cron does uid lookups for non-existent users
Author: Jakub Prokes <jprokes@redhat.com>
Bug summary: Cron does uid lookups for non-existent users

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

@ -0,0 +1,101 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k ft=beakerlib
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/cronie/Regression/crontab-can-invoke-lookup-for-nonexisted-user
# Description: Test for Cron does uid lookups for non-existent users
# 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/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="cronie"
declare -ri EXIT_FAILURE=1;
declare -ri EXIT_SUCCESS=0;
declare -r reportAllErrors=no;
function isTrue() {
local string="$@";
local oldOpt="shopt -p nocasematch";
local -i rc=1;
shopt -s nocasematch;
[[ -z "$string" ]] && return 1;
case $string in
yes) rc=0;;
true) rc=0;;
ano) rc=0;;
1) rc=0;;
jo) rc=0;;
yeah) rc=0;;
y) rc=0;;
a) rc=0;;
esac;
eval $oldOpt;
return $rc;
}
## Is nice to know when things going wrong
function errorHandler() {
local code="${?}";
local lineNO="$1";
case $code in
127)
rlFail "Command not found on line $lineNO"
;;
*)
isTrue $reportAllErrors && rlFail "Unhandled error $code near line $lineNO";
;;
esac
}
rlJournalStart
trap 'errorHandler ${LINENO}' ERR;
rlPhaseStart FAIL "Setup"
rlAssertRpm $PACKAGE;
rlRun "rlServiceStop 'crond'"
echo > /var/log/cron
rlRun "rlServiceStart 'crond'"
rlPhaseEnd
rlPhaseStartTest
rlRun "sleep 61 | crontab -" &
sleep 5
fileName="$(ls /var/spool/cron/ | grep 'tmp' | head -n 1)";
ls -lah /var/spool/cron/;
rlRun "[[ -n '$fileName' ]]" 0 "$fileName found";
rlRun "wait";
rlRun "grep 'ORPHAN' /var/log/cron | grep '$fileName'" 1 ;
tail -n 20 /var/log/cron;
rlPhaseEnd
rlPhaseStart WARN "Cleanup"
rlRun "rlServiceRestore 'crond'"
#avoid systemd failing to start crond due start-limit
sleep 10
rlPhaseEnd
rlJournalPrintText
trap - ERR;
rlJournalEnd

View file

@ -0,0 +1,63 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/cronie/Regression/crontab-has-wrong-permissions
# Description: What the test does
# 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/crontab-has-wrong-permissions
export TESTVERSION=1.1
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.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: What the test does" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(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

@ -0,0 +1,3 @@
PURPOSE of /CoreOS/cronie/Regression/crontab-has-wrong-permissions
Description: What the test does
Author: Jakub Prokes <jprokes@redhat.com>

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

View file

@ -0,0 +1,55 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/cronie/Regression/crontab-has-wrong-permissions
# Description: What the test does
# 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/share/beakerlib/beakerlib.sh || exit 1
PACKAGES="cronie vixie-cron"
function myAssertRpms() {
rlRun "rpm -q $*" $((${#@}-1)) "One of required packages was found";
}
rlJournalStart
rlPhaseStartSetup
myAssertRpms $PACKAGES
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlPhaseEnd
rlPhaseStartTest
rlRun "[[ $(stat /usr/bin/crontab -c \"%a\") -eq 4755 ]]"
rlPhaseEnd
rlPhaseStartCleanup
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,63 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/cronie/Regression/echos-OK-twice-in-init-script
# Description: Test for echos "OK" twice in init script
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2011 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/echos-OK-twice-in-init-script
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Martin Cermak <mcermak@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test for echos \"OK\" twice in init script" >> $(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

@ -0,0 +1,4 @@
PURPOSE of /CoreOS/cronie/Regression/echos-OK-twice-in-init-script
Description: Test for echos "OK" twice in init script
Author: Martin Cermak <mcermak@redhat.com>

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

View file

@ -0,0 +1,71 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/cronie/Regression/echos-OK-twice-in-init-script
# Description: Test for echos "OK" twice in init script
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2011 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 rhts environment
. /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
rlServiceStop crond
rlRun "tmpDir=\$(mktemp -d)" 0 "Creating tmp directory";
testUser="$(makeUser)";
rlPhaseEnd
rlPhaseStartTest
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
rm -f $rlRun_LOG
rm -rf $tmpDir;
userdel -rf $testUser;
rlServiceRestore crond
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,63 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/cronie/Regression/init-script-failure
# Description: Testing some init script failures
# 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/init-script-failure
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.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 some init script failures" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(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

@ -0,0 +1,3 @@
PURPOSE of /CoreOS/cronie/Regression/init-script-failure
Description: Testing some init script failures
Author: Jakub Prokes <jprokes@redhat.com>

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

View file

@ -0,0 +1,72 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/cronie/Regression/init-script-failure
# Description: Testing some init script failures
# 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/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
rlServiceStop crond
rlRun "tmpDir=\$(mktemp -d)" 0 "Creating tmp directory";
testUser="$(makeUser)";
rlPhaseEnd
rlPhaseStartTest "Service restart needlessly reports failure"
rlRun -s "service crond restart"
rlAssertNotGrep "FAILED" $rlRun_LOG
rlPhaseEnd
if ! rpm -q systemd &>/dev/null; then
rlPhaseStartTest "Check service restart exit code"
su -l $testUser -c "service crond restart";
rlAssertEquals "Expected result of call initscript by unprivileged user is 4" $? 4
rlPhaseEnd
fi
rlPhaseStartCleanup
rm -f $rlRun_LOG
rm -rf $tmpDir;
userdel -rf $testUser;
rlServiceRestore crond
#avoid systemd failing to start crond due start-limit
sleep 10
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,62 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/cronie/Sanity/init-script-LSB
# Description: Init script should meet LSB specifications
# Author: Yulia Kopkova <ykopkova@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2009 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/Sanity/init-script-LSB
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.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: Petr Sklenar <psklenar@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Init script should meet LSB specifications" >> $(METADATA)
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 5m" >> $(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

@ -0,0 +1,3 @@
PURPOSE of /CoreOS/cronie/Sanity/init-script-LSB
Description: Init script should meet LSB specifications
Author: Yulia Kopkova <ykopkova@redhat.com>

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

185
tests/init-scripts-LSB/runtest.sh Executable file
View file

@ -0,0 +1,185 @@
#!/bin/bash
# vim: dict=/usr/share/rhts-library/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/cronie/Sanity/init-script-LSB
# Description: Init script should meet LSB specifications
# Author: Jan Scotka <jscotka@redhat.com>, Yulia Kopkova <ykopkova@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2009 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 rhts environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="cronie"
SERVICE="crond";
reportAllErrors=no;
function isTrue() {
local string="$@";
local oldOpt="shopt -p nocasematch";
local -i rc=1;
shopt -s nocasematch;
[[ -z "$string" ]] && return 1;
case $string in
yes) rc=0;;
true) rc=0;;
ano) rc=0;;
1) rc=0;;
jo) rc=0;;
yeah) rc=0;;
y) rc=0;;
a) rc=0;;
esac;
eval $oldOpt;
return $rc;
}
isTrue no && echo Yes || echo No;
## Is nice to know when things going wrong
function errorHandler() {
local code="${?}";
local lineNO="$1";
case $code in
127)
rlFail "Command not found on line $lineNO"
;;
*)
isTrue $reportAllErrors && rlFail "Unhandled error $code near line $lineNO";
;;
esac
}
function getUserName() {
local userName="qa_$(tr -dc "[:lower:]" < /dev/urandom | head -c 5)";
echo "$userName" >&2;
if getent passwd $userName &>/dev/null; then
getUserName;
return $?
fi
if [[ -n "$userName" ]]; then
echo "$userName";
return $EXIT_SUCCESS;
else
return $EXIT_FAILURE;
fi
}
rlJournalStart
trap 'errorHandler ${LINENO}' ERR;
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "tmpDir=\$(mktemp -d)" 0 "Creating tmp directory";
testUser="$(getUserName || rlDie "Cannot get username")"
rlLog "${testUser}"
rlRun "useradd -d $tmpDir $testUser";
pushd $tmpDir;
rlServiceStop $SERVICE
rlPhaseEnd
rlPhaseStartTest "starts the service"
rlRun "service $SERVICE start" 0 " Service must start without problem"
rlRun "service $SERVICE status" 0 " Then Status command "
rlRun "service $SERVICE start" 0 " Already started service "
rlRun "service $SERVICE status" 0 " Again status command "
rlPhaseEnd
rlPhaseStartTest "restart the service"
firstPid=$(ps h -C $SERVICE -o pid);
rlRun "service $SERVICE restart" 0 " Restarting of service"
rlRun "service $SERVICE status" 0 " Status command "
secondPid=$(ps h -C $SERVICE -o pid);
rlRun "[[ -n $firstPid ]] && [[ -n $secondPid ]] && [[ $firstPid -ne $secondPid ]]" 0 \
"Pids are different after restart";
rlPhaseEnd
rlPhaseStartTest "stop the service"
rlRun "service $SERVICE stop" 0 " Stopping service "
rlRun "service $SERVICE status" 3 " Status of stopped service " || true
rlRun "service $SERVICE stop" 0 " Stopping service again "
rlRun "service $SERVICE status" 3 " Status of stopped service " || true
rlPhaseEnd
if ! rlIsRHEL ">=7"; then
rlPhaseStartTest "pid file"
rlServiceStart $SERVICE
rlAssertExists "/var/run/$SERVICE.pid" "Pid file /var/run/$SERVICE.pid must exist"
sleep 1
rlRun "kill -9 `pidof crond`" 0 "Kill $SERVICE"
sleep 10
rlRun "service $SERVICE status" 1 " Existing pid file, but service not started " || true;
sleep 1
rlRun "rm -fv /var/run/$SERVICE.pid" 0 "Remove .pid file"
rlPhaseEnd
rlPhaseStartTest "lock file"
rlAssertExists "/var/lock/subsys/$SERVICE" "Lock file /var/lock/subsys/$SERVICE must exist"
rlRun "service $SERVICE status" 2 " Existing lock file, but service not started " || true;
rlServiceStop $SERVICE
rlPhaseEnd
fi
rlPhaseStartTest "insufficient rights"
rlRun "service $SERVICE start " 0 " Starting service for restarting under nonpriv user "
rlRun "su $testUser -c 'service $SERVICE restart'" \
$(rpm -q systemd &>/dev/null && echo 1 || echo 4) \
"Insufficient rights, restarting service under nonprivileged user must fail";
rlPhaseEnd
rlPhaseStartTest "operations"
rlRun "service $SERVICE start" 0 " Service have to implement start function "
rlRun "service $SERVICE restart" 0 " Service have to implement restart function "
rlRun "service $SERVICE status" 0 " Service have to implement status function "
rlRun "service $SERVICE reload" 0 " Service have to implement reload function "
rlRun "service $SERVICE force-reload" 0 " Service have to implement force-reload function "
rlRun "service $SERVICE condrestart" 0 " Service have to implement condrestart function "
if ! rlIsRHEL ">=7"; then
rlRun "service $SERVICE try-restart" 0 " Service have to implement try-restart function "
fi
rlPhaseEnd
rlPhaseStartTest "nonexisting operations"
rlRun "service $SERVICE noexistop" 2 " Testing proper return code when nonexisting function";
rlRun "service $SERVICE stopex" 2 " Testing proper return code when nonexisting function";
rlRun "service $SERVICE foo" 2 " Testing proper return code when nonexisting function" || true
rlPhaseEnd
rlPhaseEnd
rlPhaseStartCleanup
rlServiceRestore $SERVICE
rlRun "getent passwd $testUser";
popd tmpDir;
rlRun "userdel -fr $testUser" 0 "Remove test user";
# rlRun "rm -rf $testDir";
#avoid systemd failing to start crond due start-limit
sleep 10
rlPhaseEnd
rlJournalPrintText
trap - ERR;
rlJournalEnd

View file

@ -0,0 +1,63 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/cronie/Regression/only-one-running-instance-in-time
# Description: 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.
# 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/only-one-running-instance-in-time
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.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: 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." >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 5m" >> $(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

@ -0,0 +1,3 @@
PURPOSE of /CoreOS/cronie/Regression/only-one-running-instance-in-time
Description: 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.
Author: Jakub Prokes <jprokes@redhat.com>

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

View file

@ -0,0 +1,51 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/cronie/Regression/only-one-running-instance-in-time
# Description: 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.
# 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/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="cronie"
rlJournalStart
rlPhaseStartSetup
rlServiceStart crond
rlPhaseEnd
rlPhaseStartTest
rlRun "kill -0 $(cat /var/run/crond.pid)" 0 "Service crond is running";
rlRun "/usr/sbin/crond" 1 "Executing another instance fail";
rlAssertEquals "There is stil one instance of crond" $(ps h -C crond -o pid | wc -l) 1;
rlPhaseEnd
rlPhaseStartCleanup
rlServiceRestore crond
#avoid systemd failing to start crond due start-limit
sleep 10
rlPhaseEnd
rlJournalPrintText
rlJournalEnd

View file

@ -0,0 +1,62 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/cronie/Regression/run-with-syslog-flag
# Description: Test for cronie has a bug when run with syslog flag
# 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/run-with-syslog-flag
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.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 has a bug when run with syslog flag" >> $(METADATA)
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 10m" >> $(METADATA)
@echo "RunFor: cronie" >> $(METADATA)
@echo "Requires: cronie rsyslog" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2+" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
@echo "Destructive: no" >> $(METADATA)
rhts-lint $(METADATA)

View file

@ -0,0 +1,4 @@
PURPOSE of /CoreOS/cronie/Regression/run-with-syslog-flag
Description: Test for cronie has a bug when run with syslog flag
Author: Jakub Prokes <jprokes@redhat.com>
Bug summary: cronie has a bug when run with syslog flag

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

View file

@ -0,0 +1,80 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/cronie/Regression/run-with-syslog-flag
# Description: Test for cronie has a bug when run with syslog flag
# 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/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="cronie"
declare -r sysConfig="/etc/sysconfig/crond";
declare -r cronJobFile=/etc/cron.d/testjob
rlJournalStart
rlPhaseStart FAIL "Setup"
## nasty hack for journalctl
export PAGER=""
rlAssertRpm $PACKAGE
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlServiceStart rsyslog
rlPhaseEnd
rlPhaseStartTest
rlFileBackup ${sysConfig};
crondOpts="$(sed -n '/^\s*CRONDARGS/s/^\s*CRONDARGS\s*=//p' ${sysConfig})";
rlLog "Old CRONDARGS=\"${crondOpts}\"";
if echo "$crondOpts" | grep '"'; then
## strip trailing quotes
crondOpts="$(echo "$crondOpts" | sed 's/\(^"\)\|\("$\)//g')";
fi
crondOpts="$crondOpts -s -m off";
rlLog "New CRONDARGS=\"${crondOpts}\"";
echo "CRONDARGS=\"${crondOpts}\"" > ${sysConfig};
phrase="$(tr -dc 'a-zA-Z0-9' < /dev/urandom | head -c 32)";
echo "* * * * * root /bin/echo $phrase" > ${cronJobFile};
cp /var/log/cron ./oldLog;
[[ -f ./oldLog ]] || touch ./oldLog;
rlServiceStop crond;
sleep 1
rlServiceStart crond;
sleep 65;
rlRun "diff ./oldLog /var/log/cron |grep -v '/bin/echo' \
| grep '$phrase'" 0 "Output is logged correctly." \
|| rlLog "$(tail -n 5 /var/log/cron)"
rlPhaseEnd
rlPhaseStart WARN "Cleanup"
rlRun "rm ${cronJobFile}";
rlFileRestore;
rlRun "rlServiceRestore crond";
rlServiceRestore rsyslog
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,63 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Makefile of /CoreOS/cronie/Regression/usr-bin-crontab-has-wrong-permissions
# Description: Test for /usr/bin/crontab has wrong permissions
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2011 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/usr-bin-crontab-has-wrong-permissions
export TESTVERSION=1.0
BUILT_FILES=
FILES=$(METADATA) runtest.sh Makefile PURPOSE
.PHONY: all install download clean
run: $(FILES) build
./runtest.sh
build: $(BUILT_FILES)
chmod a+x runtest.sh
clean:
rm -f *~ $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@echo "Owner: Martin Cermak <mcermak@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "Description: Test for /usr/bin/crontab has wrong permissions" >> $(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

@ -0,0 +1,5 @@
PURPOSE of /CoreOS/cronie/Regression/usr-bin-crontab-has-wrong-permissions
Description: Test for /usr/bin/crontab has wrong permissions
Author: Martin Cermak <mcermak@redhat.com>
Bug summary: /usr/bin/crontab has wrong permissions

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

View file

@ -0,0 +1,43 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/cronie/Regression/usr-bin-crontab-has-wrong-permissions
# Description: Test for /usr/bin/crontab has wrong permissions
# Author: Martin Cermak <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2011 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 rhts environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="cronie"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlPhaseEnd
rlPhaseStartTest
rlRun "test `stat -c %a /usr/bin/crontab` -eq 4755"
rlPhaseEnd
rlJournalEnd
rlJournalPrintText

View file

@ -1,11 +0,0 @@
diff -up cronie-1.4.11/contrib/cronie.systemd.old2 cronie-1.4.11/contrib/cronie.systemd
--- cronie-1.4.11/contrib/cronie.systemd.old2 2013-07-18 14:27:08.000000000 +0200
+++ cronie-1.4.11/contrib/cronie.systemd 2013-09-25 12:36:10.129374891 +0200
@@ -5,6 +5,7 @@ After=syslog.target auditd.service syste
[Service]
EnvironmentFile=/etc/sysconfig/crond
ExecStart=/usr/sbin/crond -n $CRONDARGS
+KillMode=process
[Install]
WantedBy=multi-user.target