From: millert Date: Wed, 19 Jul 2023 21:26:02 +0000 (+0000) Subject: Fix skipping of white space after the username in /etc/crontab. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=8787d0beaab49a31e48ed312919297905d7ac0ac;p=openbsd 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@ --- 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;