mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-04-05 13:37:43 +03:00
Merge branch 'master'
Conflicts: INSTALL.md release-tool src/browser/BrowserOptionDialog.cpp src/browser/BrowserService.cpp src/browser/BrowserService.h src/browser/NativeMessagingBase.h src/browser/NativeMessagingHost.h src/core/Uuid.cpp src/gui/DatabaseTabWidget.cpp src/gui/DatabaseWidget.cpp src/gui/EditWidget.cpp src/gui/MainWindow.cpp src/gui/MainWindow.ui src/proxy/NativeMessagingHost.h src/sshagent/ASN1Key.cpp
This commit is contained in:
commit
ca27fb06d5
52 changed files with 5657 additions and 1106 deletions
|
@ -380,7 +380,7 @@ void BrowserService::updateEntry(const QString& id,
|
|||
}
|
||||
}
|
||||
|
||||
QList<Entry*> BrowserService::searchEntries(Database* db, const QString& hostname)
|
||||
QList<Entry*> BrowserService::searchEntries(Database* db, const QString& hostname, const QString& url)
|
||||
{
|
||||
QList<Entry*> entries;
|
||||
Group* rootGroup = db->rootGroup();
|
||||
|
@ -389,21 +389,27 @@ QList<Entry*> BrowserService::searchEntries(Database* db, const QString& hostnam
|
|||
}
|
||||
|
||||
for (Entry* entry : EntrySearcher().search(hostname, rootGroup, Qt::CaseInsensitive)) {
|
||||
QString title = entry->title();
|
||||
QString url = entry->url();
|
||||
QString entryUrl = entry->url();
|
||||
QUrl entryQUrl(entryUrl);
|
||||
QString entryScheme = entryQUrl.scheme();
|
||||
QUrl qUrl(url);
|
||||
|
||||
// Filter to match hostname in Title and Url fields
|
||||
if ((!title.isEmpty() && hostname.contains(title)) || (!url.isEmpty() && hostname.contains(url))
|
||||
|| (matchUrlScheme(title) && hostname.endsWith(QUrl(title).host()))
|
||||
|| (matchUrlScheme(url) && hostname.endsWith(QUrl(url).host()))) {
|
||||
entries.append(entry);
|
||||
// Ignore entry if port or scheme defined in the URL doesn't match
|
||||
if ((entryQUrl.port() > 0 && entryQUrl.port() != qUrl.port()) || entryScheme.compare(qUrl.scheme()) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Filter to match hostname in URL field
|
||||
if ((!entryUrl.isEmpty() && hostname.contains(entryUrl))
|
||||
|| (matchUrlScheme(entryUrl) && hostname.endsWith(entryQUrl.host()))) {
|
||||
entries.append(entry);
|
||||
}
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
QList<Entry*> BrowserService::searchEntries(const QString& text, const StringPairList& keyList)
|
||||
QList<Entry*> BrowserService::searchEntries(const QString& url, const StringPairList& keyList)
|
||||
{
|
||||
// Get the list of databases to search
|
||||
QList<Database*> databases;
|
||||
|
@ -430,11 +436,11 @@ QList<Entry*> BrowserService::searchEntries(const QString& text, const StringPai
|
|||
}
|
||||
|
||||
// Search entries matching the hostname
|
||||
QString hostname = QUrl(text).host();
|
||||
QString hostname = QUrl(url).host();
|
||||
QList<Entry*> entries;
|
||||
do {
|
||||
for (Database* db : databases) {
|
||||
entries << searchEntries(db, hostname);
|
||||
entries << searchEntries(db, hostname, url);
|
||||
}
|
||||
} while (entries.isEmpty() && removeFirstDomain(hostname));
|
||||
|
||||
|
@ -563,7 +569,9 @@ QList<Entry*> BrowserService::sortEntries(QList<Entry*>& pwEntries, const QStrin
|
|||
// Sort same priority entries by Title or UserName
|
||||
auto entries = priorities.values(i);
|
||||
std::sort(entries.begin(), entries.end(), [&priorities, &field](Entry* left, Entry* right) {
|
||||
return QString::localeAwareCompare(left->attributes()->value(field), right->attributes()->value(field)) < 0;
|
||||
return (QString::localeAwareCompare(left->attributes()->value(field), right->attributes()->value(field)) < 0) ||
|
||||
((QString::localeAwareCompare(left->attributes()->value(field), right->attributes()->value(field)) == 0) &&
|
||||
(QString::localeAwareCompare(left->attributes()->value("UserName"), right->attributes()->value("UserName")) < 0));
|
||||
});
|
||||
results << entries;
|
||||
if (BrowserSettings::bestMatchOnly() && !pwEntries.isEmpty()) {
|
||||
|
@ -655,6 +663,9 @@ BrowserService::checkAccess(const Entry* entry, const QString& host, const QStri
|
|||
if (!config.load(entry)) {
|
||||
return Unknown;
|
||||
}
|
||||
if (entry->isExpired()) {
|
||||
return Denied;
|
||||
}
|
||||
if ((config.isAllowed(host)) && (submitHost.isEmpty() || config.isAllowed(submitHost))) {
|
||||
return Allowed;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue