Fixed configure --without-sendmail, and compilation errors when sendmail is disabled
Also don't check if email should be output if sendmail is disabled
(Thank you Thomas Trepl for pointing out the problem and submitting a patch)
Fixed fcron crash bug when using fcrondyn.
This bug was introduced in 25e9c80848acb89e6320ed6261a4d1c75b60b1c8, and we were using a fd after xclose() was called on it, so its value was no longer valid.
Audited the code for similar problems and didn't find any other.
Thibault Godouet [Sun, 13 Jan 2013 17:31:17 +0000 (17:31 +0000)]
Fixed bug in logging to a file and made file closure more robust
- when logging to a file, fcron would log a line to the pid file
- adding helpers functions to close files properly: check for errors, and set FILE* to NULL / fd to -1
tweaked fcron logging to file
- only enabled for fcron via a command line option (rather than fcron.conf)
I doubt people need this feature for command line tools, and we would need to manage the log file perms more closely to allow all tools to write to it
- reworked log.c/log.h: more sensible function names, better error checks
- changed the line format when logging to files/console
- added documentation on logging to file
Matt Signorini [Fri, 28 Dec 2012 01:59:05 +0000 (12:59 +1100)]
Renamed fcronlog in fcronconf.h to fcronlogfile, to avoid shadowing the function fcronlog.
Modified convert-fcrontab to include fcronconf.o, to fix an undefined
symbol issue with fcronlogfile. Also added code to parse a config file with
read_conf, and an extra flag '-c' to specify a config file. Docs have not
been updated in this commit.
added pam_loginuid to default fcron daemon PAM profile
This is so as when a fcron job runs, the audit system is able to account for the actions that fcron job does and tie it to the user that did it.
Thibault Godouet [Mon, 26 Nov 2012 20:31:30 +0000 (20:31 +0000)]
More portable code for va_arg() with mode_t (thank you Chris Calvey)
(followed recommendation from http://www.gnu.org/software/gnulib/manual/html_node/va_005farg.html)
Thibault Godouet [Wed, 21 Nov 2012 22:16:25 +0000 (22:16 +0000)]
Replaced function free_safe by macro Free_safe, and moved memory management functions to new mem.h/mem.c.
free_safe() was broken, as the pointer was not set to NULL outside of free_safe(). Simplest/cleanest way to fix this was to replace it by a macro doing the same. Now the pointers are correctly set to NULL, and things are actually safe.
Added options runatreboot, runonce, rebootreset, and cron-like shortcuts @reboot/@hourly/@monthly/...
Save cl_first for all @-lines (we only did it for volatile lines in the past)
added function mail_notrun_time_t()
added function free_line()
added function job_queue_remove()
added function init_default_line()
thib [Sun, 28 Feb 2010 20:59:38 +0000 (20:59 +0000)]
- fcrontab: drop all privileges and only get them back when necessary
- fcrondyn: drop sgid privileges as well as soon as they are not necessary anymore
- fixed a couple gcc warnings
Thibault Godouet [Sun, 10 Jan 2010 17:11:13 +0000 (17:11 +0000)]
- removed Flush() macro (replaced by free_safe())
- added alloc_safe() and realloc_safe(): wrappers around calloc() and realloc() that die on error
- checked the code to use free_safe(), Set(), Alloc(), alloc_safe() and realloc_safe() whenever appropriate
- Rewrote the env var management code with Vixie cron compatibility in mind
* new env_list_t type with associated functions
* build some char **envp arrays and pass them to execle()
* cleaner management of env var defined several times
* don't inherit fcron's environment when running a job but build the environment from scratch
* list the env var as X-Cron-Env headers in the job output emails
* add Auto-Submitted headers to the job output emails (as cronie, i.e. cron on RedHat)
* added a default path for jobs: /usr/bin:/bin (as Vixie cron)
* ignore not only USER but LOGNAME assigments as well
* added my_unsetenv() and my_setenv_overwrite() to make the direct manipulation (without env_list_t) of env var easier
- no longer try to run a job with execlp("sh", ...) if execl(curshell, ...) fails (as vixie cron)
- improved u_list: realloc() instead of free() followed by a calloc()
- debug_opt is now defined by log.c (instead of fcron.c/fcrontab.c/...)