From owner-dev-commits-src-branches@freebsd.org Sat Jun 5 23:52:01 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E000C64C37E; Sat, 5 Jun 2021 23:52:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FyGdF5rvrz4nCj; Sat, 5 Jun 2021 23:52:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B1C4319B41; Sat, 5 Jun 2021 23:52:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 155Nq1kR091282; Sat, 5 Jun 2021 23:52:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 155Nq1AH091281; Sat, 5 Jun 2021 23:52:01 GMT (envelope-from git) Date: Sat, 5 Jun 2021 23:52:01 GMT Message-Id: <202106052352.155Nq1AH091281@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Oleksandr Tymoshenko Subject: git: c69de0206511 - stable/13 - cron: consume blanks in system crontabs before options MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gonzo X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c69de0206511636ebe28ac226dce74f7b204735b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Jun 2021 23:52:01 -0000 The branch stable/13 has been updated by gonzo: URL: https://cgit.FreeBSD.org/src/commit/?id=c69de0206511636ebe28ac226dce74f7b204735b commit c69de0206511636ebe28ac226dce74f7b204735b Author: Oleksandr Tymoshenko AuthorDate: 2021-03-04 07:23:31 +0000 Commit: Oleksandr Tymoshenko CommitDate: 2021-06-05 22:49:45 +0000 cron: consume blanks in system crontabs before options On system crontabs, multiple blanks are not being consumed after reading the username. This change adds blank consumption before parsing any -[qn] options. Without this change, an entry like: * * * * * username -n true # Two spaces between username and option. will fail, as the shell will try to execute (' -n true'), while an entry like: * * * * * username -n true # One space between username and option. works as expected (executes 'true'). For user crontabs, this is not an issue as the preceding (day of week or @shortcut) processing consumes any leading whitespace. PR: 253699 Submitted by: Eric A. Borisch MFC after: 1 week (cherry picked from commit 37cd6c20dbcf251e38d6dfb9d3e02022941f6fc7) --- usr.sbin/cron/lib/entry.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/usr.sbin/cron/lib/entry.c b/usr.sbin/cron/lib/entry.c index 66ead885bea8..2693c9c8d07a 100644 --- a/usr.sbin/cron/lib/entry.c +++ b/usr.sbin/cron/lib/entry.c @@ -315,6 +315,9 @@ load_entry(file, error_func, pw, envp) goto eof; } + /* need to have consumed blanks when checking options below */ + Skip_Blanks(ch, file) + unget_char(ch, file); #ifdef LOGIN_CAP if ((s = strrchr(username, '/')) != NULL) { *s = '\0';