Remove code related to the security features

- Remove struct definitions
- Remove struct members
- Remove initializations and frees
This commit is contained in:
Érico Rolim 2020-05-21 00:46:28 -03:00 committed by Simon Ser
parent 06fc42359b
commit 1d3681f521
7 changed files with 0 additions and 129 deletions

View file

@ -9,7 +9,6 @@
#include "sway/commands.h"
#include "sway/config.h"
#include "sway/criteria.h"
#include "sway/security.h"
#include "sway/input/input-manager.h"
#include "sway/input/seat.h"
#include "sway/tree/view.h"
@ -489,28 +488,6 @@ struct cmd_results *config_commands_command(char *exec) {
context |= context_names[j].context;
}
struct command_policy *policy = NULL;
for (int i = 0; i < config->command_policies->length; ++i) {
struct command_policy *p = config->command_policies->items[i];
if (strcmp(p->command, cmd) == 0) {
policy = p;
break;
}
}
if (!policy) {
policy = alloc_command_policy(cmd);
if (!sway_assert(policy, "Unable to allocate security policy")) {
results = cmd_results_new(CMD_INVALID,
"Unable to allocate memory");
goto cleanup;
}
list_add(config->command_policies, policy);
}
policy->context = context;
sway_log(SWAY_INFO, "Set command policy for %s to %d",
policy->command, policy->context);
results = cmd_results_new(CMD_SUCCESS, NULL);
cleanup:

View file

@ -154,9 +154,6 @@ void free_config(struct sway_config *config) {
list_free(config->no_focus);
list_free(config->active_bar_modifiers);
list_free_items_and_destroy(config->config_chain);
list_free(config->command_policies);
list_free(config->feature_policies);
list_free(config->ipc_policies);
free(config->floating_scroll_up_cmd);
free(config->floating_scroll_down_cmd);
free(config->floating_scroll_left_cmd);
@ -327,11 +324,6 @@ static void config_defaults(struct sway_config *config) {
color_to_rgba(config->border_colors.background, 0xFFFFFFFF);
// Security
if (!(config->command_policies = create_list())) goto cleanup;
if (!(config->feature_policies = create_list())) goto cleanup;
if (!(config->ipc_policies = create_list())) goto cleanup;
// The keysym to keycode translation
struct xkb_rule_names rules = {0};
config->keysym_translation_state =

View file

@ -47,7 +47,6 @@ struct ipc_client {
struct wl_event_source *writable_event_source;
struct sway_server *server;
int fd;
uint32_t security_policy;
enum ipc_command_type subscribed_events;
size_t write_buffer_len;
size_t write_buffer_size;

View file

@ -6,7 +6,6 @@ sway_sources = files(
'ipc-json.c',
'ipc-server.c',
'main.c',
'security.c',
'server.c',
'swaynag.c',
'xdg_decoration.c',

View file

@ -1,18 +0,0 @@
#define _POSIX_C_SOURCE 200809L
#include <stdlib.h>
#include <string.h>
#include "sway/security.h"
struct command_policy *alloc_command_policy(const char *command) {
struct command_policy *policy = malloc(sizeof(struct command_policy));
if (!policy) {
return NULL;
}
policy->command = strdup(command);
if (!policy->command) {
free(policy);
return NULL;
}
policy->context = 0;
return policy;
}