Hello community, here is the log from the commit of package cronie.1322 for openSUSE:12.3:Update checked in at 2013-02-09 14:34:34 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:12.3:Update/cronie.1322 (Old) and /work/SRC/openSUSE:12.3:Update/.cronie.1322.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "cronie.1322", Maintainer is "" Changes: -------- New Changes file: --- /dev/null 2013-02-09 11:18:20.872010756 +0100 +++ /work/SRC/openSUSE:12.3:Update/.cronie.1322.new/cronie.changes 2013-02-09 14:34:39.000000000 +0100 @@ -0,0 +1,1072 @@ +------------------------------------------------------------------- +Thu Feb 7 12:19:58 UTC 2013 - meiss...@suse.com + +- fixed the file descriptor leak correctly (bnc#786096,bnc#802345) + +------------------------------------------------------------------- +Mon Feb 4 14:20:48 UTC 2013 - fcro...@suse.com + +- Regenerate cronie-pam_config.diff, last line of the patch was not + properly added, causing bnc#801553. + +------------------------------------------------------------------- +Mon Nov 12 13:44:06 UTC 2012 - vdziewie...@suse.com + +-Fix Bug 786096 - VUL-1: cron: does not close file descriptors before invocation of commands + +------------------------------------------------------------------- +Sun Oct 28 18:31:20 UTC 2012 - crrodrig...@opensuse.org + +- DO not require sysvinit(syslog), the journal is enough + +------------------------------------------------------------------- +Thu Oct 18 10:26:33 UTC 2012 - co...@suse.com + +- buildrequire systemd by pkgconfig provide to get systemd-mini + in build environments (to break cycle) + +------------------------------------------------------------------- +Wed Aug 15 00:48:54 UTC 2012 - crrodrig...@opensuse.org + +- When the cron daemon does not fork, as it is the case + when using systemd, pid files are useless. avoid creating + them in the first place. + +------------------------------------------------------------------- +Mon Jun 25 10:38:29 UTC 2012 - co...@suse.com + +- the recommends for postfix was from a time when smtp_daemon + was required, now that smtp_daemon is recommended, the recommend + for postfix is between useless and harmful - so reduce it to a suggests + +------------------------------------------------------------------- +Wed May 30 14:49:41 UTC 2012 - sweet_...@gmx.de + +- remove useless autmake dependency + +------------------------------------------------------------------- +Tue Apr 10 14:28:34 UTC 2012 - tabra...@novell.com + +- added cronie-1.4.8-bug_756197.diff to remove references to anacron + in crontab.5 + +------------------------------------------------------------------- +Wed Jan 18 15:15:14 UTC 2012 - tabra...@novell.com + +- removed cronie-1.4.7-syslog_output.patch deprecated by this update + +- Update to 1.4.8 + + Cron writes job output to syslog incorrectly. When cron is + invoked in a way to print job output to syslog, it does print + only the first character of the output + + Check orphanded crontabs for adoption + + Unify logging in case SyslogOutput with the rest of crond + + The charset of anacron's mail is always ANSI_X3.4-1968. There + are no setlocale in anacron's source + + Cronie disables inotify when the /etc/crontab file does not + exist at startup. Existance of crontab and directories wasn't + controlled before creating inotify watches. + +------------------------------------------------------------------- +Wed Nov 30 14:54:08 UTC 2011 - a...@suse.de + +- Add dependency on ypbind and nscd (bnc#732356) +- Do not install generic INSTALL file. +- Use set_permissions for newer distros. + +------------------------------------------------------------------- +Wed Nov 30 09:47:40 UTC 2011 - co...@suse.com + +- add automake as buildrequire to avoid implicit dependency + +------------------------------------------------------------------- +Tue Nov 29 17:07:07 UTC 2011 - crrodrig...@opensuse.org + +- Cron started before network is up [bnc#733275] + +------------------------------------------------------------------- +Fri Oct 7 12:11:17 UTC 2011 - fcro...@suse.com + +- Ensure service_add_post is called in %post and not verify. + +------------------------------------------------------------------- +Thu Sep 29 09:17:49 UTC 2011 - fcro...@suse.com + +- Use systemd macros to register cron.service. + +------------------------------------------------------------------- +Sun Sep 18 00:00:19 UTC 2011 - jeng...@medozas.de + +- Remove redundant tags/sections from specfile + +------------------------------------------------------------------- +Mon Jul 11 10:28:40 UTC 2011 - vci...@novell.com + +- changed run-parts to run-crons in anacron (bnc#689494) + +------------------------------------------------------------------- +Mon Jun 6 08:51:11 UTC 2011 - vci...@novell.com + +- mention possibility of disabling logging to syslog in the crontab + manual +- to keep compatibility with 11.3, execute the command despite + an unprivileged user tries to disable logging (bnc#698549) + +------------------------------------------------------------------- +Wed May 11 08:27:14 UTC 2011 - vci...@novell.com + +- corrected job output via syslog (bnc#692871) + +------------------------------------------------------------------- +Wed Apr 27 16:56:21 UTC 2011 - vci...@novell.com + +- update to 1.4.7 + many bugs fixed (including bnc#690166) + +------------------------------------------------------------------- +Thu Feb 24 12:33:31 UTC 2011 - vci...@novell.com + +- bnc#662433 again: + added quiet option to pam config, in order to avoid logging, + when /etc/cron.allow is missing + +------------------------------------------------------------------- +Thu Jan 6 15:25:44 UTC 2011 - vci...@novell.com + +- fix for bnc#662433 : + Accounts with disabled user login, but listed in /etc/cron.allow + were unable to run cron jobs + +------------------------------------------------------------------- +Fri Dec 10 12:46:12 UTC 2010 - a...@suse.de + +- cron.service needs to be after mta. + +------------------------------------------------------------------- +Tue Dec 7 21:16:31 UTC 2010 - co...@novell.com + +- prereq init script syslog + +------------------------------------------------------------------- +Tue Nov 9 15:38:33 UTC 2010 - cristian.rodrig...@opensuse.org + +- use full RELRO here. + +------------------------------------------------------------------- +Mon Nov 8 13:15:59 UTC 2010 - a...@suse.de + +- Fix rpm group of cronie-anacron + +------------------------------------------------------------------- +Mon Nov 8 12:52:17 UTC 2010 - a...@suse.de + +- Fix package list. + +------------------------------------------------------------------- +Sun Oct 31 12:37:02 UTC 2010 - jeng...@medozas.de + +- Use %_smp_mflags + +------------------------------------------------------------------- +Wed Oct 27 09:04:54 UTC 2010 - a...@suse.de + +- Add cron.service for systemd. + +------------------------------------------------------------------- +Wed Oct 27 08:31:19 UTC 2010 - mse...@gmail.com + +- Update to cronie 1.4.6 + * man/anacron.8, man/anacrontab.5, man/cron.8, man/crontab.1, + man/crontab.5: Rewrite of man pages & correction + * man/bitstring.3: Remove useless man page + * Check clustering before un/watch function + * Remove cluster support from inotify_database + * The crontab command uses "-c" and "-n" instead of "-h" + +------------------------------------------------------------------- +Mon Oct 25 11:08:38 UTC 2010 - co...@novell.com + +- use cronie_version not cron's version for anacron + +------------------------------------------------------------------- +Thu Oct 21 19:32:39 UTC 2010 - cristian.rodrig...@opensuse.org + +- Update to cronie 1.4.5_git201010210619 + * Fix broken ifdef HAS_FCHOWN + * Cronie supports "clustering" now. + ++++ 875 more lines (skipped) ++++ between /dev/null ++++ and /work/SRC/openSUSE:12.3:Update/.cronie.1322.new/cronie.changes New: ---- bug-786096_cronie-fdleak.diff cron.init cron.service cron.xml cron_to_cronie.README cronie-1.4.7-disable_logging.patch cronie-1.4.8-bug_756197.diff cronie-1.4.8.tar.gz cronie-anacron-1.4.7-run-crons.patch cronie-crond_pid.diff cronie-nheader_lines.diff cronie-nofork-nopid.patch cronie-pam_config.diff cronie-rpmlintrc cronie.changes cronie.spec deny.sample run-crons sample.root ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ cronie.spec ++++++ # # spec file for package cronie # # Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ # # 3 : we don't need to do something with /etc/sysconfig/cron for now %define cron_configs \{/etc/init.d/cron,/etc/pam.d/crond,/etc/crontab,/etc/cron.deny,/etc/omc/srvinfo.d/cron.xml\} Name: cronie BuildRequires: audit-devel BuildRequires: libselinux-devel BuildRequires: pam-devel BuildRequires: pkgconfig(systemd) Url: https://fedorahosted.org/cronie/ Recommends: smtp_daemon Suggests: postfix PreReq: permissions %fillup_prereq %insserv_prereq cron %{?systemd_requires} Version: 1.4.8 Release: 0 %{expand: %%define cronie_version %version} Summary: Cron Daemon License: BSD-3-Clause and GPL-2.0 and MIT Group: System/Daemons Source0: %name-%version.tar.gz Source1: cron.init Source2: run-crons Source3: sample.root Source4: deny.sample Source5: cron.xml Source6: cronie-rpmlintrc Source7: cron_to_cronie.README Source8: cron.service # PATCH-FEATURE-OPENSUSE cronie-pam_config.diff added pam config file from old cron Patch3: %name-pam_config.diff # openSUSE set NHEADER_LINES to 3 - old openSUSE cron put three lines of comments # in top of crontab file, so we want to hide this junk comments if user edit # crontab file with crontab -e command, patch grabbed from old openSUSE cron Patch4: %name-nheader_lines.diff # we use cron.pid instead of crond.pid Patch5: %name-crond_pid.diff # PATCH-FIX-UPSTREAM mention logging disabling for a command in man Patch7: cronie-1.4.7-disable_logging.patch # PATCH-FIX-UPSTREAM use run-crons instead of run-parts for anacron (bnc#689494) Patch8: cronie-anacron-1.4.7-run-crons.patch Patch9: cronie-1.4.8-bug_756197.diff Patch10: cronie-nofork-nopid.patch # PATCH-FIX-UPSTREAM bnc#786096 Patch11: bug-786096_cronie-fdleak.diff Conflicts: cron <= 4.1 # When finish update protection of sles11 we could uncomment line bellow and drop all # ugly hacks with subpackage cron needed for proper update proces # Obsoletes: cron <=4.x BuildRoot: %{_tmppath}/%{name}-%{version}-build %description cron automatically starts programs at specific times. Add new entries with "crontab -e". (See "man 5 crontab" and "man 1 crontab" for documentation.) Under /etc, find the directories cron.hourly, cron.daily, cron.weekly, and cron.monthly. Scripts and programs that are located there are started automatically. %package -n cron Version: 4.2 Release: 0 Summary: Auxiliary package Group: System/Daemons Requires: %{name} = %{cronie_version}-%{release} %description -n cron Auxiliary package, needed for proper update from vixie-cron 4.1 to cronie 1.4.4 %package anacron Summary: Utility for running regular jobs Group: System/Base Requires: %{name} = %{cronie_version} %description anacron Anacron becames part of cronie. Anacron is used only for running regular jobs. The default settings execute regular jobs by anacron, however this could be overloaded in settings. %prep %setup -q %patch3 -p1 %patch4 %patch5 -p1 %patch7 -p1 %patch8 -p1 %patch9 cp %{S:7} ./cron_to_cronie.README %patch10 %patch11 -p1 %build # fill macro CRON_VERSION it is used in top three lines of crontab file,should be reworked export CFLAGS="$RPM_OPT_FLAGS -DCRON_VERSION=\\\"%{version}\\\"" export LDFLAGS="-Wl,-z,relro,-z,now,-z,defs" %configure --with-audit --enable-anacron --with-pam --with-selinux --with-inotify --enable-pie SPOOL_DIR="/var/spool/cron/tabs" %{__make} %{?_smp_mflags} %install %makeinstall %{__mkdir_p} -v %{buildroot}%{_localstatedir}/spool/cron/{tabs,lastrun} %{__mkdir_p} -v %{buildroot}%{_sysconfdir}/cron.{d,hourly,daily,weekly,monthly} %{__install} -v -m 600 %{SOURCE3} %{buildroot}/etc/crontab %{__install} -v -m 600 %{SOURCE4} %{buildroot}/etc/cron.deny %{__install} -v -d %{buildroot}/usr/lib/cron %{__install} -v %{SOURCE2} %{buildroot}/usr/lib/cron %{__install} -v -d %{buildroot}%{_sysconfdir}/init.d/ %{__install} -v -m744 %{SOURCE1} %{buildroot}%{_sysconfdir}/init.d/cron %{__ln_s} -f ../../etc/init.d/cron %{buildroot}/usr/sbin/rccron %{__install} -v -d %{buildroot}/%{_unitdir} %{__install} -v -m 644 %{SOURCE8} %{buildroot}/%{_unitdir} %{__install} -m 644 contrib/anacrontab $RPM_BUILD_ROOT%{_sysconfdir}/anacrontab %{__install} -c -m755 contrib/0anacron $RPM_BUILD_ROOT%{_sysconfdir}/cron.hourly/0anacron %{__mkdir_p} $RPM_BUILD_ROOT/var/spool/anacron %{__mv} %{buildroot}%{_sbindir}/crond %{buildroot}%{_sbindir}/cron 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 # service xml %{__install} -v -d %{buildroot}%{_sysconfdir}/omc/srvinfo.d/ %{__install} -v -m644 %{S:5} %{buildroot}%{_sysconfdir}/omc/srvinfo.d/ %pre -n cron # check if we are doing "ugly" update from old 4.1 vixie-cron check_cron_mail_feature=`/usr/sbin/cron --help 2>&1 | /usr/bin/grep mail` # vixie-cron 4.1 doesn't contain mail fature if [ -e /usr/sbin/cron -a "${check_cron_mail_feature}" == "" ]; then # save configs for cronie post-install phase touch /var/run/update_from_old_cron echo $1 for conf in %{cron_configs} do %__mv "$conf" "$conf.bk" ||: done fi %pre if [ -e /var/run/update_from_old_cron ]; then # restore configs for conf in %{cron_configs} do %__mv "$conf.bk" "$conf" ||: done fi %service_add_pre cron.service %post # when we are doing rename then we pretend update with set 2 if [ -e /var/run/update_from_old_cron ]; then set 2 %restart_on_update cron # in %%postun restart_on_update call try-restart but we don't have init script in this phase when # we are doing "ugly" update, but don't panic, it produces only warning to stderr echo "Please ignore message about missing init script(from postun) - when occurs, we will install init script later with cronie package" %__mv /etc/init.d/cron /etc/init.d/cron.bk ||: %__ln_s /bin/true /etc/init.d/cron fi %{fillup_and_insserv -y cron} %if 0%{?suse_version} >= 1140 %set_permissions /etc/crontab /usr/bin/crontab %else %run_permissions %endif %service_add_post cron.service %verifyscript %verify_permissions -e /etc/crontab -e /usr/bin/crontab %preun %stop_on_removal cron %service_del_preun cron.service %postun %restart_on_update cron %insserv_cleanup %service_del_postun cron.service %posttrans if [ -e /var/run/update_from_old_cron ]; then %{__rm} /var/run/update_from_old_cron ||: %__mv /etc/init.d/cron.bk /etc/init.d/cron ||: fi %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 %files %defattr(-,root,root) %doc AUTHORS COPYING README ChangeLog %dir %attr(700,root,root) /var/spool/cron %dir %attr(700,root,root) /var/spool/cron/tabs %dir /var/spool/cron/lastrun %config /etc/init.d/cron %config /etc/pam.d/crond %verify(not mode) %config(noreplace) /etc/crontab %config(noreplace) /etc/cron.deny %{_mandir}/man1/crontab.1.gz %{_mandir}/man5/crontab.5.gz %{_mandir}/man8/cron.8.gz %{_mandir}/man8/crond.8.gz %verify(not mode) %attr (4750,root,trusted) /usr/bin/crontab %attr (755,root,root) %{_sbindir}/cron %{_sbindir}/rccron /usr/lib/cron %config %{_sysconfdir}/omc/srvinfo.d/cron.xml %dir %{_sysconfdir}/omc/srvinfo.d/ %dir %{_sysconfdir}/omc/ %{_unitdir}/cron.service %files anacron %defattr(-,root,root,-) %{_sbindir}/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 %{_mandir}/man5/anacrontab.* %{_mandir}/man8/anacron.* %files -n cron %defattr(-,root,root,-) %doc cron_to_cronie.README %changelog ++++++ bug-786096_cronie-fdleak.diff ++++++ diff --git a/src/cron.c b/src/cron.c index 7dc2958..69261c1 100644 --- a/src/cron.c +++ b/src/cron.c @@ -87,22 +87,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) { + 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) { ++++++ cron.init ++++++ #! /bin/sh # Copyright (c) 1995-2000 SuSE GmbH Nuernberg, Germany. # # Author: Werner Fink <wer...@suse.de>, 1996-2001 # # /etc/init.d/cron # # and symbolic its link # # /usr/sbin/rccron # # System startup script for the cron daemon # ### BEGIN INIT INFO # Provides: cron # Required-Start: $remote_fs $syslog $time # Should-Start: $network smtp # Required-Stop: $remote_fs $syslog # Should-Stop: $network smtp # Default-Start: 2 3 5 # Default-Stop: 0 1 6 # Short-Description: Cron job service # Description: Cron job service ### END INIT INFO CRON_BIN=/usr/sbin/cron test -x $CRON_BIN || exit 5 PIDFILE=/var/run/cron.pid # Shell functions sourced from /etc/rc.status: # rc_check check and set local and overall rc status # rc_status check and set local and overall rc status # rc_status -v ditto but be verbose in local rc status # rc_status -v -r ditto and clear the local rc status # rc_failed set local and overall rc status to failed # rc_failed <num> set local and overall rc status to <num><num> # rc_reset clear local rc status (overall remains) # rc_exit exit appropriate to overall rc status . /etc/rc.status # First reset status of this service rc_reset # Return values acc. to LSB for all commands but status: # 0 - success # 1 - generic or unspecified error # 2 - invalid or excess argument(s) # 3 - unimplemented feature (e.g. "reload") # 4 - insufficient privilege # 5 - program is not installed # 6 - program is not configured # 7 - program is not running # # Note that starting an already running service, stopping # or restarting a not-running service as well as the restart # with force-reload (in case signalling is not supported) are # considered a success. allow_deny_move_info() { echo "WARNING: /var/spool/cron/allow and /var/spool/cron/deny have moved" echo "to /etc/cron.allow and /etc/cron.deny." echo "Please merge or move these files to get cron access rules restored." } case "$1" in start) for al_de in {allow,deny}{,.rpmsave,.rpmorig} ; do if [ -f /var/spool/cron/$al_de ] ; then allow_deny_move_info break fi done echo -n "Starting CRON daemon" ## Start daemon with startproc(8). If this fails ## the echo return value is set appropriate. # NOTE: startproc return 0, even if service is # already running to match LSB spec. startproc -p $PIDFILE $CRON_BIN #startproc -f $CRON_BIN # Remember status and be verbose rc_status -v ;; stop) echo -n "Shutting down CRON daemon" ## Stop daemon with killproc(8) and if this fails ## set echo the echo return value. killproc -TERM -p $PIDFILE $CRON_BIN # Remember status and be verbose rc_status -v ;; try-restart) ## Stop the service and if this succeeds (i.e. the ## service was running before), start it again. ## Note: try-restart is not (yet) part of LSB (as of 0.7.5) $0 status >/dev/null && $0 restart # Remember status and be quiet rc_status ;; restart) ## Stop the service and regardless of whether it was ## running or not, start it again. $0 stop $0 start # Remember status and be quiet rc_status ;; force-reload) ## Signal the daemon to reload its config. Most daemons ## do this on signal 1 (SIGHUP). ## If it does not support it, restart. echo -n "Reload service Cron" ## if it supports it: ## cron monitors /etc/crontab anyway checkproc $CRON_BIN rc_status -v ## Otherwise: #$0 stop && $0 start #rc_status ;; reload) ## Like force-reload, but if daemon does not support ## signalling, do nothing (!) ## Otherwise if it does not support reload: rc_status -v ;; status) echo -n "Checking for Cron: " ## Check status with checkproc(8), if process is running ## checkproc will return with exit status 0. # Status has a slightly different for the status command: # 0 - service running # 1 - service dead, but /var/run/ pid file exists # 2 - service dead, but /var/lock/ lock file exists # 3 - service not running # NOTE: checkproc returns LSB compliant status values. checkproc $CRON_BIN rc_status -v ;; probe) ## Optional: Probe for the necessity of a reload, ## give out the argument which is required for a reload. ;; *) echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}" exit 1 ;; esac rc_exit ++++++ cron.service ++++++ [Unit] Description=Command Scheduler After=syslog.target mail-transfer-agent.target ypbind.service nscd.service network.target [Service] ExecStart=/usr/sbin/cron -n [Install] WantedBy=multi-user.target ++++++ cron_to_cronie.README ++++++ package cron 4.2 is only auxiliary package needed for proper renaming package cron to cronie usefull links : http://en.opensuse.org/Cron_replace http://en.opensuse.org/Cron_rename ++++++ cronie-1.4.7-disable_logging.patch ++++++ Index: cronie-1.4.7/man/crontab.5 =================================================================== --- cronie-1.4.7.orig/man/crontab.5 +++ cronie-1.4.7/man/crontab.5 @@ -203,6 +203,9 @@ fields. Use the first three letters of day or month (case does not matter). Ranges or lists of names are not allowed. .PP +If the uid of the owner is 0 (root), he can put a "-" as first character of a crontab entry. +This will prevent cron from writing a syslog message about this command getting executed. +.PP The "sixth" field (the rest of the line) specifies the command to be run. The entire command portion of the line, up to a newline or a "%" Index: cronie-1.4.7/src/entry.c =================================================================== --- cronie-1.4.7.orig/src/entry.c +++ cronie-1.4.7/src/entry.c @@ -105,13 +105,18 @@ entry *load_entry(FILE * file, void (*er if (ch == '-') { /* if we are editing system crontab or user uid is 0 (root) * we are allowed to disable logging + * Otherwise log the attempt, but still execute the command. */ if (pw == NULL || pw->pw_uid == 0) e->flags |= DONT_LOG; else { - log_it("CRON", getpid(), "ERROR", "Only privileged user can disable logging", 0); - ecode = e_option; - goto eof; + log_it("CRON", getpid(), "ERROR", + "Only privileged user can disable logging. " + "In future versions, user lines starting with a dash " + "will be treated as invalid and won't get executed.", 0); + /* throw an error when editing a crontab */ + if (error_func) + (*error_func) (ecodes[(int) e_minute]); } ch = get_char(file); if (ch == EOF) @@ -371,9 +376,9 @@ entry *load_entry(FILE * file, void (*er Debug(DPARS, ("load_entry()...returning successfully\n")) - /* success, fini, return pointer to the entry we just created... - */ - return (e); + /* success, fini, return pointer to the entry we just created... + */ + return (e); eof: if (e->envp) ++++++ cronie-1.4.8-bug_756197.diff ++++++ --- man/crontab.5.orig 2012-04-10 10:02:06.520889184 -0400 +++ man/crontab.5 2012-04-10 10:03:19.752973655 -0400 @@ -19,7 +19,7 @@ .\" .\" $Id: crontab.5,v 1.6 2004/01/23 19:03:33 vixie Exp $ .\" -.TH ANACRONTAB 5 "July 2010" "Marcela Mašláňová" "Cronie Users' Manual" +.TH CRONTAB 5 "July 2010" "Marcela Mašláňová" "Cronie Users' Manual" .SH NAME crontab \- files used to schedule the execution of programs .SH DESCRIPTION @@ -274,7 +274,7 @@ 0-59 * * * * id -Z > /tmp/SystemHigh/crontest .fi .SH FILES -.I /etc/anacrontab +.I /etc/crontab system crontab file for jobs like cron.daily, weekly, monthly. .I /var/spool/cron/ a directory for storing crontabs defined by users. ++++++ cronie-anacron-1.4.7-run-crons.patch ++++++ Index: cronie-1.4.7/contrib/anacrontab =================================================================== --- cronie-1.4.7.orig/contrib/anacrontab +++ cronie-1.4.7/contrib/anacrontab @@ -11,6 +11,6 @@ RANDOM_DELAY=45 START_HOURS_RANGE=3-22 #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 +1 5 cron.daily nice /usr/lib/cron/run-crons /etc/cron.daily +7 25 cron.weekly nice /usr/lib/cron/run-crons /etc/cron.weekly +@monthly 45 cron.monthly nice /usr/lib/cron/run-crons /etc/cron.monthly Index: cronie-1.4.7/man/anacrontab.5 =================================================================== --- cronie-1.4.7.orig/man/anacrontab.5 +++ cronie-1.4.7/man/anacrontab.5 @@ -79,9 +79,9 @@ RANDOM_DELAY=30 # Anacron jobs will start between 6am and 8am. START_HOURS_RANGE=6-8 # delay will be 5 minutes + RANDOM_DELAY for cron.daily -1 5 cron.daily nice run-parts /etc/cron.daily -7 0 cron.weekly nice run-parts /etc/cron.weekly -@monthly 0 cron.monthly nice run-parts /etc/cron.monthly +1 5 cron.daily nice /usr/lib/cron/run-crons /etc/cron.daily +7 0 cron.weekly nice /usr/lib/cron/run-crons /etc/cron.weekly +@monthly 0 cron.monthly nice /usr/lib/cron/run-crons /etc/cron.monthly .fi .SH "SEE ALSO" .BR anacron (8), ++++++ cronie-crond_pid.diff ++++++ Index: cronie-1.4.4/src/pathnames.h =================================================================== --- cronie-1.4.4.orig/src/pathnames.h +++ cronie-1.4.4/src/pathnames.h @@ -41,7 +41,7 @@ #else # define PIDDIR SYSCONFDIR "/" #endif -#define PIDFILE "crond.pid" +#define PIDFILE "cron.pid" #define _PATH_CRON_PID PIDDIR PIDFILE #define REBOOT_LOCK PIDDIR "cron.reboot" ++++++ cronie-nheader_lines.diff ++++++ Index: src/crontab.c =================================================================== --- src/crontab.c.orig +++ src/crontab.c @@ -38,7 +38,7 @@ # include <selinux/av_permissions.h> #endif -#define NHEADER_LINES 0 +#define NHEADER_LINES 3 enum opt_t {opt_unknown, opt_list, opt_delete, opt_edit, opt_replace, opt_hostset, opt_hostget}; @@ -429,7 +429,7 @@ static char *host_specific_filename(char static void edit_cmd(void) { char n[MAX_FNAME], q[MAX_TEMPSTR], *editor; FILE *f; - int ch = '\0', t; + int ch = '\0', t, x; struct stat statbuf; struct utimbuf utimebuf; WAIT_T waiter; @@ -481,13 +481,25 @@ static void edit_cmd(void) { } Set_LineNum(1) - /* - * NHEADER_LINES processing removed for clarity - * (NHEADER_LINES == 0 in all Red Hat crontabs) - */ - /* copy the rest of the crontab (if any) to the temp file. - */ - if (EOF != ch) + + /* ignore the top few comments since we probably put them there. + */ + x = 0; + while (EOF != (ch = get_char(f))) { + if ('#' != ch) { + putc(ch, NewCrontab); + break; + } + while (EOF != (ch = get_char(f))) + if (ch == '\n') + break; + if (++x >= NHEADER_LINES) + break; + } + + /* copy the rest of the crontab (if any) to the temp file. + */ + if (EOF != ch) while (EOF != (ch = get_char(f))) putc(ch, NewCrontab); @@ -695,6 +707,7 @@ static int replace_cmd(void) { int error = 0; entry *e; uid_t file_owner; + time_t now = time(NULL); char **envp; char *safename; @@ -724,10 +737,10 @@ static int replace_cmd(void) { * * VERY IMPORTANT: make sure NHEADER_LINES agrees with this code. */ - /*fprintf(tmp, "# DO NOT EDIT THIS FILE - edit the master and reinstall.\n"); - *fprintf(tmp, "# (%s installed on %-24.24s)\n", Filename, ctime(&now)); - *fprintf(tmp, "# (Cron version %s)\n", CRON_VERSION); - */ + fprintf(tmp, "# DO NOT EDIT THIS FILE - edit the master and reinstall.\n"); + fprintf(tmp, "# (%s installed on %-24.24s)\n", Filename, ctime(&now)); + fprintf(tmp, "# (Cronie version %s)\n", CRON_VERSION); + #ifdef WITH_SELINUX if (selinux_context) fprintf(tmp, "SELINUX_ROLE_TYPE=%s\n", selinux_context); ++++++ cronie-nofork-nopid.patch ++++++ --- src/misc.c.orig +++ src/misc.c @@ -293,6 +293,8 @@ void acquire_daemonlock(int closeflag) { return; } + if(NoFork == 1) return; //move along, nothing to do here.. + if (fd == -1) { pidfile = _PATH_CRON_PID; /* Initial mode is 0600 to prevent flock() race/DoS. */ --- src/cron.c.orig +++ src/cron.c @@ -600,7 +600,7 @@ static void sigchld_handler(int x) { } static void quit(int x) { - (void) unlink(_PATH_CRON_PID); + if(NoFork == 0) unlink(_PATH_CRON_PID); _exit(0); } ++++++ cronie-pam_config.diff ++++++ Index: cronie-1.4.8/pam/crond =================================================================== --- cronie-1.4.8.orig/pam/crond +++ cronie-1.4.8/pam/crond @@ -3,8 +3,10 @@ # # # No PAM authentication called, auth modules not needed -account required pam_access.so -account include password-auth -session required pam_loginuid.so -session include password-auth -auth include password-auth +auth sufficient pam_rootok.so +account sufficient pam_listfile.so item=user sense=allow file=/etc/cron.allow onerr=succeed quiet +auth include common-auth +account include common-account +password include common-password +session required pam_loginuid.so +session include common-session ++++++ cronie-rpmlintrc ++++++ # This line is mandatory to access the configuration functions from Config import * addFilter("cronie.* incoherent-init-script-name")++++++ deny.sample ++++++ guest ++++++ run-crons ++++++ #!/bin/bash # # /usr/lib/cron/run-crons # # Copyright (c) 1998-2001 SuSE GmbH Nuernberg, Germany. All rights reserved. # # this script looks into /etc/cron.{hourly,daily,weekly,monthly} for # scripts to be executed. The info about last run is stored in # /var/spool/cron/lastrun # # concept similar to debian and redhat # # Changes: # 1998 - Burchard Steinbild <b...@suse.de>, 1998 # initial version # before 2001 - v...@org.chemie.uni-frankfurt.de # send an email with name of date-script instead of cron entry # "Subject: cronjob@www - daily - FAILURE" # (better one script for each date-sub-script) # requires changes to /etc/crontab # append > /dev/null 2>&1 to the line calling run-cons # 2001-09-11 # updated to Suse 7.2 merged # 2001-09-12 # changed FAILURE detection, until now all scripts with output # had "failed", now only scripts with error status != 0 # have failed. # 2001-09-13 - r...@suse.de # merged with 7.3: call logger with exit value for scripts # respect MAILTO as cron does # use mktemp -d for all tmpfiles # add variable to disable mail if all jobs returned 0 # # # Don't run jobs on laptops, that are AC-offline # if test -x /usr/bin/on_ac_power ; then on_ac_power -q if [ "$?" = "1" ]; then exit 0 fi fi if [ -f /etc/sysconfig/cron ]; then . /etc/sysconfig/cron fi BASENAME=`/usr/bin/basename $0` LOGGER="/bin/logger -t $BASENAME[$$]" export LC_TIME=POSIX TMPDIR=`mktemp -d /tmp/run-crons.XXXXXX` trap "rm -rf $TMPDIR" 0 1 2 3 13 15 # We will force to run cron.daily after 14 days, even # if you set MAX_NOT_RUN in /etc/sysconfig/cron # value is in minutes MAX_NOT_RUN_FORCE="20160" # Priority change for sub scripts. # range: highest -20 ... 19 lowest prioriy # default processes start in level 10 CRON_SCRIPT_NICE_VALUE=15 SPOOL=/var/spool/cron/lastrun # CRON Result EMail is sent to if test -z "$MAILTO" ; then SEND_TO="root" else SEND_TO="$MAILTO" fi mkdir -p $SPOOL #set verbose ## stage 1, search directories/scripts to run RUN="" for CRONDIR in /etc/cron.{hourly,daily,weekly,monthly} ; do test -d $CRONDIR || continue BASE=${CRONDIR##*/} TIME_EXT=${BASE##cron.} test -e $SPOOL/$BASE && { case $BASE in cron.hourly) TIME="-cmin +60 -or -cmin 60" ;; cron.daily) # if DAILY_TIME set, run only at a fixed time of day if [ "$DAILY_TIME" != "" ] ; then DAILY_TIME_NEW="`echo $DAILY_TIME | sed s,:,, | sed s,^0\*,, `" test -z "$DAILY_TIME_NEW" && DAILY_TIME_NEW=0 if [ "$DAILY_TIME_NEW" -gt "2359" ] ; then echo "wrong time format in /etc/sysconfig/cron DAILY_TIME, value is $DAILY_TIME" | logger fi NOW_H=`date +%H%M| sed s,^0\*,,` test -z "$NOW_H" && NOW_H=0 if [ $DAILY_TIME_NEW -gt $(($NOW_H-15)) ] && [ $DAILY_TIME_NEW -le $NOW_H ]; then TIME="" else # take care of MAX_NOT_RUN, default is 7 days if [ "$MAX_NOT_RUN" != "0" ] ; then TIME="-cmin +$((1440*$MAX_NOT_RUN)) -or -cmin $((1440*$MAX_NOT_RUN))" else TIME="-cmin +$MAX_NOT_RUN_FORCE -or -cmin $MAX_NOT_RUN_FORCE" fi fi # run as usual else TIME="-cmin +1440 -or -cmin 1440" fi ;; cron.weekly) TIME="-cmin +10080 -or -cmin 10080" ;; cron.monthly) DAYOFMONTH=`date '+%d'` DAYSLASTMONTH=`date -d "-$DAYOFMONTH days" '+%d'` if [ $DAYOFMONTH -gt $DAYSLASTMONTH ] ; then LASTMONTHSTR="-$DAYOFMONTH days" else LASTMONTHSTR="last month" fi NOW=`date +%s` LASTMONTH=`date -d "$LASTMONTHSTR" +%s` DIFF=`expr '(' $NOW - $LASTMONTH ')' / 86400` TIME="-ctime +$DIFF" ;; esac # remove all lock files for scripts that are due to run eval find $SPOOL/$BASE $TIME | \ xargs --no-run-if-empty rm } if test ! -e $SPOOL/$BASE ; then # accept this dir, if it isn't empty LIST=`find $CRONDIR ! -type d` if [ ! -z "$LIST" ] ; then RUN="${RUN} ${TIME_EXT}" fi fi done ## STATUS communication variable between # function run_scripts () # and loop-over-all-scripts # set in run_scripts to FAILURE if this script failed! # else it is empty # because it is never reset to empty after the initialization # it implements an OR like logic over all scripts ## STATUS="" # helper, run all scripts in one cron directory function run_scripts (){ local CRONDIR=$1 local TIME_EXT=$2 local TEMP_MSG=$TMPDIR/run-crons.${TIME_EXT}.$$ rm -r $TMPDIR/run-crons.${TIME_EXT}.* >/dev/null 2>&1 # keep going when something fails set +e for SCRIPT in $CRONDIR/* ; do test -d $SCRIPT && continue case "$SCRIPT" in .svn) continue ;; *.rpm*) continue ;; *.swap) continue ;; *.bak) continue ;; *.orig) continue ;; \#*) continue ;; *~) continue ;; esac /sbin/checkproc $SCRIPT && continue if test -x $SCRIPT ; then BASESCRIPT=`/usr/bin/basename $SCRIPT` nice -n ${CRON_SCRIPT_NICE_VALUE} $SCRIPT >$TEMP_MSG 2>&1 local ERRNO=$? if [ 0 -eq $ERRNO ] ; then if [ "$SYSLOG_ON_NO_ERROR" = "yes" ]; then echo "$BASESCRIPT: OK" | $LOGGER -p info fi else echo "$BASESCRIPT returned $ERRNO" | $LOGGER -p warn echo "SCRIPT: $BASESCRIPT exited with RETURNCODE = $ERRNO." STATUS="FAILURE" fi # write some wrapper text around the original output if [ -s "$TEMP_MSG" ] ; then echo "SCRIPT: output (stdout && stderr) follows" echo "" cat $TEMP_MSG echo -e "SCRIPT: $BASESCRIPT\n------- END OF OUTPUT" echo "" echo "" fi rm -f $TEMP_MSG > /dev/null 2>&1 else echo "WARNING: $SCRIPT is not executable, script is ignored !" fi done } # stage 2: # run all scripts and collect output into one mail # for each TIME_EXT with a meaningfull subject. # if [ ! -z "${RUN}" ] ; then for EXT in ${RUN} ; do CRONDIR="/etc/cron."${EXT} test -d $CRONDIR || continue BASE=`/usr/bin/basename $CRONDIR` TIME_EXT=${BASE##cron.} STATUS="" if test ! -e $SPOOL/$BASE ; then CONTROL_MAIL=$TMPDIR/run-crons_mail.$$ JOB_OUTPUT=$TMPDIR/run-crons_output.$$ echo "running ${TIME_EXT} cronjob scripts" >> ${CONTROL_MAIL} echo "" >> ${CONTROL_MAIL} touch $SPOOL/$BASE run_scripts ${CRONDIR} ${TIME_EXT} >> ${JOB_OUTPUT} 2>&1 TITLE="cronjob@$HOSTNAME - ${TIME_EXT}" if [ -n "${STATUS}" ] ; then TITLE="${TITLE} - ${STATUS}" else TITLE="${TITLE} - OK" fi if [ -n "${STATUS}" -o "$SEND_MAIL_ON_NO_ERROR" = "yes" ] ; then cat ${CONTROL_MAIL} ${JOB_OUTPUT} | mail ${SEND_TO} -s "${TITLE}" elif [ -s ${JOB_OUTPUT} -a "$SEND_OUTPUT_ON_NO_ERROR" = "yes" ] ; then cat ${CONTROL_MAIL} ${JOB_OUTPUT} | mail ${SEND_TO} -s "${TITLE}" fi rm -f ${CONTROL_MAIL} ${JOB_OUTPUT} fi done fi # # now make sure, we have no lastrun files dated to future # touch $SPOOL NOW=`date -u +%s` for i in `find $SPOOL -type f` do FILEDATE=`date -u -r $i +%s` # allow for up to one hour in the future because of summer/wintertime if [ $((FILEDATE - NOW)) -gt 3600 ] then rm $i fi done ++++++ sample.root ++++++ SHELL=/bin/sh PATH=/usr/bin:/usr/sbin:/sbin:/bin:/usr/lib/news/bin MAILTO=root # # check scripts in cron.hourly, cron.daily, cron.weekly, and cron.monthly # -*/15 * * * * root test -x /usr/lib/cron/run-crons && /usr/lib/cron/run-crons >/dev/null 2>&1 -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org