From nobody Tue Nov 07 19:53:47 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SPzRv2x34z50ByQ; Tue, 7 Nov 2023 19:53:47 +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 4SPzRv21Hmz4YpW; Tue, 7 Nov 2023 19:53:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699386827; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XKI6ZWVrEbhF48v7b6+oxPigMiJ2DAT+gKnAQhTFGY8=; b=fU9g9nDd78apcCzTB0m4Rdx/TgPO7B5hTeSspdzfWzJGiZ6pU/9UcXVJ+sZZdP6yYXx7xn wPDE9t5Guli+l6bxn+7F4OzgF6JTVHY+APzIO2sh09z8mYbJQvC7HsDZExk77IwsKJP6x4 apGzas8Scuuk7EVF51rff8VmX/cskh2PPhWbBzb6iLxbw6DDfNtVOemCJpVmHsnNln4fkp Asn9utqOBleA8hfnf+7mdMi/0/inpWtzEQPUJLo17qsb7Ss/T8TQB0SZh22HyyVK4iHIld PXCmU+aSI5VOKlHR/dQtfaeDjw+cOCoDD/b93d0KRrGgMaYQTwWIfu7VdH09AA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1699386827; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XKI6ZWVrEbhF48v7b6+oxPigMiJ2DAT+gKnAQhTFGY8=; b=G/WaB49MLaeqFIgQzxxZm4slcr9YVXO8TMztHeRE2zMEiy3Ubx7ehHgqoL9+TSwlotbJZE z297plZ80+GqciflJBin6TBSFaqgBkj2hdNzgBq8V2swFTZRMPu64Amk8W11E2dWKLeTxV X8cEQhaebicl/vT2YLpaQqPNu+tprJGXWP2tyHRT7jjXGVbt1nDA3+b3qovuw5+3LEMMF9 KLsbwVqyCLVI4s/2wGEmif++XrQjEATz28ZfeZwxUspV1Du/qwK5NBRoM+l9jyoE6ZATX5 ig7Y2aYN7N7eBOawfivKK1sB0jlPelqlonhMgccWQbBiuklU8C2eRjuC4t10qg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1699386827; a=rsa-sha256; cv=none; b=Sa4t/Jn3Q+aK+rwFymag61IdPdUyJ9UtKGtbKYmAfaZQWhdFbRLFdeWARDvYNHmmOUZLho iRGf8eZk0m5pv60Z9JMfMUrJkfJwdMHouKTivZkRA9FImS295ohzNaYFkqyQ/0Nm0JZ3Pi F5eTTZztTA/FIZUBjaF+SCSoenC48w+01QaNZ25QS2NVgzImpbLu9Sl2cNhsAsErllL1qX YioAofIQA0GPZfN70T/ctIlKh+18BuRd35hCA2MjzhBv3mHsZa+uaZLEsFDUyZHckuRPL1 YHzXUMb4d+QotyFuP3PfLYANfuxOyacq3OZLAMw5TUurWN1RsDYdpwNZ+VPAzQ== 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 4SPzRv144gz13HT; Tue, 7 Nov 2023 19:53:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3A7JrlYe086851; Tue, 7 Nov 2023 19:53:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3A7JrlXG086848; Tue, 7 Nov 2023 19:53:47 GMT (envelope-from git) Date: Tue, 7 Nov 2023 19:53:47 GMT Message-Id: <202311071953.3A7JrlXG086848@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?= Subject: git: f7d16a627efa - main - certctl: Convert line endings before inspecting files. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f7d16a627efa8ba610eb9b8a12dd67b6cdbb2542 Auto-Submitted: auto-generated The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=f7d16a627efa8ba610eb9b8a12dd67b6cdbb2542 commit f7d16a627efa8ba610eb9b8a12dd67b6cdbb2542 Author: Dag-Erling Smørgrav AuthorDate: 2023-11-07 19:52:56 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2023-11-07 19:53:09 +0000 certctl: Convert line endings before inspecting files. This ensures that certificate files or bundles with DOS or Mac line endings are recognized as such and handled identically to those with Unix line endings. PR: 274952 Reviewed by: allanjude Differential Revision: https://reviews.freebsd.org/D42490 --- usr.sbin/certctl/certctl.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/usr.sbin/certctl/certctl.sh b/usr.sbin/certctl/certctl.sh index 2ffa94bc7db7..997a7d835d53 100755 --- a/usr.sbin/certctl/certctl.sh +++ b/usr.sbin/certctl/certctl.sh @@ -71,6 +71,11 @@ cert_files_in() \) 2>/dev/null } +eolcvt() +{ + cat "$@" | tr -s '\r' '\n' +} + do_hash() { local hash @@ -181,7 +186,7 @@ do_scan() IFS="$oldIFS" for CFILE in $(cert_files_in "$@") ; do verbose "Reading $CFILE" - case $(egrep -c '^-+BEGIN CERTIFICATE-+$' "$CFILE") in + case $(eolcvt "$CFILE" | egrep -c '^-+BEGIN CERTIFICATE-+$') in 0) ;; 1) @@ -190,7 +195,7 @@ do_scan() *) verbose "Multiple certificates found, splitting..." SPLITDIR=$(mktemp -d) - egrep '^(---|[0-9A-Za-z/+=]+$)' "$CFILE" | \ + eolcvt "$CFILE" | egrep '^(---|[0-9A-Za-z/+=]+$)' | \ split -p '^-+BEGIN CERTIFICATE-+$' - "$SPLITDIR/x" for CERT in $(find "$SPLITDIR" -type f) ; do "$CFUNC" "$CERT"