MCPcopy Create free account
hub / github.com/USBGuard/usbguard / loadIPCAccessControlFile

Method loadIPCAccessControlFile

src/Daemon/Daemon.cpp:473–506  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

471 }
472
473 bool Daemon::loadIPCAccessControlFile(const std::string& basename, const std::string& fullpath)
474 {
475 USBGUARD_LOG(Info) << "Loading IPC access control file " << fullpath;
476 std::string user;
477 std::string group;
478 IPCServer::AccessControl ac;
479
480 try {
481 parseIPCAccessControlFilename(basename, &user, &group);
482 }
483 catch (...) {
484 USBGUARD_LOG(Warning) << "Ignoring access control file because of malformed name: " << basename;
485 return false;
486 }
487
488 try {
489 std::ifstream ac_stream(fullpath);
490 ac.load(ac_stream);
491 }
492 catch (...) {
493 USBGUARD_LOG(Warning) << "Failed to load IPC access control file " << fullpath;
494 return false;
495 }
496
497 if (!user.empty()) {
498 addIPCAllowedUser(user, ac);
499 }
500
501 if (!group.empty()) {
502 addIPCAllowedGroup(group, ac);
503 }
504
505 return true;
506 }
507
508 void Daemon::setImplicitPolicyTarget(Rule::Target target)
509 {

Callers

nothing calls this directly

Calls 2

emptyMethod · 0.80
loadMethod · 0.45

Tested by

no test coverage detected