summaryrefslogtreecommitdiff
path: root/src/test/test-cap-list.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2023-02-20 12:26:46 +0100
committerLennart Poettering <lennart@poettering.net>2023-02-20 16:13:49 +0100
commitd0e67c69ba7fa9984a2d96caa8ad4b7762ed3160 (patch)
tree048858053523caef25392ab4b15d391c5da2d9b7 /src/test/test-cap-list.c
parent3f444e94f5a7ccc8d4f16a331858b0a4e717b773 (diff)
downloadsystemd-d0e67c69ba7fa9984a2d96caa8ad4b7762ed3160.tar.gz
cap-list: refuse parsing numeric capability 63
We refuse it otherwise currently, simply because we cannot store it in a uint64_t caps mask value anymore while retaining the ability to use UINT64_MAX as "unset" marker. The check actually was in place already, just one off.
Diffstat (limited to 'src/test/test-cap-list.c')
-rw-r--r--src/test/test-cap-list.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/test/test-cap-list.c b/src/test/test-cap-list.c
index cc5f3a0c35..517641a019 100644
--- a/src/test/test-cap-list.c
+++ b/src/test/test-cap-list.c
@@ -29,7 +29,8 @@ TEST(cap_list) {
assert_se(capability_from_name("cAp_aUdIt_rEAd") == CAP_AUDIT_READ);
assert_se(capability_from_name("0") == 0);
assert_se(capability_from_name("15") == 15);
- assert_se(capability_from_name("63") == 63);
+ assert_se(capability_from_name("62") == 62);
+ assert_se(capability_from_name("63") == -EINVAL);
assert_se(capability_from_name("64") == -EINVAL);
assert_se(capability_from_name("-1") == -EINVAL);
@@ -117,9 +118,9 @@ static void test_capability_set_to_string_invalid(uint64_t invalid_cap_set) {
TEST(capability_set_to_string) {
test_capability_set_to_string_invalid(0);
- /* once the kernel supports 63 caps, there are no 'invalid' numbers
+ /* once the kernel supports 62 caps, there are no 'invalid' numbers
* for us to test with */
- if (cap_last_cap() < 63)
+ if (cap_last_cap() < 62)
test_capability_set_to_string_invalid(all_capabilities() + 1);
}