Blame


1 4c31de29 2021-09-19 op /*
2 4c31de29 2021-09-19 op * Copyright (c) 2021 Omar Polo <op@omarpolo.com>
3 4c31de29 2021-09-19 op *
4 4c31de29 2021-09-19 op * Permission to use, copy, modify, and distribute this software for any
5 4c31de29 2021-09-19 op * purpose with or without fee is hereby granted, provided that the above
6 4c31de29 2021-09-19 op * copyright notice and this permission notice appear in all copies.
7 4c31de29 2021-09-19 op *
8 4c31de29 2021-09-19 op * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 4c31de29 2021-09-19 op * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 4c31de29 2021-09-19 op * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 4c31de29 2021-09-19 op * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 4c31de29 2021-09-19 op * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 4c31de29 2021-09-19 op * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 4c31de29 2021-09-19 op * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 4c31de29 2021-09-19 op */
16 4c31de29 2021-09-19 op
17 4c31de29 2021-09-19 op #include "../landlock_shim.h"
18 4c31de29 2021-09-19 op
19 4c31de29 2021-09-19 op int
20 4c31de29 2021-09-19 op main(void)
21 4c31de29 2021-09-19 op {
22 4c31de29 2021-09-19 op int rfd;
23 e5d82d94 2022-03-19 op const struct landlock_ruleset_attr rsattr = {
24 4c31de29 2021-09-19 op .handled_access_fs = LANDLOCK_ACCESS_FS_READ_FILE |
25 4c31de29 2021-09-19 op LANDLOCK_ACCESS_FS_READ_DIR
26 4c31de29 2021-09-19 op };
27 4c31de29 2021-09-19 op
28 4c31de29 2021-09-19 op rfd = landlock_create_ruleset(&rsattr, sizeof(rsattr), 0);
29 4c31de29 2021-09-19 op return rfd == -1;
30 4c31de29 2021-09-19 op }