diff options
author | Érico Rolim <erico.erc@gmail.com> | 2020-05-21 00:46:28 -0300 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-05-21 10:57:00 +0200 |
commit | 1d3681f5213535c1f47ed8bd0cddb7df775dd75e (patch) | |
tree | b9fce1efbd9b479832b0f1d3210602ec77e876b5 /sway | |
parent | Fix typos in comments (diff) | |
download | sway-1d3681f5213535c1f47ed8bd0cddb7df775dd75e.tar.gz sway-1d3681f5213535c1f47ed8bd0cddb7df775dd75e.tar.zst sway-1d3681f5213535c1f47ed8bd0cddb7df775dd75e.zip |
Remove code related to the security features
- Remove struct definitions
- Remove struct members
- Remove initializations and frees
Diffstat (limited to 'sway')
-rw-r--r-- | sway/commands.c | 23 | ||||
-rw-r--r-- | sway/config.c | 8 | ||||
-rw-r--r-- | sway/ipc-server.c | 1 | ||||
-rw-r--r-- | sway/meson.build | 1 | ||||
-rw-r--r-- | sway/security.c | 18 |
5 files changed, 0 insertions, 51 deletions
diff --git a/sway/commands.c b/sway/commands.c index afe05b26..f20a8baa 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -9,7 +9,6 @@ | |||
9 | #include "sway/commands.h" | 9 | #include "sway/commands.h" |
10 | #include "sway/config.h" | 10 | #include "sway/config.h" |
11 | #include "sway/criteria.h" | 11 | #include "sway/criteria.h" |
12 | #include "sway/security.h" | ||
13 | #include "sway/input/input-manager.h" | 12 | #include "sway/input/input-manager.h" |
14 | #include "sway/input/seat.h" | 13 | #include "sway/input/seat.h" |
15 | #include "sway/tree/view.h" | 14 | #include "sway/tree/view.h" |
@@ -489,28 +488,6 @@ struct cmd_results *config_commands_command(char *exec) { | |||
489 | context |= context_names[j].context; | 488 | context |= context_names[j].context; |
490 | } | 489 | } |
491 | 490 | ||
492 | struct command_policy *policy = NULL; | ||
493 | for (int i = 0; i < config->command_policies->length; ++i) { | ||
494 | struct command_policy *p = config->command_policies->items[i]; | ||
495 | if (strcmp(p->command, cmd) == 0) { | ||
496 | policy = p; | ||
497 | break; | ||
498 | } | ||
499 | } | ||
500 | if (!policy) { | ||
501 | policy = alloc_command_policy(cmd); | ||
502 | if (!sway_assert(policy, "Unable to allocate security policy")) { | ||
503 | results = cmd_results_new(CMD_INVALID, | ||
504 | "Unable to allocate memory"); | ||
505 | goto cleanup; | ||
506 | } | ||
507 | list_add(config->command_policies, policy); | ||
508 | } | ||
509 | policy->context = context; | ||
510 | |||
511 | sway_log(SWAY_INFO, "Set command policy for %s to %d", | ||
512 | policy->command, policy->context); | ||
513 | |||
514 | results = cmd_results_new(CMD_SUCCESS, NULL); | 491 | results = cmd_results_new(CMD_SUCCESS, NULL); |
515 | 492 | ||
516 | cleanup: | 493 | cleanup: |
diff --git a/sway/config.c b/sway/config.c index fe811d27..bcf8d56f 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -154,9 +154,6 @@ void free_config(struct sway_config *config) { | |||
154 | list_free(config->no_focus); | 154 | list_free(config->no_focus); |
155 | list_free(config->active_bar_modifiers); | 155 | list_free(config->active_bar_modifiers); |
156 | list_free_items_and_destroy(config->config_chain); | 156 | list_free_items_and_destroy(config->config_chain); |
157 | list_free(config->command_policies); | ||
158 | list_free(config->feature_policies); | ||
159 | list_free(config->ipc_policies); | ||
160 | free(config->floating_scroll_up_cmd); | 157 | free(config->floating_scroll_up_cmd); |
161 | free(config->floating_scroll_down_cmd); | 158 | free(config->floating_scroll_down_cmd); |
162 | free(config->floating_scroll_left_cmd); | 159 | free(config->floating_scroll_left_cmd); |
@@ -327,11 +324,6 @@ static void config_defaults(struct sway_config *config) { | |||
327 | 324 | ||
328 | color_to_rgba(config->border_colors.background, 0xFFFFFFFF); | 325 | color_to_rgba(config->border_colors.background, 0xFFFFFFFF); |
329 | 326 | ||
330 | // Security | ||
331 | if (!(config->command_policies = create_list())) goto cleanup; | ||
332 | if (!(config->feature_policies = create_list())) goto cleanup; | ||
333 | if (!(config->ipc_policies = create_list())) goto cleanup; | ||
334 | |||
335 | // The keysym to keycode translation | 327 | // The keysym to keycode translation |
336 | struct xkb_rule_names rules = {0}; | 328 | struct xkb_rule_names rules = {0}; |
337 | config->keysym_translation_state = | 329 | config->keysym_translation_state = |
diff --git a/sway/ipc-server.c b/sway/ipc-server.c index 5e1cca89..bd9f40bc 100644 --- a/sway/ipc-server.c +++ b/sway/ipc-server.c | |||
@@ -47,7 +47,6 @@ struct ipc_client { | |||
47 | struct wl_event_source *writable_event_source; | 47 | struct wl_event_source *writable_event_source; |
48 | struct sway_server *server; | 48 | struct sway_server *server; |
49 | int fd; | 49 | int fd; |
50 | uint32_t security_policy; | ||
51 | enum ipc_command_type subscribed_events; | 50 | enum ipc_command_type subscribed_events; |
52 | size_t write_buffer_len; | 51 | size_t write_buffer_len; |
53 | size_t write_buffer_size; | 52 | size_t write_buffer_size; |
diff --git a/sway/meson.build b/sway/meson.build index d71846a4..0db45836 100644 --- a/sway/meson.build +++ b/sway/meson.build | |||
@@ -6,7 +6,6 @@ sway_sources = files( | |||
6 | 'ipc-json.c', | 6 | 'ipc-json.c', |
7 | 'ipc-server.c', | 7 | 'ipc-server.c', |
8 | 'main.c', | 8 | 'main.c', |
9 | 'security.c', | ||
10 | 'server.c', | 9 | 'server.c', |
11 | 'swaynag.c', | 10 | 'swaynag.c', |
12 | 'xdg_decoration.c', | 11 | 'xdg_decoration.c', |
diff --git a/sway/security.c b/sway/security.c deleted file mode 100644 index 6a00229e..00000000 --- a/sway/security.c +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | #define _POSIX_C_SOURCE 200809L | ||
2 | #include <stdlib.h> | ||
3 | #include <string.h> | ||
4 | #include "sway/security.h" | ||
5 | |||
6 | struct command_policy *alloc_command_policy(const char *command) { | ||
7 | struct command_policy *policy = malloc(sizeof(struct command_policy)); | ||
8 | if (!policy) { | ||
9 | return NULL; | ||
10 | } | ||
11 | policy->command = strdup(command); | ||
12 | if (!policy->command) { | ||
13 | free(policy); | ||
14 | return NULL; | ||
15 | } | ||
16 | policy->context = 0; | ||
17 | return policy; | ||
18 | } | ||