Fix make sandboxing logic for .STRICT mode (#661)

Patch segfaults and handle the `.STRICT = 0` case.
This commit is contained in:
Connor 2022-10-11 21:16:03 -07:00 committed by GitHub
parent 31dab8a75d
commit 9d2f993364
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1904,32 +1904,30 @@ child_execute_job (struct childbase *child,
c = 0; c = 0;
} }
internet = !get_target_variable(STRING_SIZE_TUPLE (".STRICT"),
c->file, 0) ||
parse_bool (get_target_variable
(STRING_SIZE_TUPLE (".INTERNET"),
c ? c->file : 0, "0"));
unsandboxed = !get_target_variable(STRING_SIZE_TUPLE (".STRICT"),
c->file, 0) ||
parse_bool (get_target_variable
(STRING_SIZE_TUPLE (".UNSANDBOXED"),
c ? c->file : 0, "0"));
if (c) if (c)
{ {
sandboxed = !unsandboxed;
strict = parse_bool (get_target_variable strict = parse_bool (get_target_variable
(STRING_SIZE_TUPLE (".STRICT"), (STRING_SIZE_TUPLE (".STRICT"),
c->file, "0")); c->file, "0"));
internet = !strict ||
parse_bool (get_target_variable
(STRING_SIZE_TUPLE (".INTERNET"),
c->file, "0"));
unsandboxed = !strict ||
parse_bool (get_target_variable
(STRING_SIZE_TUPLE (".UNSANDBOXED"),
c->file, "0"));
} }
else else
{ {
sandboxed = false;
strict = false; strict = false;
internet = true;
unsandboxed = true;
} }
if (!unsandboxed) sandboxed = !unsandboxed;
if (sandboxed)
{ {
promises = emptytonull (get_target_variable promises = emptytonull (get_target_variable
(STRING_SIZE_TUPLE (".PLEDGE"), (STRING_SIZE_TUPLE (".PLEDGE"),