summaryrefslogtreecommitdiffstats
path: root/sway/commands/permit.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands/permit.c')
-rw-r--r--sway/commands/permit.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/sway/commands/permit.c b/sway/commands/permit.c
index 6eb71816..e2bec2e2 100644
--- a/sway/commands/permit.c
+++ b/sway/commands/permit.c
@@ -62,19 +62,13 @@ struct cmd_results *cmd_permit(int argc, char **argv) {
62 if ((error = checkarg(argc, "permit", EXPECTED_MORE_THAN, 1))) { 62 if ((error = checkarg(argc, "permit", EXPECTED_MORE_THAN, 1))) {
63 return error; 63 return error;
64 } 64 }
65 65 if ((error = check_security_config())) {
66 if (!current_config_path || strcmp(SYSCONFDIR "/sway/security", current_config_path) != 0) { 66 return error;
67 return cmd_results_new(CMD_INVALID, "permit",
68 "This command is only permitted to run from " SYSCONFDIR "/sway/security");
69 } 67 }
70 68
71 struct feature_policy *policy = get_policy(argv[0]); 69 struct feature_policy *policy = get_policy(argv[0]);
72 policy->features |= get_features(argc, argv, &error); 70 policy->features |= get_features(argc, argv, &error);
73 71
74 if (error) {
75 return error;
76 }
77
78 sway_log(L_DEBUG, "Permissions granted to %s for features %d", 72 sway_log(L_DEBUG, "Permissions granted to %s for features %d",
79 policy->program, policy->features); 73 policy->program, policy->features);
80 74
@@ -86,19 +80,13 @@ struct cmd_results *cmd_reject(int argc, char **argv) {
86 if ((error = checkarg(argc, "reject", EXPECTED_MORE_THAN, 1))) { 80 if ((error = checkarg(argc, "reject", EXPECTED_MORE_THAN, 1))) {
87 return error; 81 return error;
88 } 82 }
89 83 if ((error = check_security_config())) {
90 if (!current_config_path || strcmp(SYSCONFDIR "/sway/security", current_config_path) != 0) { 84 return error;
91 return cmd_results_new(CMD_INVALID, "permit",
92 "This command is only permitted to run from " SYSCONFDIR "/sway/security");
93 } 85 }
94 86
95 struct feature_policy *policy = get_policy(argv[0]); 87 struct feature_policy *policy = get_policy(argv[0]);
96 policy->features &= ~get_features(argc, argv, &error); 88 policy->features &= ~get_features(argc, argv, &error);
97 89
98 if (error) {
99 return error;
100 }
101
102 sway_log(L_DEBUG, "Permissions granted to %s for features %d", 90 sway_log(L_DEBUG, "Permissions granted to %s for features %d",
103 policy->program, policy->features); 91 policy->program, policy->features);
104 92