From f101efe97e560960195c6353e68b58e4b959dcc3 Mon Sep 17 00:00:00 2001 From: valoq Date: Sun, 11 Mar 2018 16:10:57 +0100 Subject: [PATCH] fix print in strict sandbox mode --- zathura/commands.c | 9 +++++++++ zathura/libsec.c | 1 + zathura/main.c | 1 - 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/zathura/commands.c b/zathura/commands.c index 1afb790..060a805 100644 --- a/zathura/commands.c +++ b/zathura/commands.c @@ -280,6 +280,15 @@ cmd_print(girara_session_t* session, girara_list_t* UNUSED(argument_list)) return false; } + char* sandbox = NULL; + girara_setting_get(zathura->ui.session, "sandbox", &sandbox); + if (g_strcmp0(sandbox, "strict") == 0) { + girara_notify(zathura->ui.session, GIRARA_ERROR, _("Printing is not permitted in strict sandbox mode")); + g_free(sandbox); + return false; + } + + print(zathura); return true; diff --git a/zathura/libsec.c b/zathura/libsec.c index 2cdc593..4c6f73a 100644 --- a/zathura/libsec.c +++ b/zathura/libsec.c @@ -9,6 +9,7 @@ #include #include #include +#include #define DENY_RULE(call) { if (seccomp_rule_add (ctx, SCMP_ACT_KILL, SCMP_SYS(call), 0) < 0) goto out; } #define ALLOW_RULE(call) { if (seccomp_rule_add (ctx, SCMP_ACT_ALLOW, SCMP_SYS(call), 0) < 0) goto out; } diff --git a/zathura/main.c b/zathura/main.c index 54842f1..27963c7 100644 --- a/zathura/main.c +++ b/zathura/main.c @@ -309,7 +309,6 @@ main(int argc, char* argv[]) } else { girara_error("Invalid sandbox option"); ret = -1; - goto free_and_ret; } g_free(sandbox);