Fix 500 error in validations when capabilities are not supported or set (#13991)

* Fix 500 error in validations when capabilities are not supported or set

* Update Programs.php

* Update Programs.php

Co-authored-by: Tony Murray <murraytony@gmail.com>
This commit is contained in:
Nash Kaminski
2022-06-04 15:38:09 -05:00
committed by GitHub
parent 24e1c96790
commit 4fe3b0fd57

View File

@@ -107,7 +107,7 @@ class Programs extends BaseValidation
$getcap_out = shell_exec("$getcap $cmd");
preg_match("#^$cmd = (.*)$#", $getcap_out, $matches);
if (is_null($matches) || ! Str::contains($matches[1], 'cap_net_raw+ep')) {
if (empty($matches) || ! Str::contains($matches[1], 'cap_net_raw+ep')) {
$validator->fail(
"$cmd should have CAP_NET_RAW!",
"setcap cap_net_raw+ep $cmd"