summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2023-07-19 21:26:03 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2023-07-19 21:26:03 +0000
commitff7337ca884e20a2123481b4826f6b8cf989d3f9 (patch)
tree79f66d7778040b1350a89593f577ffface4b9569
parent34995a2046449ac2bf017e2d93f35cd25d9da50c (diff)
Fix skipping of white space after the username in /etc/crontab.
Only a single white space character was consumed, we should be consuming all white space between fields. This change makes things consistent with how lines without a username are parsed. OK deraadt@ sthen@
-rw-r--r--usr.sbin/cron/entry.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/usr.sbin/cron/entry.c b/usr.sbin/cron/entry.c
index 2ac23e7f0db..536085410cc 100644
--- a/usr.sbin/cron/entry.c
+++ b/usr.sbin/cron/entry.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: entry.c,v 1.58 2023/06/13 15:36:21 millert Exp $ */
+/* $OpenBSD: entry.c,v 1.59 2023/07/19 21:26:02 millert Exp $ */
/*
* Copyright 1988,1990,1993,1994 by Paul Vixie
@@ -275,18 +275,17 @@ load_entry(FILE *file, void (*error_func)(const char *), struct passwd *pw,
goto eof;
}
- /* ch is the first character of a command, or a username */
- unget_char(ch, file);
-
if (!pw) {
char *username = cmd; /* temp buffer */
+ unget_char(ch, file);
ch = get_string(username, MAX_COMMAND, file, " \t\n");
if (ch == EOF || ch == '\n' || ch == '*') {
ecode = e_cmd;
goto eof;
}
+ Skip_Blanks(ch, file)
pw = getpwnam(username);
if (pw == NULL) {
@@ -356,7 +355,6 @@ load_entry(FILE *file, void (*error_func)(const char *), struct passwd *pw,
/* An optional series of '-'-prefixed flags in getopt style can
* occur before the command.
*/
- ch = get_char(file);
while (ch == '-') {
int flags = 0, loop = 1;