| 466 | |
| 467 | |
| 468 | Try<ContainerSeccompProfile> parseProfileData(const string& data) |
| 469 | { |
| 470 | Try<JSON::Object> json = JSON::parse<JSON::Object>(data); |
| 471 | if (json.isError()) { |
| 472 | return Error(json.error()); |
| 473 | } |
| 474 | |
| 475 | ContainerSeccompProfile profile; |
| 476 | |
| 477 | Try<Nothing> defaultAction = parseDefaultAction(json.get(), &profile); |
| 478 | if (defaultAction.isError()) { |
| 479 | return Error(defaultAction.error()); |
| 480 | } |
| 481 | |
| 482 | Try<Nothing> archMap = parseArchMap(json.get(), &profile); |
| 483 | if (archMap.isError()) { |
| 484 | return Error(archMap.error()); |
| 485 | } |
| 486 | |
| 487 | Try<Nothing> syscalls = parseSyscalls(json.get(), &profile); |
| 488 | if (syscalls.isError()) { |
| 489 | return Error(syscalls.error()); |
| 490 | } |
| 491 | |
| 492 | // Verify Seccomp profile. |
| 493 | Try<Owned<SeccompFilter>> seccompFilter = SeccompFilter::create(profile); |
| 494 | if (seccompFilter.isError()) { |
| 495 | return Error(seccompFilter.error()); |
| 496 | } |
| 497 | |
| 498 | return std::move(profile); |
| 499 | } |
| 500 | |
| 501 | |
| 502 | Try<ContainerSeccompProfile> parseProfile(const string& path) |