mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-27 00:09:53 -05:00
Fix AutoOpen IfDevice matching, again
* Fix case where only exclusions are entered (eg, !COMPUTER1, !COMPUTER2) which should allow opening the database on every other computer name.
This commit is contained in:
parent
9cf93111d6
commit
c67ebf19d4
@ -2061,7 +2061,7 @@ void DatabaseWidget::processAutoOpen()
|
||||
// negated using '!'
|
||||
auto ifDevice = entry->attribute("IfDevice");
|
||||
if (!ifDevice.isEmpty()) {
|
||||
bool loadDb = true;
|
||||
bool loadDb = false;
|
||||
auto hostName = QHostInfo::localHostName();
|
||||
for (auto& device : ifDevice.split(",")) {
|
||||
device = device.trimmed();
|
||||
@ -2070,12 +2070,13 @@ void DatabaseWidget::processAutoOpen()
|
||||
// Machine name matched an exclusion, don't load this database
|
||||
loadDb = false;
|
||||
break;
|
||||
} else {
|
||||
// Not matching an exclusion allows loading on all machines
|
||||
loadDb = true;
|
||||
}
|
||||
} else if (device.compare(hostName, Qt::CaseInsensitive) == 0) {
|
||||
// Explicitly named for loading
|
||||
loadDb = true;
|
||||
} else {
|
||||
// Don't load the database if there are devices not starting with '!'
|
||||
loadDb = false;
|
||||
}
|
||||
}
|
||||
if (!loadDb) {
|
||||
|
Loading…
Reference in New Issue
Block a user