Perform (partial) server initialization before dropping privileges.

Some operations during backend creation (e.g. becoming DRM master)
require CAP_SYS_ADMIN privileges. At this point, sway has dropped them
already, though. This patch splits the privileged part of server_init
into its own function and calls it before dropping its privileges.
This fixes the bug with minimal security implications.
This commit is contained in:
Tobias Blass 2018-06-13 00:39:24 +02:00
parent 202ee51150
commit a5c091e302
3 changed files with 15 additions and 3 deletions

View file

@ -47,6 +47,8 @@ struct sway_server {
struct sway_server server;
/* Prepares an unprivileged server_init by performing all privileged operations in advance */
bool server_privileged_prepare(struct sway_server *server);
bool server_init(struct sway_server *server);
void server_fini(struct sway_server *server);
void server_run(struct sway_server *server);