summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2016-12-01 19:38:36 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2016-12-01 19:38:36 -0500
commit44cc0ef125332f1fe3dad7d16ed0a78a25cd1974 (patch)
tree834a20ac4bc2982dda46f144932dd16177b04224 /include
parentWrite example security config, start on code (diff)
downloadsway-44cc0ef125332f1fe3dad7d16ed0a78a25cd1974.tar.gz
sway-44cc0ef125332f1fe3dad7d16ed0a78a25cd1974.tar.zst
sway-44cc0ef125332f1fe3dad7d16ed0a78a25cd1974.zip
Add config related code and initial headers
Diffstat (limited to 'include')
-rw-r--r--include/security.h9
-rw-r--r--include/sway/config.h39
2 files changed, 45 insertions, 3 deletions
diff --git a/include/security.h b/include/security.h
new file mode 100644
index 00000000..efc25ce6
--- /dev/null
+++ b/include/security.h
@@ -0,0 +1,9 @@
1#ifndef _SWAY_SECURITY_H
2#define _SWAY_SECURITY_H
3#include <unistd.h>
4#include "sway/config.h"
5
6const struct feature_permissions *get_permissions(pid_t pid);
7enum command_context get_command_context(const char *cmd);
8
9#endif
diff --git a/include/sway/config.h b/include/sway/config.h
index 8d077ee7..3744386c 100644
--- a/include/sway/config.h
+++ b/include/sway/config.h
@@ -103,9 +103,6 @@ struct pid_workspace {
103 time_t *time_added; 103 time_t *time_added;
104}; 104};
105 105
106void pid_workspace_add(struct pid_workspace *pw);
107void free_pid_workspace(struct pid_workspace *pw);
108
109struct bar_config { 106struct bar_config {
110 /** 107 /**
111 * One of "dock", "hide", "invisible" 108 * One of "dock", "hide", "invisible"
@@ -184,6 +181,35 @@ enum edge_border_types {
184 E_BOTH /**< hide vertical and horizontal edge borders */ 181 E_BOTH /**< hide vertical and horizontal edge borders */
185}; 182};
186 183
184enum command_context {
185 CONTEXT_CONFIG = 1,
186 CONTEXT_BINDING = 2,
187 CONTEXT_IPC = 4,
188 CONTEXT_CRITERIA = 8,
189 CONTEXT_ALL = 0xFFFFFFFF,
190};
191
192struct command_policy {
193 char *command;
194 enum command_context context;
195};
196
197enum secure_feature {
198 FEATURE_LOCK = 1,
199 FEATURE_PANEL = 2,
200 FEATURE_BACKGROUND = 4,
201 FEATURE_SCREENSHOT = 8,
202 FEATURE_FULLSCREEN = 16,
203 FEATURE_KEYBOARD = 32,
204 FEATURE_MOUSE = 64,
205};
206
207struct feature_policy {
208 char *program;
209 bool permit;
210 enum secure_feature features;
211};
212
187/** 213/**
188 * The configuration struct. The result of loading a config file. 214 * The configuration struct. The result of loading a config file.
189 */ 215 */
@@ -252,8 +278,15 @@ struct sway_config {
252 int32_t floating_maximum_height; 278 int32_t floating_maximum_height;
253 int32_t floating_minimum_width; 279 int32_t floating_minimum_width;
254 int32_t floating_minimum_height; 280 int32_t floating_minimum_height;
281
282 // Security
283 list_t *command_policies;
284 list_t *feature_policies;
255}; 285};
256 286
287void pid_workspace_add(struct pid_workspace *pw);
288void free_pid_workspace(struct pid_workspace *pw);
289
257/** 290/**
258 * Loads the main config from the given path. is_active should be true when 291 * Loads the main config from the given path. is_active should be true when
259 * reloading the config. 292 * reloading the config.