Compare commits

...
Sign in to create a new pull request.

4 commits

Author SHA1 Message Date
Marcela Mašláňová
4c297f8921 Forgot to add BR on systemd, which leads to failure of scriptlets. 2013-09-26 17:33:31 +02:00
Marcela Mašláňová
475bdd0ba4 Fix missing information in spec. 2013-09-25 13:54:37 +02:00
Marcela Mašláňová
39c3c38fa8 Cronies systemd script use KillMode=process. rhbz#919290 2013-09-25 13:52:58 +02:00
Marcela Mašláňová
76452d39b8 Some jobs are not executed because not all environment variables are set. rhbz#995590 2013-09-25 13:51:35 +02:00
3 changed files with 80 additions and 1 deletions

56
correct-env.patch Normal file
View file

@ -0,0 +1,56 @@
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

@ -6,7 +6,7 @@
Summary: Cron daemon for executing programs at set times
Name: cronie
Version: 1.4.10
Release: 5%{?dist}
Release: 7%{?dist}
License: MIT and BSD and ISC and GPLv2
Group: System Environment/Base
URL: https://fedorahosted.org/cronie
@ -14,6 +14,8 @@ Source0: https://fedorahosted.org/releases/c/r/cronie/%{name}-%{version}.tar.g
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
Requires: dailyjobs
@ -28,6 +30,7 @@ Buildrequires: pam-devel >= 1.0.1
%if %{with audit}
Buildrequires: audit-libs-devel >= 1.4.1
%endif
BuildRequires: systemd
Requires(post): coreutils sed
Requires(post): systemd
@ -88,6 +91,8 @@ is not used as the system init process.
%patch1 -p1 -b .setenv
%patch2 -p1 -b .copy-env
%patch3 -p1 -b .random-delay
%patch4 -p1 -b .env
%patch5 -p1
%build
%configure \
@ -221,6 +226,13 @@ exit 0
%attr(0755,root,root) %{_initrddir}/crond
%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)

View file

@ -0,0 +1,11 @@
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