Some jobs are not executed because not all environment variables are set. rhbz#995590
This commit is contained in:
parent
64608df465
commit
bce1943a1d
56
correct-env.patch
Normal file
56
correct-env.patch
Normal 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(),
|
@ -6,7 +6,8 @@
|
|||||||
Summary: Cron daemon for executing programs at set times
|
Summary: Cron daemon for executing programs at set times
|
||||||
Name: cronie
|
Name: cronie
|
||||||
Version: 1.4.11
|
Version: 1.4.11
|
||||||
Release: 3%{?dist}
|
Release: 4%{?dist}
|
||||||
|
Patch0: correct-env.patch
|
||||||
License: MIT and BSD and ISC and GPLv2+
|
License: MIT and BSD and ISC and GPLv2+
|
||||||
Group: System Environment/Base
|
Group: System Environment/Base
|
||||||
URL: https://fedorahosted.org/cronie
|
URL: https://fedorahosted.org/cronie
|
||||||
@ -75,6 +76,7 @@ extra features.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
|
%patch0 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%configure \
|
%configure \
|
||||||
@ -199,6 +201,9 @@ exit 0
|
|||||||
%attr(0644,root,root) %{_sysconfdir}/cron.d/dailyjobs
|
%attr(0644,root,root) %{_sysconfdir}/cron.d/dailyjobs
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* 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
|
||||||
|
|
||||||
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.11-3
|
* 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
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user