Compare commits

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

10 commits

Author SHA1 Message Date
Fedora Release Engineering
f9fa5bf238 dist-git conversion 2010-07-29 15:05:53 +00:00
Bill Nottingham
fb2c9b1119 Fix typo that causes a failure to update the common directory. (releng
#2781)
2009-11-26 01:14:48 +00:00
Marcela Mašláňová
0ee40f9491 - fix init script
- syntactic check of RH_CROND_DIR
2008-10-30 11:34:39 +00:00
Marcela Mašláňová
e3148b815c Forgot change the permission on /etc/cron.d. 2008-02-12 13:09:15 +00:00
Marcela Mašláňová
ff82406fcd - 426704 using get_default_context() instead of getseuserbyname 2008-01-30 15:27:28 +00:00
Marcela Mašláňová
ba574ce34a Delete old macro, which made incorrect time format of non sendmails mails,
add pam credentials back.
2007-11-30 16:04:51 +00:00
Marcela Mašláňová
71fc3523cd Forgot change the spec. 2007-11-12 09:00:02 +00:00
Marcela Mašláňová
bd62ce5d5d 374191 mail wasn't send, when the sendmail wasn't used. 2007-11-12 08:57:01 +00:00
Marcela Mašláňová
df2dbd2db3 Some cron jobs failed without error message. If the job had too "big"
output and no mail client set, then only a part from job was done. The
    reason was pipe, which has restricted size. rh bugzilla #247228
2007-10-29 15:24:17 +00:00
Jesse Keating
a8e250c036 Initialize branch F-8 for vixie-cron 2007-10-20 18:48:16 +00:00
10 changed files with 277 additions and 24 deletions

View file

View file

@ -1,21 +0,0 @@
# Makefile for source rpm: vixie-cron
# $Id: Makefile,v 1.1 2004/09/09 13:58:29 cvsdist Exp $
NAME := vixie-cron
SPECFILE = $(firstword $(wildcard *.spec))
define find-makefile-common
for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done
endef
MAKEFILE_COMMON := $(shell $(find-makefile-common))
ifeq ($(MAKEFILE_COMMON),)
# attempt a checkout
define checkout-makefile-common
test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
endef
MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
endif
include $(MAKEFILE_COMMON)

12
configure.patch Normal file
View file

@ -0,0 +1,12 @@
diff -up vixie-cron-4.2/configure.ac.old vixie-cron-4.2/configure.ac
--- vixie-cron-4.2/configure.ac.old 2007-11-30 16:54:32.000000000 +0100
+++ vixie-cron-4.2/configure.ac 2007-11-30 16:56:09.000000000 +0100
@@ -203,8 +203,6 @@ AC_DEFINE(MAILFMT,"%s -FCronDaemon -i -o
-t = Get recipient from headers
-d = undocumented but common flag.])
-AC_DEFINE(MAIL_DATE,0,[Date is set by sendmail.])
-
AC_DEFINE(SYSLOG,1,[Using syslog for log messages.])
AC_DEFINE(CAPITALIZE_FOR_PS,0,[if you have a tm_gmtoff member in struct tm])

40
cred.patch Normal file
View file

