diff options
author | ghelmer <ghelmer@FreeBSD.org> | 2000-03-13 19:21:17 +0000 |
---|---|---|
committer | ghelmer <ghelmer@FreeBSD.org> | 2000-03-13 19:21:17 +0000 |
commit | 7381ebe4fec16008490dd2f5526325c551e0b713 (patch) | |
tree | 02f0f27777abac813ade89196e7c42ac594bfb62 /usr.sbin/cron | |
parent | 3c6de034ba7c4287ddac1e6cec18922195da9fe8 (diff) | |
download | FreeBSD-src-7381ebe4fec16008490dd2f5526325c551e0b713.zip FreeBSD-src-7381ebe4fec16008490dd2f5526325c551e0b713.tar.gz |
Fix parsing of commands after @ keywords (@hourly, @daily, etc.).
Fix setting of "hour" bitmap when @hourly keyword is specified.
MFC candidate after 4.0-RELEASE.
Problem-found-by: Sheldon Hearn <sheldonh@uunet.co.za>
Diffstat (limited to 'usr.sbin/cron')
-rw-r--r-- | usr.sbin/cron/lib/entry.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/usr.sbin/cron/lib/entry.c b/usr.sbin/cron/lib/entry.c index 51c1a0c..9150a0d 100644 --- a/usr.sbin/cron/lib/entry.c +++ b/usr.sbin/cron/lib/entry.c @@ -135,36 +135,43 @@ load_entry(file, error_func, pw, envp) * anymore. too much for my overloaded brain. (vix, jan90) * HINT */ + Debug(DPARS, ("load_entry()...about to test shortcuts\n")) ch = get_string(cmd, MAX_COMMAND, file, " \t\n"); if (!strcmp("reboot", cmd)) { + Debug(DPARS, ("load_entry()...reboot shortcut\n")) e->flags |= WHEN_REBOOT; } else if (!strcmp("yearly", cmd) || !strcmp("annually", cmd)){ + Debug(DPARS, ("load_entry()...yearly shortcut\n")) bit_set(e->minute, 0); bit_set(e->hour, 0); bit_set(e->dom, 0); bit_set(e->month, 0); bit_nset(e->dow, 0, (LAST_DOW-FIRST_DOW+1)); } else if (!strcmp("monthly", cmd)) { + Debug(DPARS, ("load_entry()...monthly shortcut\n")) bit_set(e->minute, 0); bit_set(e->hour, 0); bit_set(e->dom, 0); bit_nset(e->month, 0, (LAST_MONTH-FIRST_MONTH+1)); bit_nset(e->dow, 0, (LAST_DOW-FIRST_DOW+1)); } else if (!strcmp("weekly", cmd)) { + Debug(DPARS, ("load_entry()...weekly shortcut\n")) bit_set(e->minute, 0); bit_set(e->hour, 0); bit_nset(e->dom, 0, (LAST_DOM-FIRST_DOM+1)); bit_nset(e->month, 0, (LAST_MONTH-FIRST_MONTH+1)); bit_set(e->dow, 0); } else if (!strcmp("daily", cmd) || !strcmp("midnight", cmd)) { + Debug(DPARS, ("load_entry()...daily shortcut\n")) bit_set(e->minute, 0); bit_set(e->hour, 0); bit_nset(e->dom, 0, (LAST_DOM-FIRST_DOM+1)); bit_nset(e->month, 0, (LAST_MONTH-FIRST_MONTH+1)); bit_nset(e->dow, 0, (LAST_DOW-FIRST_DOW+1)); } else if (!strcmp("hourly", cmd)) { + Debug(DPARS, ("load_entry()...hourly shortcut\n")) bit_set(e->minute, 0); - bit_set(e->hour, (LAST_HOUR-FIRST_HOUR+1)); + bit_nset(e->hour, 0, (LAST_HOUR-FIRST_HOUR+1)); bit_nset(e->dom, 0, (LAST_DOM-FIRST_DOM+1)); bit_nset(e->month, 0, (LAST_MONTH-FIRST_MONTH+1)); bit_nset(e->dow, 0, (LAST_DOW-FIRST_DOW+1)); @@ -172,6 +179,14 @@ load_entry(file, error_func, pw, envp) ecode = e_timespec; goto eof; } + /* Advance past whitespace between shortcut and + * username/command. + */ + Skip_Blanks(ch, file); + if (ch == EOF) { + ecode = e_cmd; + goto eof; + } } else { Debug(DPARS, ("load_entry()...about to parse numerics\n")) |