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

Method parseIPCAccessControlFilename

src/Daemon/Daemon.cpp:447–471  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

445 }
446
447 void Daemon::parseIPCAccessControlFilename(const std::string& basename, std::string* const ptr_user,
448 std::string* const ptr_group)
449 {
450 // There are five supported forms:
451 // - "<user>:<group>"
452 // - "<user>:"
453 // - "<user>"
454 // - ":<group>"
455 // - ":"
456 const auto ug_separator = basename.find_first_of(":");
457 const bool has_group = ug_separator != std::string::npos;
458 const std::string user = basename.substr(0, ug_separator);
459 const std::string group = has_group ? basename.substr(ug_separator + 1) : std::string();
460
461 if (! user.empty()) {
462 checkIPCAccessControlName(user);
463 }
464
465 if (! group.empty()) {
466 checkIPCAccessControlName(group);
467 }
468
469 *ptr_user = user;
470 *ptr_group = group;
471 }
472
473 bool Daemon::loadIPCAccessControlFile(const std::string& basename, const std::string& fullpath)
474 {

Callers

nothing calls this directly

Calls 1

emptyMethod · 0.80

Tested by

no test coverage detected