@ -0,0 +1,40 @@
diff --git a/src/security.c b/src/security.c
index 200dac4..030d203 100644
--- a/src/security.c
+++ b/src/security.c
@@ -89,14 +89,15 @@ int cron_set_job_security_context(entry *e, user *u, char ***jobenv) {
if (ucontext)
freecon(ucontext);
#endif
-
-/* if (cron_open_pam_session(e->pwd) != 0) {
+#ifdef WITH_PAM
+ if (cron_open_pam_session(e->pwd) != 0) {
syslog(LOG_INFO, "CRON (%s) ERROR: failed to open PAM security session: %s", e->pwd->pw_name, strerror(errno));
return -1;
}
-*/
+#endif
+
if (cron_change_user(e->pwd, env_get("HOME", *jobenv)) != 0) {
- syslog(LOG_INFO, "CRON (%s) ERROR: failed to open PAM security session: %s", e->pwd->pw_name, strerror(errno));
+ syslog(LOG_INFO, "CRON (%s) ERROR: failed to open change cron user: %s", e->pwd->pw_name, strerror(errno));
return -1;
}
@@ -136,7 +137,6 @@ int cron_start_pam(struct passwd *pw) {
return retcode;
}
-#if 0
int cron_open_pam_session(struct passwd *pw) {
int retcode = 0;
@@ -151,7 +151,6 @@ int cron_open_pam_session(struct passwd *pw) {
return retcode;
}
-#endif
void cron_close_pam(void) {
#if defined(WITH_PAM)

42
initscript.patch Normal file
View file

@ -0,0 +1,42 @@
diff -up vixie-cron-4.2/vixie-cron.init.old vixie-cron-4.2/vixie-cron.init
--- vixie-cron-4.2/vixie-cron.init.old 2007-08-28 12:52:23.000000000 +0200
+++ vixie-cron-4.2/vixie-cron.init 2008-10-30 12:11:20.000000000 +0100
@@ -11,6 +11,10 @@
# config: /etc/crontab
# pidfile: /var/run/crond.pid
+[ -f /etc/sysconfig/crond ] || {
+ [ "$1" = "status" ] && exit 4 || exit 6
+}
+
RETVAL=0
prog="crond"
CROND=/usr/sbin/crond
@@ -28,14 +32,13 @@ LOCK_FILE=/var/lock/subsys/crond
t=${CRON_VALIDATE_MAILRCPTS:-UNSET}
[ "$t" != "UNSET" ] && export CRON_VALIDATE_MAILRCPTS="$t"
-prog="crond"
-
start() {
echo -n $"Starting $prog: "
daemon $prog $CRONDARGS && success || failure
RETVAL=$?
- [ "$RETVAL" = 0 ] && touch $LOCK_FILE
echo
+ [ "$RETVAL" = 0 ] && touch $LOCK_FILE
+ return $RETVAL
}
stop() {
@@ -47,8 +50,9 @@ stop() {
failure $"Stopping $prog"
fi
RETVAL=$?
- [ "$RETVAL" = 0 ] && rm -f $LOCK_FILE
echo
+ [ "$RETVAL" = 0 ] && rm -f $LOCK_FILE
+ return $RETVAL
}
reload() {

33
mailfail.patch Normal file
View file

@ -0,0 +1,33 @@
diff -up vixie-cron-4.2/src/popen.c.old vixie-cron-4.2/src/popen.c
--- vixie-cron-4.2/src/popen.c.old 2007-08-28 09:29:05.000000000 +0200
+++ vixie-cron-4.2/src/popen.c 2007-10-29 14:28:28.000000000 +0100
@@ -61,7 +61,9 @@ cron_popen(char *program, const char *ty
int argc, pdes[2];
PID_T pid;
char *argv[MAX_ARGS];
-
+ ssize_t out;
+ char buf[PIPE_BUF];
+
#ifdef __GNUC__
(void) &iop; /* Avoid fork clobbering */
#endif
@@ -106,8 +108,16 @@ cron_popen(char *program, const char *ty
}
(void)close(pdes[1]);
}
- if (execvp(argv[0], argv) < 0)
- log_it("CRON", getpid(), "Mail wan't set up, some jobs could failed", strerror(errno));
+
+ if (execvp(argv[0], argv) < 0) {
+ syslog(LOG_ERR, "CRON: Exec of (%s) failed: (%s)", program, strerror(errno));
+ if (*type != 'r') {
+ while (0 != (out = read(STDIN, buf, PIPE_BUF))) {
+ if ((out == -1) && (errno != EINTR))
+ break;
+ }
+ }
+ }
_exit(1);
}
/* parent; assume fdopen can't fail... */

12
mailpath.patch Normal file
View file

@ -0,0 +1,12 @@
diff -up vixie-cron-4.2/configure.ac.old vixie-cron-4.2/configure.ac
--- vixie-cron-4.2/configure.ac.old 2007-08-28 09:29:05.000000000 +0200
+++ vixie-cron-4.2/configure.ac 2007-11-12 09:17:25.000000000 +0100
@@ -192,7 +192,7 @@ AC_ARG_WITH(pam,
AC_DEFINE(DEBUGGING,1,[Code will be built with debug info.])
-AC_DEFINE(MAILARG,"/usr/lib/sendmail",[There will be path to sendmail.])
+AC_DEFINE(MAILARG,"/usr/sbin/sendmail",[There will be path to sendmail.])
AC_DEFINE(MAILFMT,"%s -FCronDaemon -i -odi -oem -oi -t",
[-i = don't terminate on "." by itself

59
selinux.perm.patch Normal file
View file

@ -0,0 +1,59 @@
diff -up vixie-cron-4.2/src/user.c.selinux vixie-cron-4.2/src/user.c
--- vixie-cron-4.2/src/user.c.selinux 2007-08-28 09:29:05.000000000 +0200
+++ vixie-cron-4.2/src/user.c 2008-01-30 14:39:57.000000000 +0100
@@ -84,7 +84,7 @@ load_user(int crontab_fd, struct passwd
return (NULL);
}
- if (get_security_context(pw == NULL ? "system_u" : uname,
+ if (get_security_context(pw == NULL ? NULL : uname,
crontab_fd,
&u->scontext, tabname) != 0) {
free_user(u);
diff -up vixie-cron-4.2/src/security.c.selinux vixie-cron-4.2/src/security.c
--- vixie-cron-4.2/src/security.c.selinux 2008-01-30 14:39:57.000000000 +0100
+++ vixie-cron-4.2/src/security.c 2008-01-30 14:43:24.000000000 +0100
@@ -459,24 +459,26 @@ int get_security_context( const char *na
if (is_selinux_enabled() <= 0)
return 0;
- if (getseuserbyname(name, &seuser, &level) == 0) {
- retval=get_default_context_with_level(seuser, level, NULL, &scontext);
- free(seuser);
- free(level);
- if (retval) {
- if (security_getenforce() > 0) {
- log_it(name, getpid(), "No SELinux security context",tabname);
- return -1;
- } else {
- log_it(name, getpid(), "No security context but SELinux in permissive mode, continuing",tabname);
- return 0;
- }
- }
- } else {
- log_it(name, getpid(), "getseusername FAILED", name);
- return (security_getenforce() > 0);
+ if (name != NULL) {
+ if (getseuserbyname(name, &seuser, &level) < 0) {
+ log_it(name, getpid(), "getseuserbyname FAILED", name);
+ return (security_getenforce() > 0);
+ }
}
-
+
+ retval=get_default_context_with_level(name == NULL ? "system_u" : seuser, level, NULL, &scontext);
+ free(seuser);
+ free(level);
+ if (retval) {
+ if (security_getenforce() > 0) {
+ log_it(name, getpid(), "No SELinux security context",tabname);
+ return -1;
+ } else {
+ log_it(name, getpid(), "No security context but SELinux in permissive mode, continuing",tabname);
+ return 0;
+ }
+ }
+
if (fgetfilecon(crontab_fd, &file_context) < OK) {
if (security_getenforce() > 0) {
log_it(name, getpid(), "getfilecon FAILED", tabname);

41
syntactic_check.patch Normal file
View file

@ -0,0 +1,41 @@
From 0f6da41030819421a6744a4c800e14b5f7e8ee74 Mon Sep 17 00:00:00 2001
From: Marcela Maslanova <marca@dhcp-lab-135.englab.brq.redhat.com>
Date: Tue, 2 Oct 2007 12:41:51 +0200
Subject: [PATCH] The jobs in RH_CROND_DIR weren't syntactically checked.
Also SYSCRON wasn't checked. The problem is reported into log.
---
src/user.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/src/user.c b/src/user.c
index 2105850..16121ba 100644
--- a/src/user.c
+++ b/src/user.c
@@ -28,6 +28,13 @@ static char rcsid[] = "$Id: user.c,v 1.5 2004/01/23 18:56:43 vixie Exp $";
#include "cron.h"
+static const char *FileName;
+
+static void
+log_error(const char *msg) {
+ syslog(LOG_ERR,"CRON: error in (%s) problem is (%s)",FileName,msg);
+}
+
void
free_user(user *u) {
entry *e, *ne;
@@ -101,7 +108,8 @@ load_user(int crontab_fd, struct passwd *pw, const char *uname, const char *fnam
u = NULL;
goto done;
case FALSE:
- e = load_entry(file, NULL, pw, envp);
+ FileName = tabname;
+ e = load_entry(file, log_error, pw, envp);
if (e) {
e->next = u->crontab;
u->crontab = e;
--
1.6.0.3

View file

@ -10,11 +10,19 @@
Summary: The Vixie cron daemon for executing specified programs at set times
Name: vixie-cron
Version: 4.2
Release: 3%{?dist}
Release: 9%{?dist}
Epoch: 4
License: BSD
Group: System Environment/Base
Source0: https://hosted.fedoraproject.org/projects/vixie-cron/wiki/%{name}-%{version}.tar.gz
Patch0: mailfail.patch
Patch1: mailpath.patch
Patch2: cred.patch
Patch3: configure.patch
Patch4: selinux.perm.patch
Patch5: syntactic_check.patch
Patch6: initscript.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: syslog, bash >= 2.0
Buildrequires: automake, autoconf
@ -48,6 +56,13 @@ selinux for higher level of security.
%prep
%setup -q
%patch0 -p1 -b .mailfail
%patch1 -p1 -b .mailpath
%patch2 -p1 -b .cred
%patch3 -p1 -b .conf
%patch4 -p1 -b .selinux
%patch5 -p1 -b .syntax
%patch6 -p1
aclocal
autoheader
@ -96,7 +111,6 @@ rm -rf $RPM_BUILD_ROOT
%post
/sbin/chkconfig --add crond
#[ ! -f /etc/cron.allow ] && [ ! -f /etc/cron.deny ] && touch /etc/cron.deny ||:;
%preun
if [ $1 = 0 ]; then
@ -122,7 +136,7 @@ fi
%{_mandir}/man5/crontab.*
%{_mandir}/man1/crontab.*
%attr(700,root,root) %dir %{_localstatedir}/spool/cron
%attr(700,root,root) %dir %{_sysconfdir}/cron.d
%attr(755,root,root) %dir %{_sysconfdir}/cron.d
%attr(755,root,root) %{_sysconfdir}/rc.d/init.d/crond
%if %{WITH_PAM}
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/pam.d/crond
@ -132,6 +146,27 @@ fi
%doc %{_datadir}/doc/cron/*
%changelog
* Thu Oct 30 2008 Marcela Mašláňová <mmaslano@redhat.com> - 4:4.2-9
- fix init script
- syntactic check of RH_CROND_DIR
* Tue Feb 12 2008 Marcela Maslanova <mmaslano@redhat.com> - 4:4.2-8
- 426004 forgot change the permission on /etc/cron.d/
* Mon Jan 28 2008 Marcela Maslanova <mmaslano@redhat.com> - 4:4.2-7
- 426704 using get_default_context() instead of getseuserbyname
* Fri Nov 30 2007 Marcela Maslanova <mmaslano@redhat.com> - 4:4.2-6
- delete old macro, which made incorrect time format of non sendmails
mails, add pam credentials back
* Mon Nov 12 2007 Marcela Maslanova <mmaslano@redhat.com> - 4:4.2-5
- 374191: sendmail has incorrect path, if another MTA is used, no
mails are send.
* Mon Oct 27 2007 Marcela Maslanova <mmaslano@redhat.com> - 4:4.2-4
- 247228: cron jobs fail semi-randomly if sendmail incapacitated
* Mon Sep 24 2007 Marcela Maslanova <mmaslano@redhat.com> - 4:4.2-3
- cron own cron.deny
- correct license tag