Hello community, here is the log from the commit of package cronie for openSUSE:Factory checked in at 2015-07-02 22:46:42 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/cronie (Old) and /work/SRC/openSUSE:Factory/.cronie.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "cronie" Changes: -------- --- /work/SRC/openSUSE:Factory/cronie/cronie.changes 2015-06-11 09:09:57.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.cronie.new/cronie.changes 2015-07-02 22:46:43.000000000 +0200 @@ -1,0 +2,39 @@ +Thu Jun 25 19:13:40 UTC 2015 - [email protected] + +- revert last change, it is a bug in sssd.service, fixed in + SR#313709 + +------------------------------------------------------------------- +Thu Jun 25 13:39:16 UTC 2015 - [email protected] + +- add support for MAILFROM, MAIL_CONFIG and different mailer binaries + in run-crons (bnc#812367, bnc#366762) + +------------------------------------------------------------------- +Tue Jun 23 08:27:40 UTC 2015 - [email protected] + +- Start cron after sssd.service bnc#926961 + +------------------------------------------------------------------- +Mon Jun 22 14:21:25 UTC 2015 - [email protected] + +- Redo the post/pre update approach to fix migration from SLE11. + Should fix bnc#919028 + +------------------------------------------------------------------- +Fri Jun 19 14:51:05 UTC 2015 - [email protected] + +- update to 1.5.0 + * crond: Job environment variables are set also when executing + sendmail. + * crond: Adding duplicate orphans on reload is now prevented. + * crond: The regular crond shutdown is now logged. + * crontab: PAM is not called in crontab command if the caller's + uid is 0. + * crond: PAM is not called from crond for system cron jobs + (/etc/crontab, /etc/cron.d) which are run for uid 0. + * crond: The existence of an user is checked at time when job is + run and not when the crontab is parsed on database reload. +- use spec-cleaner + +------------------------------------------------------------------- Old: ---- cronie-1.4.12.tar.gz New: ---- cronie-1.5.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ cronie.spec ++++++ --- /var/tmp/diff_new_pack.dm7Lcj/_old 2015-07-02 22:46:44.000000000 +0200 +++ /var/tmp/diff_new_pack.dm7Lcj/_new 2015-07-02 22:46:44.000000000 +0200 @@ -16,10 +16,9 @@ # -# 3 : we don't need to do something with /etc/sysconfig/cron for now %define cron_configs %{_sysconfdir}/pam.d/crond %{_sysconfdir}/crontab %{_sysconfdir}/cron.deny %{_sysconfdir}/omc/srvinfo.d/cron.xml Name: cronie -Version: 1.4.12 +Version: 1.5.0 Release: 0 Summary: Cron Daemon License: BSD-3-Clause and GPL-2.0 and MIT @@ -55,18 +54,16 @@ BuildRequires: libselinux-devel BuildRequires: pam-devel BuildRequires: pkgconfig(systemd) -Requires(pre): cron -Requires(post): permissions Requires(post): %fillup_prereq +Requires(post): permissions +Requires(pre): cron Recommends: smtp_daemon Suggests: postfix -# 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 +Conflicts: cron <= 4.1 BuildRoot: %{_tmppath}/%{name}-%{version}-build %{?systemd_requires} +# This is needed as cron subpkg has its own version %{expand: %%define cronie_version %{version}} -Conflicts: cron <= 4.1 %description cron automatically starts programs at specific times. Add new entries @@ -150,34 +147,32 @@ install -v -m644 %{SOURCE5} %{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=`%{_sbindir}/cron --help 2>&1 | %{_bindir}/grep mail` -# vixie-cron 4.1 doesn't contain mail fature +# Check if we are doing update from 4.1 vixie-cron. +# The -h does report garbage on vixie cron. +check_cron_mail_feature=`%{_sbindir}/cron -h 2>&1 | %{_bindir}/grep mail` if [ -e %{_sbindir}/cron -a -z "${check_cron_mail_feature}" ]; then - # save configs for cronie post-install phase touch %{_localstatedir}/run/update_from_old_cron - echo $1 - for conf in %{cron_configs} - do - mv "$conf" "$conf.bk" ||: + for conf in %{cron_configs} ; do + cp "$conf" "$conf.rpmbk" done fi +exit 0 %pre -if [ -e %{_localstatedir}/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 +# Move the old cron configurations back if we were updating +if [ -e %{_localstatedir}/run/update_from_old_cron ]; then + for conf in %{cron_configs} ; do + mv "$conf.rpmbk" "$conf" + done + rm %{_localstatedir}/run/update_from_old_cron +fi %set_permissions %{_sysconfdir}/crontab %{_bindir}/crontab %{fillup_only -n cron} %service_add_post cron.service +exit 0 %verifyscript %verify_permissions -e %{_sysconfdir}/crontab -e %{_bindir}/crontab @@ -188,11 +183,6 @@ %postun %service_del_postun cron.service -%posttrans -if [ -e %{_localstatedir}/run/update_from_old_cron ]; then - rm %{_localstatedir}/run/update_from_old_cron ||: -fi - %post anacron [ -e %{_localstatedir}/spool/anacron/cron.daily ] || touch %{_localstatedir}/spool/anacron/cron.daily [ -e %{_localstatedir}/spool/anacron/cron.weekly ] || touch %{_localstatedir}/spool/anacron/cron.weekly ++++++ cronie-1.4.12.tar.gz -> cronie-1.5.0.tar.gz ++++++ ++++ 3803 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cronie-1.4.12/ChangeLog new/cronie-1.5.0/ChangeLog --- old/cronie-1.4.12/ChangeLog 2014-09-17 15:00:12.000000000 +0200 +++ new/cronie-1.5.0/ChangeLog 2015-05-28 15:54:01.000000000 +0200 @@ -1,3 +1,43 @@ +2015-05-28 Tomas Mraz <[email protected]> + + * Pass the job environment also when executing the sendmail. + +2015-01-31 Felix Janda <[email protected]> + + * database.c: Use POSIX NAME_MAX instead of BSD MAXNAMLEN + +2015-04-21 Tomas Mraz <[email protected]> + + * Prevent adding duplicate orphans on reload. + +2015-02-05 Tomas Mraz <[email protected]> + + * Do not overwrite the last zero-byte. + +2015-02-03 Tomas Mraz <[email protected]> + + * Log the crond shutdown. + +2015-01-28 Tomas Mraz <[email protected]> + + * No need to call strcmp on already matched variables. + +2015-01-28 Tomas Mraz <[email protected]> + + * Use unbiased random number for RANDOM_DELAY. + +2015-01-28 Tomas Mraz <[email protected]> + + * Call PAM only when it makes sense. + +2015-01-28 Tomas Mraz <[email protected]> + + * Fix broken test for match_rx() failure. + +2014-11-04 Tomas Mraz <[email protected]> + + * Properly check the existence of the user at the time the job is run. + 2014-09-17 Marcela Mašláňová <[email protected]> * contrib/cronie.systemd: Services must be running before starting diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cronie-1.4.12/Makefile.am new/cronie-1.5.0/Makefile.am --- old/cronie-1.4.12/Makefile.am 2014-03-31 18:01:14.000000000 +0200 +++ new/cronie-1.5.0/Makefile.am 2015-05-28 16:07:23.000000000 +0200 @@ -1,12 +1,4 @@ -SUBDIRS = src man -if ANACRON -SUBDIRS += anacron -endif - -if PAM -pamdir = $(sysconfdir)/pam.d -dist_pam_DATA = pam/crond -endif +SUBDIRS = src man anacron dist_noinst_HEADERS = \ cronie_common.h @@ -18,4 +10,12 @@ contrib/0anacron \ contrib/0hourly \ contrib/dailyjobs \ - contrib/cronie.systemd + contrib/cronie.systemd \ + anacron/ChangeLog.anacron + +if PAM +pamdir = $(sysconfdir)/pam.d +dist_pam_DATA = pam/crond +else +EXTRA_DIST += pam/crond +endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cronie-1.4.12/NEWS new/cronie-1.5.0/NEWS --- old/cronie-1.4.12/NEWS 2014-03-31 18:01:14.000000000 +0200 +++ new/cronie-1.5.0/NEWS 2015-05-28 15:47:07.000000000 +0200 @@ -0,0 +1,13 @@ +cronie NEWS -- history of user-visible changes. + +Release 1.5.0 + +* First release with NEWS. :) +* crond: Job environment variables are set also when executing sendmail. +* crond: Adding duplicate orphans on reload is now prevented. +* crond: The regular crond shutdown is now logged. +* crontab: PAM is not called in crontab command if the caller's uid is 0. +* crond: PAM is not called from crond for system cron jobs + (/etc/crontab, /etc/cron.d) which are run for uid 0. +* crond: The existence of an user is checked at time when job is run + and not when the crontab is parsed on database reload. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cronie-1.4.12/anacron/ChangeLog.anacron new/cronie-1.5.0/anacron/ChangeLog.anacron --- old/cronie-1.4.12/anacron/ChangeLog.anacron 1970-01-01 01:00:00.000000000 +0100 +++ new/cronie-1.5.0/anacron/ChangeLog.anacron 2015-05-28 15:52:19.000000000 +0200 @@ -0,0 +1,39 @@ + Changes in Anacron 2.3.1 + ------------------------ +* documentation no longer suggests adding local directories to the PATH + + + Changes in Anacron 2.3 + ---------------------- +* anacron can now read an arbitrary anacrontab file, use the -t option + + + Changes in Anacron 2.1/2.2 + -------------------------- +* Sean 'Shaleh' Perry <shaleh@(debian.org|valinux.com)> is now maintainer +* if timestamp is from the future, re-run job +* ansi cleanup / code cleaning + + + Changes in Anacron 2.0.1 + ------------------------ +* Minor cosmetic changes to log messages. +* Jobs are now started with "/" as their working directory. This is + more compatible with older Anacron versions, avoids annoying errors on + some systems, and generally seems to make more sense. + + + Summary of major changes in Anacron 2.0 + --------------------------------------- +* Complete rewrite in C. Should be backwards compatible with existing + Anacron installations. +* First release as a "generic" Linux package (was a Debian package). +* No longer needs special lock-files. Locking is done on the timestamp + files. +* Sends log messages to syslogd. There's no log file now. +* Output of jobs, if any, is mailed to the user. +* Added command line options: -s -f -n -d -q -u -V -h. See the manpage. +* Specific jobs can now be selected on the command line. +* Added SIGUSR1 handling, to cleanly stop execution. +* Jobs will now be started with their current directory set to the home + of the user running Anacron (usually root). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cronie-1.4.12/anacron/Makefile.am new/cronie-1.5.0/anacron/Makefile.am --- old/cronie-1.4.12/anacron/Makefile.am 2014-03-31 18:01:14.000000000 +0200 +++ new/cronie-1.5.0/anacron/Makefile.am 2015-05-28 16:02:31.000000000 +0200 @@ -1,5 +1,7 @@ # Makefile.am - two binaries crond and crontab +if ANACRON sbin_PROGRAMS = anacron +endif anacron_SOURCES = \ gregor.c lock.c log.c main.c matchrx.c readtab.c runjob.c \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cronie-1.4.12/anacron/readtab.c new/cronie-1.5.0/anacron/readtab.c --- old/cronie-1.4.12/anacron/readtab.c 2014-07-29 13:17:25.000000000 +0200 +++ new/cronie-1.5.0/anacron/readtab.c 2015-01-28 18:00:37.000000000 +0100 @@ -239,6 +239,21 @@ jr->named_period, jr->delay, jr->ident, jr->command)); } +static long int +unbiased_rand(long int max) +{ + long int rn; + long int divisor; + + divisor = RAND_MAX / (max + 1); + + do { + rn = random() / divisor; + } while (rn > max); + + return rn; +} + static void parse_tab_line(char *line) { @@ -281,21 +296,19 @@ } Debug(("Jobs will start in the %02d:00-%02d:00 range.", range_start, range_stop)); } - if (strncmp(env_var, "RANDOM_DELAY", 12) == 0) { + else if (strncmp(env_var, "RANDOM_DELAY", 12) == 0) { r = match_rx("^([[:digit:]]+)$", value, 0); if (r == -1) goto reg_err; if (r == 0) goto reg_invalid; - if (r != -1) { - int i = random(); - double x = 0; - x = (double) i / (double) RAND_MAX * (double) (atoi(value)); - random_number = (int)x; - Debug(("Randomized delay set: %d", random_number)); - } + + random_number = (int)unbiased_rand(atoi(value)); + Debug(("Randomized delay set: %d", random_number)); } - if (strncmp(env_var, "PREFERRED_HOUR", 14) == 0) { + else if (strncmp(env_var, "PREFERRED_HOUR", 14) == 0) { r = match_rx("^([[:digit:]]+)$", value, 1, &pref_hour); - if ((r != -1) || (pref_hour != NULL)) { + if (r == -1) goto reg_err; + + if (r) { preferred_hour = atoi(pref_hour); if ((preferred_hour < 0) || (preferred_hour > 24)) { preferred_hour = -1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cronie-1.4.12/compile new/cronie-1.5.0/compile --- old/cronie-1.4.12/compile 1970-01-01 01:00:00.000000000 +0100 +++ new/cronie-1.5.0/compile 2015-05-28 14:39:18.000000000 +0200 @@ -0,0 +1,347 @@ +#! /bin/sh +# Wrapper for compilers which do not understand '-c -o'. + +scriptversion=2012-10-14.11; # UTC + +# Copyright (C) 1999-2013 Free Software Foundation, Inc. +# Written by Tom Tromey <[email protected]>. +# +# 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, 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/>. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to <[email protected]> or send patches to +# <[email protected]>. + +nl=' +' + +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent tools from complaining about whitespace usage. +IFS=" "" $nl" + +file_conv= + +# func_file_conv build_file lazy +# Convert a $build file to $host form and store it in $file +# Currently only supports Windows hosts. If the determined conversion +# type is listed in (the comma separated) LAZY, no conversion will +# take place. +func_file_conv () +{ + file=$1 + case $file in + / | /[!/]*) # absolute file, and not a UNC file + if test -z "$file_conv"; then + # lazily determine how to convert abs files + case `uname -s` in + MINGW*) + file_conv=mingw + ;; + CYGWIN*) + file_conv=cygwin + ;; + *) + file_conv=wine + ;; + esac + fi + case $file_conv/,$2, in + *,$file_conv,*) + ;; + mingw/*) + file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` + ;; + cygwin/*) + file=`cygpath -m "$file" || echo "$file"` + ;; + wine/*) + file=`winepath -w "$file" || echo "$file"` + ;; + esac + ;; + esac +} + +# func_cl_dashL linkdir +# Make cl look for libraries in LINKDIR +func_cl_dashL () +{ + func_file_conv "$1" + if test -z "$lib_path"; then + lib_path=$file + else + lib_path="$lib_path;$file" + fi + linker_opts="$linker_opts -LIBPATH:$file" +} + +# func_cl_dashl library +# Do a library search-path lookup for cl +func_cl_dashl () +{ + lib=$1 + found=no + save_IFS=$IFS + IFS=';' + for dir in $lib_path $LIB + do + IFS=$save_IFS + if $shared && test -f "$dir/$lib.dll.lib"; then + found=yes + lib=$dir/$lib.dll.lib + break + fi + if test -f "$dir/$lib.lib"; then + found=yes + lib=$dir/$lib.lib + break + fi + if test -f "$dir/lib$lib.a"; then + found=yes + lib=$dir/lib$lib.a + break + fi + done + IFS=$save_IFS + + if test "$found" != yes; then + lib=$lib.lib + fi +} + +# func_cl_wrapper cl arg... +# Adjust compile command to suit cl +func_cl_wrapper () +{ + # Assume a capable shell + lib_path= + shared=: + linker_opts= + for arg + do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + eat=1 + case $2 in + *.o | *.[oO][bB][jJ]) + func_file_conv "$2" + set x "$@" -Fo"$file" + shift + ;; + *) + func_file_conv "$2" + set x "$@" -Fe"$file" + shift + ;; + esac + ;; + -I) + eat=1 + func_file_conv "$2" mingw + set x "$@" -I"$file" + shift + ;; + -I*) + func_file_conv "${1#-I}" mingw + set x "$@" -I"$file" + shift + ;; + -l) + eat=1 + func_cl_dashl "$2" + set x "$@" "$lib" + shift + ;; + -l*) + func_cl_dashl "${1#-l}" + set x "$@" "$lib" + shift + ;; + -L) + eat=1 + func_cl_dashL "$2" + ;; + -L*) + func_cl_dashL "${1#-L}" + ;; + -static) + shared=false + ;; + -Wl,*) + arg=${1#-Wl,} + save_ifs="$IFS"; IFS=',' + for flag in $arg; do + IFS="$save_ifs" + linker_opts="$linker_opts $flag" + done + IFS="$save_ifs" + ;; + -Xlinker) + eat=1 + linker_opts="$linker_opts $2" + ;; + -*) + set x "$@" "$1" + shift + ;; + *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) + func_file_conv "$1" + set x "$@" -Tp"$file" + shift + ;; + *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) + func_file_conv "$1" mingw + set x "$@" "$file" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift + done + if test -n "$linker_opts"; then + linker_opts="-link$linker_opts" + fi + exec "$@" $linker_opts + exit 1 +} + +eat= + +case $1 in + '') + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: compile [--help] [--version] PROGRAM [ARGS] + +Wrapper for compilers which do not understand '-c -o'. +Remove '-o dest.o' from ARGS, run PROGRAM with the remaining +arguments, and rename the output as expected. + +If you are trying to build a whole package this is not the +right script to run: please start by reading the file 'INSTALL'. + +Report bugs to <[email protected]>. +EOF + exit $? + ;; + -v | --v*) + echo "compile $scriptversion" + exit $? + ;; + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) + func_cl_wrapper "$@" # Doesn't return... + ;; +esac + +ofile= +cfile= + +for arg +do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + # So we strip '-o arg' only if arg is an object. + eat=1 + case $2 in + *.o | *.obj) + ofile=$2 + ;; + *) + set x "$@" -o "$2" + shift + ;; + esac + ;; + *.c) + cfile=$1 + set x "$@" "$1" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift +done + +if test -z "$ofile" || test -z "$cfile"; then + # If no '-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # '.c' file was seen then we are probably linking. That is also + # ok. + exec "$@" +fi + +# Name of file we expect compiler to create. +cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` + +# Create the lock directory. +# Note: use '[/\\:.-]' here to ensure that we don't use the same name +# that we are using for the .o file. Also, base the name on the expected +# object file name, since that is what matters with a parallel build. +lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d +while true; do + if mkdir "$lockdir" >/dev/null 2>&1; then + break + fi + sleep 1 +done +# FIXME: race condition here if user kills between mkdir and trap. +trap "rmdir '$lockdir'; exit 1" 1 2 15 + +# Run the compile. +"$@" +ret=$? + +if test -f "$cofile"; then + test "$cofile" = "$ofile" || mv "$cofile" "$ofile" +elif test -f "${cofile}bj"; then + test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" +fi + +rmdir "$lockdir" +exit $ret + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cronie-1.4.12/configure.ac new/cronie-1.5.0/configure.ac --- old/cronie-1.4.12/configure.ac 2014-09-17 14:15:04.000000000 +0200 +++ new/cronie-1.5.0/configure.ac 2015-05-28 15:47:34.000000000 +0200 @@ -1,4 +1,4 @@ -AC_INIT([cronie],[1.4.12],[[email protected],[email protected]]) +AC_INIT([cronie],[1.5.0],[[email protected],[email protected]]) AC_CONFIG_HEADER([config.h]) AC_PREREQ(2.60) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cronie-1.4.12/man/Makefile.am new/cronie-1.5.0/man/Makefile.am --- old/cronie-1.4.12/man/Makefile.am 2014-03-31 18:01:14.000000000 +0200 +++ new/cronie-1.5.0/man/Makefile.am 2015-05-28 16:12:50.000000000 +0200 @@ -1,6 +1,6 @@ dist_man_MANS = crontab.1 crontab.5 cron.8 crond.8 +EXTRA_DIST = anacrontab.5 anacron.8 + if ANACRON -dist_man_MANS += anacrontab.5 anacron.8 +dist_man_MANS += $(EXTRA_DIST) endif -noinst_MANS = bitstring.3 - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cronie-1.4.12/missing new/cronie-1.5.0/missing --- old/cronie-1.4.12/missing 2014-09-10 13:53:59.000000000 +0200 +++ new/cronie-1.5.0/missing 2012-11-26 15:24:25.000000000 +0100 @@ -1,10 +1,11 @@ #! /bin/sh -# Common wrapper for a few potentially missing GNU programs. +# Common stub for a few missing GNU programs while installing. -scriptversion=2012-06-26.16; # UTC +scriptversion=2012-01-06.13; # UTC -# Copyright (C) 1996-2013 Free Software Foundation, Inc. -# Originally written by Fran,cois Pinard <[email protected]>, 1996. +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, +# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard <[email protected]>, 1996. # 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 @@ -25,40 +26,68 @@ # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then - echo 1>&2 "Try '$0 --help' for more information" + echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi -case $1 in +run=: +sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' +sed_minuso='s/.* -o \([^ ]*\).*/\1/p' + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi - --is-lightweight) - # Used by our autoconf macros to check whether the available missing - # script is modern enough. - exit 0 - ;; +msg="missing on your system" - --run) - # Back-compat with the calling convention used by older automake. - shift - ;; +case $1 in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... -Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due -to PROGRAM being missing or too old. +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails Supported PROGRAM values: - aclocal autoconf autoheader autom4te automake makeinfo - bison yacc flex lex help2man + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + autom4te touch the output file, or create a stub one + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + yacc create \`y.tab.[ch]', if possible, from existing .[ch] -Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and -'g' are ignored when checking the name. +Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and +\`g' are ignored when checking the name. Send bug reports to <[email protected]>." exit $? @@ -70,141 +99,228 @@ ;; -*) - echo 1>&2 "$0: unknown '$1' option" - echo 1>&2 "Try '$0 --help' for more information" + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac -# Run the given program, remember its exit status. -"$@"; st=$? +# normalize program name to check for. +program=`echo "$1" | sed ' + s/^gnu-//; t + s/^gnu//; t + s/^g//; t'` + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). This is about non-GNU programs, so use $1 not +# $program. +case $1 in + lex*|yacc*) + # Not GNU programs, they don't have --version. + ;; -# If it succeeded, we are done. -test $st -eq 0 && exit 0 + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac -# Also exit now if we it failed (or wasn't found), and '--version' was -# passed; such an option is passed most likely to detect whether the -# program is present and works. -case $2 in --version|--help) exit $st;; esac - -# Exit code 63 means version mismatch. This often happens when the user -# tries to use an ancient version of a tool on a file that requires a -# minimum version. -if test $st -eq 63; then - msg="probably too old" -elif test $st -eq 127; then - # Program was missing. - msg="missing on your system" -else - # Program was found and executed, but failed. Give up. - exit $st -fi +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case $program in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case $f in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te*) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison*|yacc*) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if test $# -ne 1; then + eval LASTARG=\${$#} + case $LASTARG in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if test ! -f y.tab.h; then + echo >y.tab.h + fi + if test ! -f y.tab.c; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex*|flex*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if test $# -ne 1; then + eval LASTARG=\${$#} + case $LASTARG in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if test ! -f lex.yy.c; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit $? + fi + ;; + + makeinfo*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -z "$file"; then + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n ' + /^@setfilename/{ + s/.* \([^ ]*\) *$/\1/ + p + q + }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 + touch $file + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac -perl_URL=http://www.perl.org/ -flex_URL=http://flex.sourceforge.net/ -gnu_software_URL=http://www.gnu.org/software - -program_details () -{ - case $1 in - aclocal|automake) - echo "The '$1' program is part of the GNU Automake package:" - echo "<$gnu_software_URL/automake>" - echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" - echo "<$gnu_software_URL/autoconf>" - echo "<$gnu_software_URL/m4/>" - echo "<$perl_URL>" - ;; - autoconf|autom4te|autoheader) - echo "The '$1' program is part of the GNU Autoconf package:" - echo "<$gnu_software_URL/autoconf/>" - echo "It also requires GNU m4 and Perl in order to run:" - echo "<$gnu_software_URL/m4/>" - echo "<$perl_URL>" - ;; - esac -} - -give_advice () -{ - # Normalize program name to check for. - normalized_program=`echo "$1" | sed ' - s/^gnu-//; t - s/^gnu//; t - s/^g//; t'` - - printf '%s\n' "'$1' is $msg." - - configure_deps="'configure.ac' or m4 files included by 'configure.ac'" - case $normalized_program in - autoconf*) - echo "You should only need it if you modified 'configure.ac'," - echo "or m4 files included by it." - program_details 'autoconf' - ;; - autoheader*) - echo "You should only need it if you modified 'acconfig.h' or" - echo "$configure_deps." - program_details 'autoheader' - ;; - automake*) - echo "You should only need it if you modified 'Makefile.am' or" - echo "$configure_deps." - program_details 'automake' - ;; - aclocal*) - echo "You should only need it if you modified 'acinclude.m4' or" - echo "$configure_deps." - program_details 'aclocal' - ;; - autom4te*) - echo "You might have modified some maintainer files that require" - echo "the 'automa4te' program to be rebuilt." - program_details 'autom4te' - ;; - bison*|yacc*) - echo "You should only need it if you modified a '.y' file." - echo "You may want to install the GNU Bison package:" - echo "<$gnu_software_URL/bison/>" - ;; - lex*|flex*) - echo "You should only need it if you modified a '.l' file." - echo "You may want to install the Fast Lexical Analyzer package:" - echo "<$flex_URL>" - ;; - help2man*) - echo "You should only need it if you modified a dependency" \ - "of a man page." - echo "You may want to install the GNU Help2man package:" - echo "<$gnu_software_URL/help2man/>" - ;; - makeinfo*) - echo "You should only need it if you modified a '.texi' file, or" - echo "any other file indirectly affecting the aspect of the manual." - echo "You might want to install the Texinfo package:" - echo "<$gnu_software_URL/texinfo/>" - echo "The spurious makeinfo call might also be the consequence of" - echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" - echo "want to install GNU make:" - echo "<$gnu_software_URL/make/>" - ;; - *) - echo "You might have modified some files without having the proper" - echo "tools for further handling them. Check the 'README' file, it" - echo "often tells you about the needed prerequisites for installing" - echo "this package. You may also peek at any GNU archive site, in" - echo "case some other package contains this missing '$1' program." - ;; - esac -} - -give_advice "$1" | sed -e '1s/^/WARNING: /' \ - -e '2,$s/^/ /' >&2 - -# Propagate the correct exit status (expected to be 127 for a program -# not found, 63 for a program that failed due to version mismatch). -exit $st +exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cronie-1.4.12/src/cron.c new/cronie-1.5.0/src/cron.c --- old/cronie-1.4.12/src/cron.c 2014-07-30 10:17:04.000000000 +0200 +++ new/cronie-1.5.0/src/cron.c 2015-02-05 16:29:17.000000000 +0100 @@ -261,7 +261,7 @@ setlocale(LC_ALL, ""); /* set locale to system defaults or to * that specified by any LC_* env vars */ if ((cs = nl_langinfo(CODESET)) != 0L) - strncpy(cron_default_mail_charset, cs, MAX_ENVSTR); + strncpy(cron_default_mail_charset, cs, MAX_ENVSTR-1); else strcpy(cron_default_mail_charset, "US-ASCII"); @@ -486,6 +486,8 @@ log_it("CRON", pid, "INFO", "Inotify close failed", errno); #endif + log_it("CRON", pid, "INFO", "Shutting down", 0); + (void) unlink(_PATH_CRON_PID); return 0; @@ -525,7 +527,6 @@ int minute, hour, dom, month, dow; user *u; entry *e; - const char *uname; /* The support for the job-specific timezones is not perfect. There will * be jobs missed or run twice during the DST change in the job timezone. @@ -562,40 +563,30 @@ */ for (u = db->head; u != NULL; u = u->next) { for (e = u->crontab; e != NULL; e = e->next) { - Debug(DSCH | DEXT, ("user [%s:%ld:%ld:...] cmd=\"%s\"\n", - e->pwd->pw_name, (long) e->pwd->pw_uid, - (long) e->pwd->pw_gid, e->cmd)); - 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 */ - if (bit_test(e->minute, minute) && - bit_test(e->hour, hour) && - bit_test(e->month, month) && - (((e->flags & DOM_STAR) || (e->flags & DOW_STAR)) - ? (bit_test(e->dow, dow) && bit_test(e->dom, dom)) + 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 */ + if (bit_test(e->minute, minute) && + bit_test(e->hour, hour) && + bit_test(e->month, month) && + (((e->flags & DOM_STAR) || (e->flags & DOW_STAR)) + ? (bit_test(e->dow, dow) && bit_test(e->dom, dom)) : (bit_test(e->dow, dow) || bit_test(e->dom, dom)) - ) - ) { - if (job_tz != NULL && vGMToff != GMToff) - /* do not try to run the jobs from different timezones - * during the DST switch of the default timezone. - */ - continue; - - if ((doNonWild && - !(e->flags & (MIN_STAR | HR_STAR))) || - (doWild && (e->flags & (MIN_STAR | HR_STAR)))) - job_add(e, u); /*will add job, if it isn't in queue already for NOW. */ - } - } - else { - log_it(uname, getpid(), "ERROR", "getpwnam() failed",errno); - Debug(DSCH | DEXT, ("%s:%d pid=%d time=%ld getpwnam(%s) failed errno=%d error=%s\n",__FILE__,__LINE__,getpid(),time(NULL),uname,errno,strerror(errno))); + ) + ) { + if (job_tz != NULL && vGMToff != GMToff) + /* do not try to run the jobs from different timezones + * during the DST switch of the default timezone. + */ + continue; + + if ((doNonWild && + !(e->flags & (MIN_STAR | HR_STAR))) || + (doWild && (e->flags & (MIN_STAR | HR_STAR)))) + job_add(e, u); /*will add job, if it isn't in queue already for NOW. */ } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cronie-1.4.12/src/crontab.c new/cronie-1.5.0/src/crontab.c --- old/cronie-1.4.12/src/crontab.c 2014-03-31 18:01:14.000000000 +0200 +++ new/cronie-1.5.0/src/crontab.c 2014-12-02 16:24:56.000000000 +0100 @@ -170,7 +170,7 @@ } #if defined(WITH_PAM) - if (cron_start_pam(pw) != PAM_SUCCESS) { + if (getuid() != 0 && cron_start_pam(pw) != PAM_SUCCESS) { fprintf(stderr, "You (%s) are not allowed to access to (%s) because of pam configuration.\n", User, ProgramName); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cronie-1.4.12/src/database.c new/cronie-1.5.0/src/database.c --- old/cronie-1.4.12/src/database.c 2014-03-31 18:01:14.000000000 +0200 +++ new/cronie-1.5.0/src/database.c 2015-05-28 13:00:24.000000000 +0200 @@ -32,6 +32,7 @@ #include <dirent.h> #include <errno.h> #include <fcntl.h> +#include <limits.h> #include <pwd.h> #include <stdlib.h> #include <string.h> @@ -152,10 +153,41 @@ } } +static int +find_orphan(const char *uname, const char *fname, const char *tabname) { + orphan *o; + + for (o = orphans; o != NULL; o = o->next) { + if (uname && o->uname) { + if (strcmp(uname, o->uname) != 0) + continue; + } else if (uname != o->uname) + continue; + + if (fname && o->fname) { + if (strcmp(fname, o->fname) != 0) + continue; + } else if (fname != o->fname) + continue; + + if (tabname && o->tabname) { + if (strcmp(tabname, o->tabname) != 0) + continue; + } else if (tabname != o->tabname) + continue; + return 1; + } + + return 0; +} + static void add_orphan(const char *uname, const char *fname, const char *tabname) { orphan *o; + if (find_orphan(uname, fname, tabname)) + return; + o = calloc(1, sizeof(*o)); if (o == NULL) return; @@ -252,7 +284,7 @@ static int cluster_host_is_local(void) { - char filename[MAXNAMLEN+1]; + char filename[NAME_MAX+1]; int is_local; FILE *f; char hostname[MAXHOSTNAMELEN], myhostname[MAXHOSTNAMELEN]; @@ -348,7 +380,7 @@ } else { while (NULL != (dp = readdir(dir))) { - char tabname[MAXNAMLEN + 1]; + char tabname[NAME_MAX + 1]; if (not_a_crontab(dp)) continue; @@ -366,12 +398,12 @@ } else { while (NULL != (dp = readdir(dir))) { - char fname[MAXNAMLEN + 1], tabname[MAXNAMLEN + 1]; + char fname[NAME_MAX + 1], tabname[NAME_MAX + 1]; if (not_a_crontab(dp)) continue; - strncpy(fname, dp->d_name, MAXNAMLEN); + strncpy(fname, dp->d_name, NAME_MAX); if (!glue_strings(tabname, sizeof tabname, SPOOL_DIR, dp->d_name, '/')) @@ -492,7 +524,7 @@ } else { while (NULL != (dp = readdir(dir))) { - char tabname[MAXNAMLEN + 1]; + char tabname[NAME_MAX + 1]; if (not_a_crontab(dp)) continue; @@ -519,12 +551,12 @@ is_local = cluster_host_is_local(); while (is_local && NULL != (dp = readdir(dir))) { - char fname[MAXNAMLEN + 1], tabname[MAXNAMLEN + 1]; + char fname[NAME_MAX + 1], tabname[NAME_MAX + 1]; if (not_a_crontab(dp)) continue; - strncpy(fname, dp->d_name, MAXNAMLEN); + strncpy(fname, dp->d_name, NAME_MAX); if (!glue_strings(tabname, sizeof tabname, SPOOL_DIR, fname, '/')) continue; /* XXX log? */ @@ -601,7 +633,7 @@ len = strlen(dp->d_name); - if (len >= MAXNAMLEN) + if (len >= NAME_MAX) return (1); /* XXX log? */ if ((len > 0) && (dp->d_name[len - 1] == '~')) @@ -628,7 +660,7 @@ } while (NULL != (dp = readdir(dir))) { - char tabname[MAXNAMLEN + 1]; + char tabname[NAME_MAX + 1]; if ( not_a_crontab ( dp ) && strcmp(dp->d_name, CRON_HOSTNAME) != 0) continue; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cronie-1.4.12/src/do_command.c new/cronie-1.5.0/src/do_command.c --- old/cronie-1.4.12/src/do_command.c 2014-04-30 14:30:53.000000000 +0200 +++ new/cronie-1.5.0/src/do_command.c 2015-05-28 13:01:04.000000000 +0200 @@ -436,7 +436,7 @@ else { strncpy(mailcmd, MailCmd, MAX_COMMAND); } - if (!(mail = cron_popen(mailcmd, "w", e->pwd))) { + if (!(mail = cron_popen(mailcmd, "w", e->pwd, jobenv))) { perror(mailcmd); (void) _exit(ERROR_EXIT); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cronie-1.4.12/src/entry.c new/cronie-1.5.0/src/entry.c --- old/cronie-1.4.12/src/entry.c 2014-03-31 18:01:14.000000000 +0200 +++ new/cronie-1.5.0/src/entry.c 2014-11-04 17:36:18.000000000 +0100 @@ -99,6 +99,7 @@ char envstr[MAX_ENVSTR]; char **tenvp; char *p; + struct passwd temppw; Debug(DPARS, ("load_entry()...about to eat comments\n")); @@ -286,11 +287,15 @@ pw = getpwnam(username); if (pw == NULL) { - ecode = e_username; - goto eof; - } - Debug(DPARS, ("load_entry()...uid %ld, gid %ld\n", + Debug(DPARS, ("load_entry()...unknown user entry\n")); + memset(&temppw, 0, sizeof (temppw)); + temppw.pw_name = username; + temppw.pw_passwd = ""; + pw = &temppw; + } else { + Debug(DPARS, ("load_entry()...uid %ld, gid %ld\n", (long) pw->pw_uid, (long) pw->pw_gid)); + } } if ((e->pwd = pw_dup(pw)) == NULL) { @@ -331,17 +336,11 @@ else log_it("CRON", getpid(), "ERROR", "can't set SHELL", 0); } - if (!env_get("HOME", e->envp)) { - if (glue_strings(envstr, sizeof envstr, "HOME", pw->pw_dir, '=')) { - if ((tenvp = env_set(e->envp, envstr)) == NULL) { - ecode = e_memory; - goto eof; - } - e->envp = tenvp; - } - else - log_it("CRON", getpid(), "ERROR", "can't set HOME", 0); + if ((tenvp = env_update_home(e->envp, pw->pw_dir)) == NULL) { + ecode = e_memory; + goto eof; } + e->envp = tenvp; #ifndef LOGIN_CAP /* If login.conf is in used we will get the default PATH later. */ if (ChangePath && !env_get("PATH", e->envp)) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cronie-1.4.12/src/env.c new/cronie-1.5.0/src/env.c --- old/cronie-1.4.12/src/env.c 2014-07-29 13:17:25.000000000 +0200 +++ new/cronie-1.5.0/src/env.c 2014-11-04 17:51:09.000000000 +0100 @@ -25,6 +25,7 @@ #include <errno.h> #include <stdlib.h> #include <string.h> +#include <sys/types.h> #include <unistd.h> #include "globals.h" @@ -295,3 +296,19 @@ } return (NULL); } + +char **env_update_home(char **envp, const char *dir) { + char envstr[MAX_ENVSTR]; + + if (dir == NULL || *dir == '\0' || env_get("HOME", envp)) { + return envp; + } + + if (glue_strings(envstr, sizeof envstr, "HOME", dir, '=')) { + envp = env_set(envp, envstr); + } + else + log_it("CRON", getpid(), "ERROR", "can't set HOME", 0); + + return envp; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cronie-1.4.12/src/funcs.h new/cronie-1.5.0/src/funcs.h --- old/cronie-1.4.12/src/funcs.h 2014-03-31 18:01:14.000000000 +0200 +++ new/cronie-1.5.0/src/funcs.h 2015-05-28 13:01:04.000000000 +0200 @@ -82,14 +82,15 @@ *first_word(const char *, const char *), **env_init(void), **env_copy(char **), - **env_set(char **, const char *); + **env_set(char **, const char *), + **env_update_home(char **, const 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 **); -FILE *cron_popen(char *, const char *, struct passwd *); +FILE *cron_popen(char *, const char *, struct passwd *, char **); struct passwd *pw_dup(const struct passwd *); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cronie-1.4.12/src/job.c new/cronie-1.5.0/src/job.c --- old/cronie-1.4.12/src/job.c 2014-03-31 18:01:14.000000000 +0200 +++ new/cronie-1.5.0/src/job.c 2014-11-04 17:39:12.000000000 +0100 @@ -22,6 +22,11 @@ #include "config.h" #include <stdlib.h> +#include <pwd.h> +#include <errno.h> +#include <sys/types.h> +#include <unistd.h> +#include <string.h> #include "funcs.h" #include "globals.h" @@ -36,12 +41,42 @@ void job_add(entry * e, user * u) { job *j; + struct passwd *newpwd; + struct passwd *temppwd; + const char *uname; /* if already on queue, keep going */ for (j = jhead; j != NULL; j = j->next) if (j->e == e && j->u == u) return; + uname = e->pwd->pw_name; + /* check if user exists in time of job is being run f.e. ldap */ + if ((temppwd = getpwnam(uname)) != NULL) { + char **tenvp; + + Debug(DSCH | DEXT, ("user [%s:%ld:%ld:...] cmd=\"%s\"\n", + e->pwd->pw_name, (long) temppwd->pw_uid, + (long) temppwd->pw_gid, e->cmd)); + if ((newpwd = pw_dup(temppwd)) == NULL) { + log_it(uname, getpid(), "ERROR", "memory allocation failed", errno); + return; + } + free(e->pwd); + e->pwd = newpwd; + + if ((tenvp = env_update_home(e->envp, e->pwd->pw_dir)) == NULL) { + log_it(uname, getpid(), "ERROR", "memory allocation failed", errno); + return; + } + e->envp = tenvp; + } else { + log_it(uname, getpid(), "ERROR", "getpwnam() failed",errno); + Debug(DSCH | DEXT, ("%s:%d pid=%d time=%ld getpwnam(%s) failed errno=%d error=%s\n", + __FILE__,__LINE__,getpid(),time(NULL),uname,errno,strerror(errno))); + return; + } + /* build a job queue element */ if ((j = (job *) malloc(sizeof (job))) == NULL) return; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cronie-1.4.12/src/popen.c new/cronie-1.5.0/src/popen.c --- old/cronie-1.4.12/src/popen.c 2014-04-30 14:30:53.000000000 +0200 +++ new/cronie-1.5.0/src/popen.c 2015-05-28 13:01:04.000000000 +0200 @@ -60,7 +60,7 @@ #define MAX_ARGS 1024 -FILE *cron_popen(char *program, const char *type, struct passwd *pw) { +FILE *cron_popen(char *program, const char *type, struct passwd *pw, char **jobenv) { char *cp; FILE *iop; int argc, pdes[2]; @@ -127,10 +127,10 @@ close(fd); } - if (cron_change_user_permanently(pw, pw->pw_dir) != 0) + if (cron_change_user_permanently(pw, env_get("HOME", jobenv)) != 0) _exit(2); - if (execvp(argv[0], argv) < 0) { + if (execvpe(argv[0], argv, jobenv) < 0) { int save_errno = errno; log_it("CRON", getpid(), "EXEC FAILED", program, save_errno); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cronie-1.4.12/src/security.c new/cronie-1.5.0/src/security.c --- old/cronie-1.4.12/src/security.c 2014-03-31 18:01:14.000000000 +0200 +++ new/cronie-1.5.0/src/security.c 2015-01-02 10:17:39.000000000 +0100 @@ -88,6 +88,7 @@ if (pam_session_opened != 0) \ pam_close_session(pamh, PAM_SILENT); \ pam_end(pamh, retcode); \ + pamh = NULL; \ } \ return(retcode); } #endif @@ -122,7 +123,8 @@ } #ifdef WITH_PAM - if ((ret = cron_start_pam(e->pwd)) != 0) { + /* PAM is called only for non-root users or non-system crontab */ + if ((!u->system || e->pwd->pw_uid != 0) && (ret = cron_start_pam(e->pwd)) != 0) { log_it(e->pwd->pw_name, getpid(), "FAILED to authorize user with PAM", pam_strerror(pamh, ret), 0); return -1; @@ -152,7 +154,7 @@ freecon(ucontext); #endif #ifdef WITH_PAM - if ((ret = cron_open_pam_session(e->pwd)) != 0) { + if (pamh != NULL && (ret = cron_open_pam_session(e->pwd)) != 0) { log_it(e->pwd->pw_name, getpid(), "FAILED to open PAM security session", pam_strerror(pamh, ret), 0); return -1; @@ -223,7 +225,10 @@ pam_setcred(pamh, PAM_DELETE_CRED | PAM_SILENT); pam_close_session(pamh, PAM_SILENT); } - pam_end(pamh, PAM_SUCCESS); + if (pamh != NULL) { + pam_end(pamh, PAM_SUCCESS); + pamh = NULL; + } #endif } @@ -243,7 +248,9 @@ #if defined(WITH_PAM) /* credentials may take form of supplementary groups so reinitialize * them here */ - pam_setcred(pamh, PAM_REINITIALIZE_CRED | PAM_SILENT); + if (pamh != NULL) { + pam_setcred(pamh, PAM_REINITIALIZE_CRED | PAM_SILENT); + } #endif return 0; @@ -614,18 +621,19 @@ * crontab environment */ static char **build_env(char **cronenv) { + char **jobenv; #ifdef WITH_PAM - char **jobenv = pam_getenvlist(pamh); char *cronvar; int count = 0; - if (jobenv == NULL) { - jobenv = env_init(); - if (jobenv == NULL) { + if (pamh == NULL || (jobenv=pam_getenvlist(pamh)) == NULL) { +#endif + jobenv = env_copy(cronenv); + if (jobenv == NULL) log_it("CRON", getpid(), "ERROR", "Initialization of cron environment variables failed", 0); - return NULL; - } + return jobenv; +#ifdef WITH_PAM } /* Now add the cron environment variables. Since env_set() @@ -640,7 +648,5 @@ } } return jobenv; -#else - return env_copy(cronenv); #endif } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cronie-1.4.12/src/structs.h new/cronie-1.5.0/src/structs.h --- old/cronie-1.4.12/src/structs.h 2014-03-31 18:01:14.000000000 +0200 +++ new/cronie-1.5.0/src/structs.h 2014-12-02 16:09:33.000000000 +0100 @@ -67,6 +67,7 @@ time_t mtime; /* last modtime of crontab */ entry *crontab; /* this person's crontab */ security_context_t scontext; /* SELinux security context */ + int system; /* is it a system crontab */ } user; typedef struct _orphan { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/cronie-1.4.12/src/user.c new/cronie-1.5.0/src/user.c --- old/cronie-1.4.12/src/user.c 2014-03-31 18:01:14.000000000 +0200 +++ new/cronie-1.5.0/src/user.c 2014-12-02 16:08:46.000000000 +0100 @@ -89,6 +89,8 @@ goto done; } + u->system = pw == NULL; + /* init environment. this will be copied/augmented for each entry. */ if ((envp = env_init()) == NULL) { ++++++ run-crons ++++++ --- /var/tmp/diff_new_pack.dm7Lcj/_old 2015-07-02 22:46:44.000000000 +0200 +++ /var/tmp/diff_new_pack.dm7Lcj/_new 2015-07-02 22:46:44.000000000 +0200 @@ -30,6 +30,8 @@ # respect MAILTO as cron does # use mktemp -d for all tmpfiles # add variable to disable mail if all jobs returned 0 +# 2015-06-25 - [email protected] +# bnc#812367 support MAILFROM as cron does # # @@ -65,12 +67,42 @@ SPOOL=/var/spool/cron/lastrun # CRON Result EMail is sent to -if test -z "$MAILTO" ; then +if [ -z "$MAILTO" ]; then SEND_TO="root" else SEND_TO="$MAILTO" fi +if [ -z "$MAILFROM" ]; then + SEND_FROM="root" +else + SEND_FROM="$MAILFROM" +fi + +# XXX support external specification of $MAILER? +for POSSIBLE_MAILER in /usr/bin/mail /usr/lib/sendmail /usr/bin/mailx /usr/sbin/sendmail; do + test -x $POSSIBLE_MAILER && MAILER=$POSSIBLE_MAILER +done +if [ -z "$MAILER" ]; then + echo "Could not find suitable mailer." + exit 1 +fi + +export MAIL_CONFIG +export MAILER + +function send_email() { + SUBJECT="$1"; shift + TMP=`mktemp` + echo "Subject: $SUBJECT" > "$TMP" + echo "From: $SEND_FROM" >> "$TMP" + echo "To: $SEND_TO" >> "$TMP" + echo >> "$TMP" + cat "$@" >> "$TMP" + "$MAILER" -r "$SEND_FROM" "$SEND_TO" < "$TMP" + rm -f "$TMP" +} + mkdir -p $SPOOL #set verbose @@ -232,9 +264,9 @@ 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}" + send_email "$TITLE" "$CONTROL_MAIL" "$JOB_OUTPUT" elif [ -s ${JOB_OUTPUT} -a "$SEND_OUTPUT_ON_NO_ERROR" = "yes" ] ; then - cat ${CONTROL_MAIL} ${JOB_OUTPUT} | mail ${SEND_TO} -s "${TITLE}" + send_email "$TITLE" "$CONTROL_MAIL" "$JOB_OUTPUT" fi rm -f ${CONTROL_MAIL} ${JOB_OUTPUT}
