Skip to content

Commit 22eb68c

Browse files
hartworkRadovan Sroka
authored andcommitted
Restore support for access control filenames without a group
Regression from commit b15ef71 of release 1.1.0, detailed analysis online at #540 (comment)
1 parent 28bbcc9 commit 22eb68c

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

src/Daemon/Daemon.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,12 +446,25 @@ namespace usbguard
446446
void Daemon::parseIPCAccessControlFilename(const std::string& basename, std::string* const ptr_user,
447447
std::string* const ptr_group)
448448
{
449+
// There are five supported forms:
450+
// - "<user>:<group>"
451+
// - "<user>:"
452+
// - "<user>"
453+
// - ":<group>"
454+
// - ":"
449455
const auto ug_separator = basename.find_first_of(":");
450456
const bool has_group = ug_separator != std::string::npos;
451457
const std::string user = basename.substr(0, ug_separator);
452458
const std::string group = has_group ? basename.substr(ug_separator + 1) : std::string();
453-
checkIPCAccessControlName(user);
454-
checkIPCAccessControlName(group);
459+
460+
if (! user.empty()) {
461+
checkIPCAccessControlName(user);
462+
}
463+
464+
if (! group.empty()) {
465+
checkIPCAccessControlName(group);
466+
}
467+
455468
*ptr_user = user;
456469
*ptr_group = group;
457470
}

0 commit comments

Comments
 (0)