#include "forbid_api.h"
#include "config.h"
#include "ulist.h"
Go to the source code of this file.
◆ forbid_contains()
| int forbid_contains |
( |
const char __user * |
u_path | ) |
|
Definition at line 81 of file forbid_api.c.
81 {
82 char *buf;
83 char *full;
84 int blocked = 0;
85
86 if (!u_path)
87 return 0;
88
89 buf = kmalloc(PATH_MAX, GFP_KERNEL);
90 if (!buf)
91 return 0;
92
94 if (full) {
96 }
97
98 kfree(buf);
99 return blocked;
100}
static char * get_abs_path(const char __user *u_path, char *buf, int buflen)
int ulist_contains(struct ulist *ul, const char *value)
◆ forbid_contains_str()
| int forbid_contains_str |
( |
const char * |
k_path | ) |
|
◆ forbid_exit()
| void forbid_exit |
( |
void |
| ) |
|
Definition at line 19 of file forbid_api.c.
19 {
22}
void ulist_clear(struct ulist *ul)
int ulist_save(struct ulist *ul)
◆ forbid_file()
| int forbid_file |
( |
const char * |
path | ) |
|
Definition at line 24 of file forbid_api.c.
24 {
25 int ret;
26 char modpath[256];
27
28 if (strcmp(path, "/") == 0)
29 return -EINVAL;
30
31 if (strlen(path) >= sizeof(modpath))
32 return -ENAMETOOLONG;
33 strscpy(modpath, path, sizeof(modpath));
34
35 size_t len = strlen(modpath);
36 if (len > 1 && modpath[len - 1] == '/') {
37 modpath[len - 1] = '\0';
38 }
39
41 if (ret < 0)
42 return ret;
43
45 if (ret < 0)
46 return ret;
47
49}
int ulist_add(struct ulist *ul, const char *value, u32 flags, const char *payload)
◆ forbid_init()
Definition at line 8 of file forbid_api.c.
8 {
9 int ret;
10
13 if (ret < 0)
14 return ret;
15
17}
int ulist_load(struct ulist *ul)
static void ulist_init(struct ulist *ul, const char *fname)
◆ forbid_list_get()
| int forbid_list_get |
( |
char * |
buf, |
|
|
size_t |
buf_size |
|
) |
| |
Definition at line 106 of file forbid_api.c.
106 {
108}
int ulist_list(struct ulist *ul, char *buf, size_t buf_size)
◆ get_abs_path()
| static char * get_abs_path |
( |
const char __user * |
u_path, |
|
|
char * |
buf, |
|
|
int |
buflen |
|
) |
| |
|
static |
Definition at line 65 of file forbid_api.c.
65 {
66 struct path path;
67 char *full;
68 int err;
69
70 err = user_path_at(AT_FDCWD, u_path, LOOKUP_FOLLOW, &path);
71 if (err)
72 return NULL;
73
74 full = d_path(&path, buf, buflen);
75 path_put(&path);
76 if (IS_ERR(full))
77 return NULL;
78 return full;
79}
◆ unforbid_file()
| int unforbid_file |
( |
const char * |
path | ) |
|
Definition at line 51 of file forbid_api.c.
51 {
52 int ret;
53
55 if (ret < 0)
56 return ret;
57
59 if (ret < 0)
60 return ret;
61
63}
int ulist_remove(struct ulist *ul, const char *value)
◆ forbid_list