diff options
author | ngie <ngie@FreeBSD.org> | 2017-06-22 07:54:12 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2017-06-22 07:54:12 +0000 |
commit | 5fe9a66bb192463d3c8a35916158d119f3c351ce (patch) | |
tree | 32eee004a027704afc8390e960ca70dd1970fef2 /usr.sbin/cron | |
parent | 3253eff542c258dcfa4669d011c4df219400a829 (diff) | |
download | FreeBSD-src-5fe9a66bb192463d3c8a35916158d119f3c351ce.zip FreeBSD-src-5fe9a66bb192463d3c8a35916158d119f3c351ce.tar.gz |
Revert r320222,r320223,r320224
The committed changes (reverted after this commit) break POLA on
a stable branch.
Requested by: jhb
Diffstat (limited to 'usr.sbin/cron')
-rw-r--r-- | usr.sbin/cron/cron/cron.8 | 8 | ||||
-rw-r--r-- | usr.sbin/cron/cron/cron.h | 2 | ||||
-rw-r--r-- | usr.sbin/cron/cron/database.c | 49 | ||||
-rw-r--r-- | usr.sbin/cron/cron/pathnames.h | 2 | ||||
-rw-r--r-- | usr.sbin/cron/lib/misc.c | 6 |
5 files changed, 11 insertions, 56 deletions
diff --git a/usr.sbin/cron/cron/cron.8 b/usr.sbin/cron/cron/cron.8 index d7f34cf..5d5a8d9 100644 --- a/usr.sbin/cron/cron/cron.8 +++ b/usr.sbin/cron/cron/cron.8 @@ -17,7 +17,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 31, 2016 +.Dd June 29, 2008 .Dt CRON 8 .Os .Sh NAME @@ -52,11 +52,7 @@ The .Nm utility also searches for .Pa /etc/crontab -and files in -.Pa /etc/cron.d -and -.Pa /usr/local/etc/cron.d -which are in a different format (see +which is in a different format (see .Xr crontab 5 ) . .Pp The diff --git a/usr.sbin/cron/cron/cron.h b/usr.sbin/cron/cron/cron.h index a6810be..60b2a90 100644 --- a/usr.sbin/cron/cron/cron.h +++ b/usr.sbin/cron/cron/cron.h @@ -218,7 +218,7 @@ void set_cron_uid(void), unget_char(int, FILE *), free_entry(entry *), skip_comments(FILE *), - log_it(char *, int, char *, const char *), + log_it(char *, int, char *, char *), log_close(void); int job_runqueue(void), diff --git a/usr.sbin/cron/cron/database.c b/usr.sbin/cron/cron/database.c index 2b0c67b..7a44d14 100644 --- a/usr.sbin/cron/cron/database.c +++ b/usr.sbin/cron/cron/database.c @@ -44,19 +44,10 @@ load_database(old_db) { DIR *dir; struct stat statbuf; - struct stat syscron_stat, st; - time_t maxmtime; + struct stat syscron_stat; DIR_T *dp; cron_db new_db; user *u, *nu; - struct { - const char *name; - struct stat st; - } syscrontabs [] = { - { SYSCRONTABS }, - { LOCALSYSCRONTABS } - }; - int i; Debug(DLOAD, ("[%d] load_database()\n", getpid())) @@ -74,16 +65,6 @@ load_database(old_db) if (stat(SYSCRONTAB, &syscron_stat) < OK) syscron_stat.st_mtime = 0; - maxmtime = TMAX(statbuf.st_mtime, syscron_stat.st_mtime); - - for (i = 0; i < nitems(syscrontabs); i++) { - if (stat(syscrontabs[i].name, &syscrontabs[i].st) != -1) { - maxmtime = TMAX(syscrontabs[i].st.st_mtime, maxmtime); - } else { - syscrontabs[i].st.st_mtime = 0; - } - } - /* if spooldir's mtime has not changed, we don't need to fiddle with * the database. * @@ -91,7 +72,7 @@ load_database(old_db) * so is guaranteed to be different than the stat() mtime the first * time this function is called. */ - if (old_db->mtime == maxmtime) { + if (old_db->mtime == TMAX(statbuf.st_mtime, syscron_stat.st_mtime)) { Debug(DLOAD, ("[%d] spool dir mtime unch, no load needed.\n", getpid())) return; @@ -102,7 +83,7 @@ load_database(old_db) * actually changed. Whatever is left in the old database when * we're done is chaff -- crontabs that disappeared. */ - new_db.mtime = maxmtime; + new_db.mtime = TMAX(statbuf.st_mtime, syscron_stat.st_mtime); new_db.head = new_db.tail = NULL; if (syscron_stat.st_mtime) { @@ -111,30 +92,6 @@ load_database(old_db) &new_db, old_db); } - for (i = 0; i < nitems(syscrontabs); i++) { - char tabname[MAXPATHLEN]; - if (syscrontabs[i].st.st_mtime == 0) - continue; - if (!(dir = opendir(syscrontabs[i].name))) { - log_it("CRON", getpid(), "OPENDIR FAILED", - syscrontabs[i].name); - (void) exit(ERROR_EXIT); - } - - while (NULL != (dp = readdir(dir))) { - if (dp->d_name[0] == '.') - continue; - if (fstatat(dirfd(dir), dp->d_name, &st, 0) == 0 && - !S_ISREG(st.st_mode)) - continue; - snprintf(tabname, sizeof(tabname), "%s/%s", - syscrontabs[i].name, dp->d_name); - process_crontab("root", SYS_NAME, tabname, - &syscrontabs[i].st, &new_db, old_db); - } - closedir(dir); - } - /* we used to keep this dir open all the time, for the sake of * efficiency. however, we need to close it in every fork, and * we fork a lot more often than the mtime of the dir changes. diff --git a/usr.sbin/cron/cron/pathnames.h b/usr.sbin/cron/cron/pathnames.h index fe3ebf5..ba91bfd 100644 --- a/usr.sbin/cron/cron/pathnames.h +++ b/usr.sbin/cron/cron/pathnames.h @@ -62,8 +62,6 @@ /* 4.3BSD-style crontab */ #define SYSCRONTAB "/etc/crontab" -#define SYSCRONTABS "/etc/cron.d" -#define LOCALSYSCRONTABS "/usr/local/etc/cron.d" /* what editor to use if no EDITOR or VISUAL * environment variable specified. diff --git a/usr.sbin/cron/lib/misc.c b/usr.sbin/cron/lib/misc.c index 6a0b8ac..afed07f 100644 --- a/usr.sbin/cron/lib/misc.c +++ b/usr.sbin/cron/lib/misc.c @@ -385,7 +385,11 @@ out: if (allow) void -log_it(char *username, int xpid, char *event, const char *detail) +log_it(username, xpid, event, detail) + char *username; + int xpid; + char *event; + char *detail; { #if defined(LOG_FILE) || DEBUGGING PID_T pid = xpid; |