diff options
-rw-r--r-- | include/sway/security.h | 6 | ||||
-rw-r--r-- | sway/commands.c | 2 | ||||
-rw-r--r-- | sway/extensions.c | 8 | ||||
-rw-r--r-- | sway/handlers.c | 10 | ||||
-rw-r--r-- | sway/ipc-server.c | 2 | ||||
-rw-r--r-- | sway/security.c | 6 |
6 files changed, 17 insertions, 17 deletions
diff --git a/include/sway/security.h b/include/sway/security.h index c3a5cfd4..d60f264a 100644 --- a/include/sway/security.h +++ b/include/sway/security.h | |||
@@ -3,9 +3,9 @@ | |||
3 | #include <unistd.h> | 3 | #include <unistd.h> |
4 | #include "sway/config.h" | 4 | #include "sway/config.h" |
5 | 5 | ||
6 | uint32_t get_feature_policy(pid_t pid); | 6 | uint32_t get_feature_policy_mask(pid_t pid); |
7 | uint32_t get_ipc_policy(pid_t pid); | 7 | uint32_t get_ipc_policy_mask(pid_t pid); |
8 | uint32_t get_command_policy(const char *cmd); | 8 | uint32_t get_command_policy_mask(const char *cmd); |
9 | 9 | ||
10 | const char *command_policy_str(enum command_context context); | 10 | const char *command_policy_str(enum command_context context); |
11 | 11 | ||
diff --git a/sway/commands.c b/sway/commands.c index 17c7d717..4d7af301 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -437,7 +437,7 @@ struct cmd_results *handle_command(char *_exec, enum command_context context) { | |||
437 | free_argv(argc, argv); | 437 | free_argv(argc, argv); |
438 | goto cleanup; | 438 | goto cleanup; |
439 | } | 439 | } |
440 | if (!(get_command_policy(argv[0]) & context)) { | 440 | if (!(get_command_policy_mask(argv[0]) & context)) { |
441 | if (results) { | 441 | if (results) { |
442 | free_cmd_results(results); | 442 | free_cmd_results(results); |
443 | } | 443 | } |
diff --git a/sway/extensions.c b/sway/extensions.c index 15d2f971..96957dbf 100644 --- a/sway/extensions.c +++ b/sway/extensions.c | |||
@@ -86,7 +86,7 @@ static void set_background(struct wl_client *client, struct wl_resource *resourc | |||
86 | struct wl_resource *_output, struct wl_resource *surface) { | 86 | struct wl_resource *_output, struct wl_resource *surface) { |
87 | pid_t pid; | 87 | pid_t pid; |
88 | wl_client_get_credentials(client, &pid, NULL, NULL); | 88 | wl_client_get_credentials(client, &pid, NULL, NULL); |
89 | if (!(get_feature_policy(pid) & FEATURE_BACKGROUND)) { | 89 | if (!(get_feature_policy_mask(pid) & FEATURE_BACKGROUND)) { |
90 | sway_log(L_INFO, "Denying background feature to %d", pid); | 90 | sway_log(L_INFO, "Denying background feature to %d", pid); |
91 | return; | 91 | return; |
92 | } | 92 | } |
@@ -114,7 +114,7 @@ static void set_panel(struct wl_client *client, struct wl_resource *resource, | |||
114 | struct wl_resource *_output, struct wl_resource *surface) { | 114 | struct wl_resource *_output, struct wl_resource *surface) { |
115 | pid_t pid; | 115 | pid_t pid; |
116 | wl_client_get_credentials(client, &pid, NULL, NULL); | 116 | wl_client_get_credentials(client, &pid, NULL, NULL); |
117 | if (!(get_feature_policy(pid) & FEATURE_PANEL)) { | 117 | if (!(get_feature_policy_mask(pid) & FEATURE_PANEL)) { |
118 | sway_log(L_INFO, "Denying panel feature to %d", pid); | 118 | sway_log(L_INFO, "Denying panel feature to %d", pid); |
119 | return; | 119 | return; |
120 | } | 120 | } |
@@ -152,7 +152,7 @@ static void desktop_ready(struct wl_client *client, struct wl_resource *resource | |||
152 | static void set_panel_position(struct wl_client *client, struct wl_resource *resource, uint32_t position) { | 152 | static void set_panel_position(struct wl_client *client, struct wl_resource *resource, uint32_t position) { |
153 | pid_t pid; | 153 | pid_t pid; |
154 | wl_client_get_credentials(client, &pid, NULL, NULL); | 154 | wl_client_get_credentials(client, &pid, NULL, NULL); |
155 | if (!(get_feature_policy(pid) & FEATURE_PANEL)) { | 155 | if (!(get_feature_policy_mask(pid) & FEATURE_PANEL)) { |
156 | sway_log(L_INFO, "Denying panel feature to %d", pid); | 156 | sway_log(L_INFO, "Denying panel feature to %d", pid); |
157 | return; | 157 | return; |
158 | } | 158 | } |
@@ -191,7 +191,7 @@ static void set_lock_surface(struct wl_client *client, struct wl_resource *resou | |||
191 | struct wl_resource *_output, struct wl_resource *surface) { | 191 | struct wl_resource *_output, struct wl_resource *surface) { |
192 | pid_t pid; | 192 | pid_t pid; |
193 | wl_client_get_credentials(client, &pid, NULL, NULL); | 193 | wl_client_get_credentials(client, &pid, NULL, NULL); |
194 | if (!(get_feature_policy(pid) & FEATURE_LOCK)) { | 194 | if (!(get_feature_policy_mask(pid) & FEATURE_LOCK)) { |
195 | sway_log(L_INFO, "Denying lock feature to %d", pid); | 195 | sway_log(L_INFO, "Denying lock feature to %d", pid); |
196 | return; | 196 | return; |
197 | } | 197 | } |
diff --git a/sway/handlers.c b/sway/handlers.c index b61c0a19..a8de135f 100644 --- a/sway/handlers.c +++ b/sway/handlers.c | |||
@@ -595,7 +595,7 @@ static void handle_view_state_request(wlc_handle view, enum wlc_view_state_bit s | |||
595 | pid_t pid = wlc_view_get_pid(view); | 595 | pid_t pid = wlc_view_get_pid(view); |
596 | switch (state) { | 596 | switch (state) { |
597 | case WLC_BIT_FULLSCREEN: | 597 | case WLC_BIT_FULLSCREEN: |
598 | if (!(get_feature_policy(pid) & FEATURE_FULLSCREEN)) { | 598 | if (!(get_feature_policy_mask(pid) & FEATURE_FULLSCREEN)) { |
599 | sway_log(L_INFO, "Denying fullscreen to %d (%s)", pid, c->name); | 599 | sway_log(L_INFO, "Denying fullscreen to %d (%s)", pid, c->name); |
600 | break; | 600 | break; |
601 | } | 601 | } |
@@ -811,7 +811,7 @@ static bool handle_key(wlc_handle view, uint32_t time, const struct wlc_modifier | |||
811 | swayc_t *focused = get_focused_container(&root_container); | 811 | swayc_t *focused = get_focused_container(&root_container); |
812 | if (focused->type == C_VIEW) { | 812 | if (focused->type == C_VIEW) { |
813 | pid_t pid = wlc_view_get_pid(focused->handle); | 813 | pid_t pid = wlc_view_get_pid(focused->handle); |
814 | if (!(get_feature_policy(pid) & FEATURE_KEYBOARD)) { | 814 | if (!(get_feature_policy_mask(pid) & FEATURE_KEYBOARD)) { |
815 | return EVENT_HANDLED; | 815 | return EVENT_HANDLED; |
816 | } | 816 | } |
817 | } | 817 | } |
@@ -875,7 +875,7 @@ static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct | |||
875 | swayc_t *focused = get_focused_container(&root_container); | 875 | swayc_t *focused = get_focused_container(&root_container); |
876 | if (focused->type == C_VIEW) { | 876 | if (focused->type == C_VIEW) { |
877 | pid_t pid = wlc_view_get_pid(focused->handle); | 877 | pid_t pid = wlc_view_get_pid(focused->handle); |
878 | if (!(get_feature_policy(pid) & FEATURE_MOUSE)) { | 878 | if (!(get_feature_policy_mask(pid) & FEATURE_MOUSE)) { |
879 | return EVENT_HANDLED; | 879 | return EVENT_HANDLED; |
880 | } | 880 | } |
881 | } | 881 | } |
@@ -953,7 +953,7 @@ static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct w | |||
953 | if (swayc_is_fullscreen(focused)) { | 953 | if (swayc_is_fullscreen(focused)) { |
954 | if (focused->type == C_VIEW) { | 954 | if (focused->type == C_VIEW) { |
955 | pid_t pid = wlc_view_get_pid(focused->handle); | 955 | pid_t pid = wlc_view_get_pid(focused->handle); |
956 | if (!(get_feature_policy(pid) & FEATURE_MOUSE)) { | 956 | if (!(get_feature_policy_mask(pid) & FEATURE_MOUSE)) { |
957 | return EVENT_HANDLED; | 957 | return EVENT_HANDLED; |
958 | } | 958 | } |
959 | } | 959 | } |
@@ -1001,7 +1001,7 @@ static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct w | |||
1001 | 1001 | ||
1002 | if (focused->type == C_VIEW) { | 1002 | if (focused->type == C_VIEW) { |
1003 | pid_t pid = wlc_view_get_pid(focused->handle); | 1003 | pid_t pid = wlc_view_get_pid(focused->handle); |
1004 | if (!(get_feature_policy(pid) & FEATURE_MOUSE)) { | 1004 | if (!(get_feature_policy_mask(pid) & FEATURE_MOUSE)) { |
1005 | return EVENT_HANDLED; | 1005 | return EVENT_HANDLED; |
1006 | } | 1006 | } |
1007 | } | 1007 | } |
diff --git a/sway/ipc-server.c b/sway/ipc-server.c index 67a3cdc8..dca881fa 100644 --- a/sway/ipc-server.c +++ b/sway/ipc-server.c | |||
@@ -181,7 +181,7 @@ int ipc_handle_connection(int fd, uint32_t mask, void *data) { | |||
181 | client->event_source = wlc_event_loop_add_fd(client_fd, WLC_EVENT_READABLE, ipc_client_handle_readable, client); | 181 | client->event_source = wlc_event_loop_add_fd(client_fd, WLC_EVENT_READABLE, ipc_client_handle_readable, client); |
182 | 182 | ||
183 | pid_t pid = get_client_pid(client->fd); | 183 | pid_t pid = get_client_pid(client->fd); |
184 | client->security_policy = get_ipc_policy(pid); | 184 | client->security_policy = get_ipc_policy_mask(pid); |
185 | 185 | ||
186 | list_add(ipc_client_list, client); | 186 | list_add(ipc_client_list, client); |
187 | 187 | ||
diff --git a/sway/security.c b/sway/security.c index f8a96ba7..5b762b07 100644 --- a/sway/security.c +++ b/sway/security.c | |||
@@ -94,7 +94,7 @@ static const char *get_pid_exe(pid_t pid) { | |||
94 | return link; | 94 | return link; |
95 | } | 95 | } |
96 | 96 | ||
97 | uint32_t get_feature_policy(pid_t pid) { | 97 | uint32_t get_feature_policy_mask(pid_t pid) { |
98 | uint32_t default_policy = 0; | 98 | uint32_t default_policy = 0; |
99 | const char *link = get_pid_exe(pid); | 99 | const char *link = get_pid_exe(pid); |
100 | 100 | ||
@@ -111,7 +111,7 @@ uint32_t get_feature_policy(pid_t pid) { | |||
111 | return default_policy; | 111 | return default_policy; |
112 | } | 112 | } |
113 | 113 | ||
114 | uint32_t get_ipc_policy(pid_t pid) { | 114 | uint32_t get_ipc_policy_mask(pid_t pid) { |
115 | uint32_t default_policy = 0; | 115 | uint32_t default_policy = 0; |
116 | const char *link = get_pid_exe(pid); | 116 | const char *link = get_pid_exe(pid); |
117 | 117 | ||
@@ -128,7 +128,7 @@ uint32_t get_ipc_policy(pid_t pid) { | |||
128 | return default_policy; | 128 | return default_policy; |
129 | } | 129 | } |
130 | 130 | ||
131 | uint32_t get_command_policy(const char *cmd) { | 131 | uint32_t get_command_policy_mask(const char *cmd) { |
132 | uint32_t default_policy = 0; | 132 | uint32_t default_policy = 0; |
133 | 133 | ||
134 | for (int i = 0; i < config->command_policies->length; ++i) { | 134 | for (int i = 0; i < config->command_policies->length; ++i) { |