From: Thibault Godouet Date: Tue, 19 Jul 2005 13:08:20 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: ver2_9_7~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=417ff236054f40f3f7d5fa923de88f465fcd9641;p=thirdparty%2Ffcron.git *** empty log message *** --- diff --git a/database.c b/database.c index 408bc38..e637f41 100644 --- a/database.c +++ b/database.c @@ -21,7 +21,7 @@ * `LICENSE' that comes with the fcron source distribution. */ - /* $Id: database.c,v 1.76 2005-06-11 22:52:02 thib Exp $ */ + /* $Id: database.c,v 1.77 2005-07-19 13:08:20 thib Exp $ */ #include "fcron.h" @@ -40,6 +40,11 @@ void run_lavg_job(int i); void run_queue_job(cl_t *line); void resize_exe_array(void); + +#ifndef HAVE_SETENV +char env_tz[PATH_LEN]; +#endif + void test_jobs(void) /* determine which jobs need to be run, and run them. */ @@ -81,7 +86,15 @@ switch_timezone(const char *orig_tz, const char* dest_tz) char *current_tz = getenv("TZ"); if ( dest_tz != NULL && (current_tz == NULL || strcmp(dest_tz, current_tz) != 0)) { - setenv("TZ", dest_tz, 1); +#ifdef HAVE_SETENV + if ( setenv("TZ", dest_tz, 1) < 0 ) + error_e("could not set env var TZ to %s", dest_tz); +#else + snprintf(env_tz, sizeof(env_tz) - 1, "TZ=%s", dest_tz); + env_tz[sizeof(env_tz)-1] = '\0'; + if ( putenv(env_tz) < 0 ) + error_e("could not set env var TZ to %s", dest_tz); +#endif return 1; } else @@ -93,10 +106,26 @@ switch_back_timezone(const char *orig_tz) /* if orig_tz is NULL, unsets TZ * otherwise, sets TZ to orig_tz */ { - if ( orig_tz == NULL) + if ( orig_tz == NULL) { +#ifdef HAVE_SETENV unsetenv("TZ"); - else - setenv("TZ", orig_tz, 1); +#else + env_tz[0] = '\0'; + if ( putenv(env_tz) < 0 ) + error_e("could not flush env var TZ"); +#endif + } + else { +#ifdef HAVE_SETENV + if ( setenv("TZ", orig_tz, 1) < 0 ) + error_e("could not set env var TZ to %s", orig_tz); +#else + snprintf(env_tz, sizeof(env_tz) - 1, "TZ=%s", orig_tz); + env_tz[sizeof(env_tz)-1] = '\0'; + if ( putenv(env_tz) < 0 ) + error_e("could not set env var TZ to %s", orig_tz); +#endif + } } diff --git a/doc/en/changes.sgml b/doc/en/changes.sgml index 18be42c..ff32f54 100644 --- a/doc/en/changes.sgml +++ b/doc/en/changes.sgml @@ -8,45 +8,48 @@ Foundation. A copy of the license is included in gfdl.sgml. --> - + Changes From version 2.9.6 to 2.9.7 - - Added time zone support (option timezone). - - - Better support FreeBSD's users and groups modifications in fcron's install scripts. - - Fixed a bug which used to make fcron send empty mails on very recent systems. + Added time zone support (option timezone). - Added some casts in fileconf.c and save.c (to avoid some warnings when compiling on HP-UX). + Better support FreeBSD's users and groups modifications in + fcron's install scripts. + + + Fixed a bug which used to make fcron send empty mails on very + recent systems. + + + Added some casts in fileconf.c and save.c (to avoid some + warnings when compiling on HP-UX). From version 2.9.5.1 to 2.9.6 - fixed the bug which made jobs run an hour too early after - a daylight saving time change. - Added detailed explanations about when a job will run - when there is a DST change in the FAQ. + fixed the bug which made jobs run an hour too early after a + daylight saving time change. + Added detailed explanations about when a job will run when + there is a DST change in the FAQ. - fixed fcrondyn's "Unknown command" bug on x86_64 - (thanks go to Georgi Georgiev). + fixed fcrondyn's "Unknown command" bug on x86_64 (thanks go to + Georgi Georgiev). - made fcrontab behave better when there is no space left - in the spool directory (used to truncate the fcrontab source file). + made fcrontab behave better when there is no space left in the + spool directory (used to truncate the fcrontab source file). - Added a script, check_system_crontabs, to emulate Vixie cron's + Added a script, check_system_crontabs, to emulate Vixie cron's behavior about /etc/crontab and /etc/cron.d. Please have a look at the top of script/check_system_crontabs for more information. @@ -55,22 +58,24 @@ A copy of the license is included in gfdl.sgml. HP-UX support (needs more tests). - bug fix : restore umask even if fcron runs unprivileged. + bug fix : restore umask even if fcron runs + unprivileged. From version 2.9.5 to 2.9.5.1 - Fixed serious security vulnerabilities in fcronsighup, - and improved fcronsighup's overall security (drop privileges, - better check user inputs, etc). + Fixed serious security vulnerabilities in fcronsighup, and + improved fcronsighup's overall security (drop privileges, better + check user inputs, etc). Fixed several typos in the doc. - Updated debian package scripts (patch from debian maintainer). + Updated debian package scripts (patch from debian + maintainer). @@ -89,45 +94,49 @@ A copy of the license is included in gfdl.sgml. Merged debian/ dir for debian package. - Mail reports : put the same username in the To: field than - the one we give as recipient to the MTA. mailto can now also - be a fully qualified email address. + Mail reports : put the same username in the To: field than the + one we give as recipient to the MTA. mailto can now also be a + fully qualified email address. - changed a log message : a job which has ended without error - is reported has "completed" (which is more appropriated than "terminated"). + changed a log message : a job which has ended without error is + reported has "completed" (which is more appropriated than + "terminated"). Internal changes in log.c: code is more segmented, and code - has been added to be able to send log message to fcrondyn. Syslog - messages are now never longer than MAX_MSG (even with string from - strerror()). + has been added to be able to send log message to fcrondyn. Syslog + messages are now never longer than MAX_MSG (even with string from + strerror()). - Fixed a bug which happened on Daylight Saving Time change - on some systems. It would make fcron run into a nasty infinite loop. - Added a sanity check in set_nextexe() to avoid such things. + Fixed a bug which happened on Daylight Saving Time change on + some systems. It would make fcron run into a nasty infinite loop. + Added a sanity check in set_nextexe() to avoid such + things. - Fixed a crash bug: in 2.9.4, if a user run ls_exeq when - a job is running and has been removed from its fcrontab, - it makes fcron crash. + Fixed a crash bug: in 2.9.4, if a user run ls_exeq when a job + is running and has been removed from its fcrontab, it makes fcron + crash. - Fixed a small bug : scripts were supposing perl was in /usr/bin. + Fixed a small bug : scripts were supposing perl was in + /usr/bin. - Fixed a bug which caused the pid of a child process - to be incorrectly read + Fixed a bug which caused the pid of a child process to be + incorrectly read fixed memory leak: some strings returned by log.c:make_msg() weren't always free()d. - bug fix: fcrondyn commands renice and kill used not to handle correctly - the case where a job has several entries in exeq (exesev jobs). + bug fix: fcrondyn commands renice and kill used not to handle + correctly the case where a job has several entries in exeq + (exesev jobs). @@ -135,44 +144,44 @@ A copy of the license is included in gfdl.sgml. From version 2.9.3 to 2.9.4 Merged support for SE Linux (patch from Russell Coker : thanks - !) + !) Work on the documentation (fixed spelling mistakes, tried to - make things clearer in fcrontab.5) (thanks Bill Wohler for your help - !) + make things clearer in fcrontab.5) (thanks Bill Wohler for your + help !) Changed the subject line of mail reports : it now contains the - subject line, and is very similar to vixie cron's one. + subject line, and is very similar to vixie cron's one. Added a sum-up at the end of ./configure. bug fix : "makewhatis" bug is fixed -- at last ! - In fact, the problems encountered were due to an abusively ignored - signal SIGPIPE. + In fact, the problems encountered were due to an abusively + ignored signal SIGPIPE. bug fix : possible crash of fcron when trying to save a file - if there was no space left on device. + if there was no space left on device. bug fix : we don't consider '-' and '_' as word delimiters for - a username before the command anymore, since many programs have one - of these characters in their name. + a username before the command anymore, since many programs have + one of these characters in their name. bug fix : option first was broken in fcron 2.9.3. fixed a little typo in an error message - (could->couldn't) + (could->couldn't) - bug fix : do not ignore the last line of a fcrontab if there is no - \n before the end of file. + bug fix : do not ignore the last line of a fcrontab if there + is no \n before the end of file. fixed compile on SunOS 5.9 . @@ -181,7 +190,8 @@ A copy of the license is included in gfdl.sgml. Fcron now compiles on MacOS X. - added some $srcdir to be able (again ;) ) to run configure from another directory. + added some $srcdir to be able (again ;) ) to run configure + from another directory. Perf improvement : use buffer for i/o in run_job(). @@ -218,7 +228,7 @@ A copy of the license is included in gfdl.sgml. Added fcron's option -q to control the lavg and serial queue - sizes. + sizes. @@ -252,11 +262,11 @@ A copy of the license is included in gfdl.sgml. fcrondyn's ls_lavgq, ls_serialq and ls_exeq are now - functional. + functional. mailto can now be set to a non-real user (for ex., an - alias). + alias). fcron now calls shutdown() when a connection from fcrondyn is @@ -265,7 +275,7 @@ A copy of the license is included in gfdl.sgml. use open() instead of fopen() to write files, for more - security. + security. fcrontab sets euid=uid before running the editor. This is @@ -273,7 +283,7 @@ A copy of the license is included in gfdl.sgml. bug fix : using DESTDIR with make did not work with the - doc. + doc. Code clean : changed macros to make parameters clearly @@ -338,9 +348,9 @@ A copy of the license is included in gfdl.sgml. All the documentation has been ported to SGML DocBook. It results on a much better HTML version, which I recommand - you use. It is installed by default in fcron documentation directory - (for instance, on my system : - /usr/share/doc/fcron-X.X.X/). + you use. It is installed by default in fcron documentation + directory (for instance, on my system : + /usr/share/doc/fcron-X.X.X/). Fcrontab.5 has been updated and improved. Some examples have @@ -680,11 +690,11 @@ A copy of the license is included in gfdl.sgml. From version 0.9.3 to 0.9.4 security improvement : after the (horrible) root exploit found - in version 0.9.3, I decided to improve fcron/fcrontab's - security. I've included some strong (I hope :)) ) tests in fcron - to ensure that only root can run commands as superuser and use - option runas. Even an corrupted fcrontab should not be able to - get root's privileges. Pretty reassuring, isn't it ? + in version 0.9.3, I decided to improve fcron/fcrontab's security. + I've included some strong (I hope :)) ) tests in fcron to ensure + that only root can run commands as superuser and use option + runas. Even an corrupted fcrontab should not be able to get + root's privileges. Pretty reassuring, isn't it ? runfreq(1) lines have been replaced and extended by a new kind @@ -711,7 +721,7 @@ A copy of the license is included in gfdl.sgml. bug fixed : a tmp file was not removed after a "fcron --z" + -z" bug fixed in fcrontab : an expression of the form "start-stop" @@ -826,15 +836,14 @@ A copy of the license is included in gfdl.sgml. Support of options "lavg*", in order to run a job under a - specific 1, 5 and/or 15 minutes system load average - value(s). When the job should be run, it is placed in a specific - queue and the load average is checked regularly until the right - value(s) is/are got. The options "lavgor" and "lavgand" permits - users to tell fcron if they prefer to perform a logic OR or AND - between the 1, 5 and 15 load average values. The option "until" - can be use to force the execution of a job after a determined - timeout if the right conditions to run the job are not - filled. + specific 1, 5 and/or 15 minutes system load average value(s). + When the job should be run, it is placed in a specific queue and + the load average is checked regularly until the right value(s) + is/are got. The options "lavgor" and "lavgand" permits users to + tell fcron if they prefer to perform a logic OR or AND between + the 1, 5 and 15 load average values. The option "until" can be + use to force the execution of a job after a determined timeout if + the right conditions to run the job are not filled. fcron now uses putenv() in place of setenv() (setenv() is not @@ -996,3 +1005,4 @@ mode: sgml sgml-parent-document:("fcron-doc.sgml" "book" "chapter" "sect1" "") End: --> + \ No newline at end of file