From nobody Thu Feb 15 13:59:00 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 4TbGrP2Dxfz53xmv; Thu, 15 Feb 2024 13:59: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 4TbGrP1QmKz46QH; Thu, 15 Feb 2024 13:59:01 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1708005541; 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=r7Nlp3u6Vjxg7nFFKBKuHRvr3exB1YQ9WhFEbGsp1Vw=; b=EWQUuZM6Kkqw4HhGxRshr2/l7hFdhlgYJAIi2iOk/iu7Fc0HBP946GelPpKrg719p72nAe /zYLNuHl5NKH/gBNER1enHwvrz1wo3A27YtZP+cmx73km1F6NGAyK1zFWOar5EgYO7ZH5u oCObwBoFUpeSyt7WF+kYmnkBQHpKkecSjTXjJ3cOyBaF6dyU5P+jkARPadjalFiWYTywQG b7UbBva9qB5pFwfef6SXBjl+dK4okqMxuYeEPakYnJcZpaZ+tRc5SOMxddZ6n6efI6VdB6 nn7oNWLdI5qOnhBOgpOkOuyg2+wB3Bp9abGVdrI6yLUqhKlL38TkZhYDCOoCnA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1708005541; a=rsa-sha256; cv=none; b=JTaDjIFQDRQKkePIpdzScsLDpgjdQAq8wVhg0oHreXoHqkLmpSOKhgcZnSCSUagyAxnem3 1svoTB2pAAVmvI65jhcyi/e7unX5MH/GSXKPtnUuc9XxtD/KUgMkfc1lvj/auXhmAQ6yZG utmqMEjcfQ4HmcdKJaKN8sYlnAa+rX/HfbXexihWT2L0LkeSQkUiLobGKoMbHS3/o+z41H VxwV3dt8nVxMiLbuwRdC7uDeDpVMbVDm+l2jcx9cfXB5JASG4wyoZJ9kIEe8hg6jECRULh yjVqT1YrLPttMpMPBc+KQXdAFB4sZvscci/BcTH/DdbiFwxFDYA+bIkbsWqgew== 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=1708005541; 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=r7Nlp3u6Vjxg7nFFKBKuHRvr3exB1YQ9WhFEbGsp1Vw=; b=iqybFvlM63UOooNDx2dzpJ3LMmBl4QasDSrchaPhk3u6BadzvQhVXDBRHBPc1Sz2Wk+int i0wBKnPtJlsv34jcrAh1Vq7tFNmm/WjXM1V7ixswj59+6wjLHSu/2hs/pK0fL5RGIztgB2 Y+GMEIlE9t+iGcaUj5HueRfhOTlSiPAFp5OsD6LbCKQ/YDmIl221VA6CDbP80YCi/Y8V/H 9FtJbDCguWSaTcpGb1zLaQFVFI5PaSLwm529sracOuFNfxFHXqwnyww/19wSXEsoL4BdDD SHv45nXjmtfnTaRyCIs13CcW3WE0GTcJ+DcXy1ruCXmL5M3lB05EqNJMkNE6Xw== 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 4TbGrP0PjTzkwH; Thu, 15 Feb 2024 13:59:01 +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 41FDx0Dk097150; Thu, 15 Feb 2024 13:59:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 41FDx0uN097147; Thu, 15 Feb 2024 13:59:00 GMT (envelope-from git) Date: Thu, 15 Feb 2024 13:59:00 GMT Message-Id: <202402151359.41FDx0uN097147@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 8d1348f55aed - main - path_test: fix cap_rights_init usage 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8d1348f55aed6873f34f54bc3b275b73ef0ff66d Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=8d1348f55aed6873f34f54bc3b275b73ef0ff66d commit 8d1348f55aed6873f34f54bc3b275b73ef0ff66d Author: Ed Maste AuthorDate: 2024-02-15 00:45:42 +0000 Commit: Ed Maste CommitDate: 2024-02-15 13:58:39 +0000 path_test: fix cap_rights_init usage Capability rights passed to cap_rights_* are not simple bitmaks and cannot be ORed together in general (although it will work for certain subsets of rights). PR: 277057 Fixes: e5e1d9c7b781 ("path_test: Add a test case for...") Sponsored by: The FreeBSD Foundation --- tests/sys/file/path_test.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/sys/file/path_test.c b/tests/sys/file/path_test.c index bd98d7a6955a..911c7c7075f0 100644 --- a/tests/sys/file/path_test.c +++ b/tests/sys/file/path_test.c @@ -235,7 +235,7 @@ ATF_TC_BODY(path_capsicum_empty, tc) /* * CAP_READ and CAP_LOOKUP should be sufficient to open a directory. */ - cap_rights_init(&rights, CAP_READ | CAP_LOOKUP); + cap_rights_init(&rights, CAP_READ, CAP_LOOKUP); ATF_REQUIRE(cap_rights_limit(pathdfd, &rights) == 0); dfd = openat(pathdfd, "", O_DIRECTORY | O_EMPTY_PATH); ATF_REQUIRE(dfd >= 0); @@ -256,7 +256,7 @@ ATF_TC_BODY(path_capsicum_empty, tc) ATF_REQUIRE(fd >= 0); CHECKED_CLOSE(fd); - cap_rights_init(&rights, CAP_READ | CAP_LOOKUP | CAP_WRITE); + cap_rights_init(&rights, CAP_READ, CAP_LOOKUP, CAP_WRITE); ATF_REQUIRE(cap_rights_limit(pathfd, &rights) == 0); fd = openat(pathfd, "", O_RDWR | O_EMPTY_PATH | O_APPEND); ATF_REQUIRE(fd >= 0); @@ -265,7 +265,7 @@ ATF_TC_BODY(path_capsicum_empty, tc) /* * CAP_SEEK is needed to open a file for writing without O_APPEND. */ - cap_rights_init(&rights, CAP_READ | CAP_LOOKUP | CAP_WRITE); + cap_rights_init(&rights, CAP_READ, CAP_LOOKUP, CAP_WRITE); ATF_REQUIRE(cap_rights_limit(pathfd, &rights) == 0); fd = openat(pathfd, "", O_RDWR | O_EMPTY_PATH); ATF_REQUIRE_ERRNO(ENOTCAPABLE, fd == -1);