Date: Fri, 22 Mar 2024 13:33:10 GMT From: Ed Maste <emaste@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: be83aa2a01b3 - stable/14 - libcasper: fix cap_rights_init usage Message-ID: <202403221333.42MDXACM002913@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=be83aa2a01b35f9e7aa94a3d45a851305fa22c83 commit be83aa2a01b35f9e7aa94a3d45a851305fa22c83 Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2024-02-15 00:42:48 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2024-03-22 13:30:32 +0000 libcasper: 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: faaf43b2a750 ("fileargs: add tests") Sponsored by: The FreeBSD Foundation (cherry picked from commit 3733d82c4deb49035a39e18744085d1e3e9b8dc5) --- .../services/cap_fileargs/tests/fileargs_test.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/libcasper/services/cap_fileargs/tests/fileargs_test.c b/lib/libcasper/services/cap_fileargs/tests/fileargs_test.c index 4df43f183735..dce499c8b7c3 100644 --- a/lib/libcasper/services/cap_fileargs/tests/fileargs_test.c +++ b/lib/libcasper/services/cap_fileargs/tests/fileargs_test.c @@ -292,7 +292,7 @@ ATF_TC_BODY(fileargs__open_read, tc) prepare_files(MAX_FILES, true); - cap_rights_init(&rights, CAP_READ | CAP_FCNTL); + cap_rights_init(&rights, CAP_READ, CAP_FCNTL); cap_rights_init(&norights, CAP_WRITE); fa = fileargs_init(MAX_FILES, files, O_RDONLY, 0, &rights, FA_OPEN); @@ -339,7 +339,7 @@ ATF_TC_BODY(fileargs__open_write, tc) prepare_files(MAX_FILES, true); - cap_rights_init(&rights, CAP_WRITE | CAP_FCNTL); + cap_rights_init(&rights, CAP_WRITE, CAP_FCNTL); cap_rights_init(&norights, CAP_READ); fa = fileargs_init(MAX_FILES, files, O_WRONLY, 0, &rights, FA_OPEN); @@ -386,7 +386,7 @@ ATF_TC_BODY(fileargs__open_create, tc) prepare_files(MAX_FILES, false); - cap_rights_init(&rights, CAP_WRITE | CAP_FCNTL | CAP_READ); + cap_rights_init(&rights, CAP_WRITE, CAP_FCNTL, CAP_READ); cap_rights_init(&norights, CAP_FCHMOD); fa = fileargs_init(MAX_FILES, files, O_RDWR | O_CREAT, 666, &rights, FA_OPEN); @@ -467,7 +467,7 @@ ATF_TC_BODY(fileargs__fopen_read, tc) prepare_files(MAX_FILES, true); - cap_rights_init(&rights, CAP_READ | CAP_FCNTL); + cap_rights_init(&rights, CAP_READ, CAP_FCNTL); cap_rights_init(&norights, CAP_WRITE); fa = fileargs_init(MAX_FILES, files, O_RDONLY, 0, &rights, FA_OPEN); @@ -517,7 +517,7 @@ ATF_TC_BODY(fileargs__fopen_write, tc) prepare_files(MAX_FILES, true); - cap_rights_init(&rights, CAP_WRITE | CAP_FCNTL); + cap_rights_init(&rights, CAP_WRITE, CAP_FCNTL); cap_rights_init(&norights, CAP_READ); fa = fileargs_init(MAX_FILES, files, O_WRONLY, 0, &rights, FA_OPEN); @@ -567,7 +567,7 @@ ATF_TC_BODY(fileargs__fopen_create, tc) prepare_files(MAX_FILES, false); - cap_rights_init(&rights, CAP_READ | CAP_WRITE | CAP_FCNTL); + cap_rights_init(&rights, CAP_READ, CAP_WRITE, CAP_FCNTL); fa = fileargs_init(MAX_FILES, files, O_RDWR | O_CREAT, 0, &rights, FA_OPEN); ATF_REQUIRE(fa != NULL); @@ -673,7 +673,7 @@ ATF_TC_BODY(fileargs__open_lstat, tc) prepare_files(MAX_FILES, true); - cap_rights_init(&rights, CAP_READ | CAP_FCNTL); + cap_rights_init(&rights, CAP_READ, CAP_FCNTL); cap_rights_init(&norights, CAP_WRITE); fa = fileargs_init(MAX_FILES, files, O_RDONLY, 0, &rights, FA_OPEN | FA_LSTAT); @@ -721,7 +721,7 @@ ATF_TC_BODY(fileargs__open_realpath, tc) prepare_files(MAX_FILES, true); - cap_rights_init(&rights, CAP_READ | CAP_FCNTL); + cap_rights_init(&rights, CAP_READ, CAP_FCNTL); cap_rights_init(&norights, CAP_WRITE); fa = fileargs_init(MAX_FILES, files, O_RDONLY, 0, &rights, FA_OPEN | FA_REALPATH);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202403221333.42MDXACM002913>