From nobody Tue Apr 30 14:56:30 2024 X-Original-To: dev-commits-src-main@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 4VTNZ70LfHz5JMsq; Tue, 30 Apr 2024 14:56:31 +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 4VTNZ66lRPz4hPX; Tue, 30 Apr 2024 14:56:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714488990; 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=Sv92CxI1Dlsexp+pIE9OVxUzuXWFMhM87Xf8ValrMkM=; b=DBGIPAQV7tUw1eSpmyM+1sqvXwQJUIOMVLMfVrl8qvUBe8+sNPV/UtmyH2KHodowDP/QBC 3HwipkFZJyaZy0rGV5qD7I3P5uSoqS87l1qehcbhHCnq3MC7n7o9+ZRAEaSjHqjIPGzkcY kQOMb1NhF5AXOZJYVB9vd7uqy/7qwHInm7SbW4+B7PsphST34iaMkUROL4KpFCv2IAuWvS Tm3QzPUUtEhUaNmdjm/jUoL7PgCf0wKU6bQm7vnj2dqyS9a3T/Qg96i/lA2ABCrDVFXk0Z uz/l7wAc3Wjzo6tom3WJnrILow9WGlE/sj33FKcx54w0xX+2BUIMBFPITExG0Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1714488990; a=rsa-sha256; cv=none; b=N8M5xxJb8t7DaPjUeqPmZNlgLqydCf+TNapr5sFePd0z8w3fFxfjS4nOcTP7E8t01MjBgG i8J2DAnJ0lGdYmZH48GTuxOtCfbDvWUbKuxFjvfhiDrT+bry5MZAjRs3zS1m261ZI75WPo Zq7hJkrLR895V0AwIntUSdLYrzwLI8J+WC5qw030iiOb8HMNNCxjJF8MgCg5pgpczHdIRc RqAsfruDoowxKXERJeMWIxqlc9k9M2kK1j4SHecPKcPp1cUFDdCqI99vOcCUw/OsJedd2i rmMWC8LCoJFECLxvJHZ3GMwDuEFq2t1xotSGPQKsuFm/ZW8KEYFbzmkmR+ctFg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1714488990; 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=Sv92CxI1Dlsexp+pIE9OVxUzuXWFMhM87Xf8ValrMkM=; b=TYNQwZBqI1soSBolJiKQT4SB+I5P7RWUwVpCVba7zBBoYH7o7hCbX6AH0IgeHcKw5L+zDy AgSzew8n9ikd4Y+U9cfOjp+a9Q8plc7STpgfKhnYtE15YGV7es7DbxfaTN0/8XAdwJdYfq ygtt1NYtl01UJMynZ3QvYobHXU4PU+TmR6d6sq4CKA8cuAX/ZWrUQqBRDo7cnVexXPhw6r MTJvB+XFs+RUgQyD4uTPsfXqxH9Z3+13PsAzc6iYSgf4J5/N1TDkbBDU5E9DVI1QbHvxmQ xYhTEefJ5gEGliiazpsf7XxFs7z0Rg+vx21369rgdknpaj59bZLCHp7QMLQu9w== 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 4VTNZ66Ly2zf5C; Tue, 30 Apr 2024 14:56:30 +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 43UEuUhO051122; Tue, 30 Apr 2024 14:56:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43UEuUcE051119; Tue, 30 Apr 2024 14:56:30 GMT (envelope-from git) Date: Tue, 30 Apr 2024 14:56:30 GMT Message-Id: <202404301456.43UEuUcE051119@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: 21b5829d28b1 - main - tftpd: Untangle a conditional. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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: 21b5829d28b1e02e9f30bfa439238c382dd19114 Auto-Submitted: auto-generated The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=21b5829d28b1e02e9f30bfa439238c382dd19114 commit 21b5829d28b1e02e9f30bfa439238c382dd19114 Author: Dag-Erling Smørgrav AuthorDate: 2024-04-30 14:56:10 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2024-04-30 14:56:17 +0000 tftpd: Untangle a conditional. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D45026 --- libexec/tftpd/tftpd.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libexec/tftpd/tftpd.c b/libexec/tftpd/tftpd.c index 13f53024b147..c832097e0ba0 100644 --- a/libexec/tftpd/tftpd.c +++ b/libexec/tftpd/tftpd.c @@ -687,10 +687,11 @@ validate_access(int peer, char **filep, int mode) * it's a /. */ for (dirp = dirs; dirp->name != NULL; dirp++) { - if (dirp->len == 1 || - (!strncmp(filename, dirp->name, dirp->len) && - filename[dirp->len] == '/')) - break; + if (dirp->len == 1) + break; + if (strncmp(filename, dirp->name, dirp->len) == 0 && + filename[dirp->len] == '/') + break; } /* If directory list is empty, allow access to any file */ if (dirp->name == NULL && dirp != dirs)