mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Handle URL port and scheme when requesting credentials
This commit is contained in:
parent
add4ba21fa
commit
057cf6aed3
@ -366,7 +366,7 @@ void BrowserService::updateEntry(const QString& id, const QString& uuid, const Q
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<Entry*> BrowserService::searchEntries(Database* db, const QString& hostname)
|
QList<Entry*> BrowserService::searchEntries(Database* db, const QString& hostname, const QString& url)
|
||||||
{
|
{
|
||||||
QList<Entry*> entries;
|
QList<Entry*> entries;
|
||||||
Group* rootGroup = db->rootGroup();
|
Group* rootGroup = db->rootGroup();
|
||||||
@ -375,11 +375,19 @@ QList<Entry*> BrowserService::searchEntries(Database* db, const QString& hostnam
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (Entry* entry : EntrySearcher().search(hostname, rootGroup, Qt::CaseInsensitive)) {
|
for (Entry* entry : EntrySearcher().search(hostname, rootGroup, Qt::CaseInsensitive)) {
|
||||||
QString url = entry->url();
|
QString entryUrl = entry->url();
|
||||||
|
QUrl entryQUrl(entryUrl);
|
||||||
|
QString entryScheme = entryQUrl.scheme();
|
||||||
|
QUrl qUrl(url);
|
||||||
|
|
||||||
|
// 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
|
// Filter to match hostname in URL field
|
||||||
if ((!url.isEmpty() && hostname.contains(url))
|
if ((!entryUrl.isEmpty() && hostname.contains(entryUrl))
|
||||||
|| (matchUrlScheme(url) && hostname.endsWith(QUrl(url).host()))) {
|
|| (matchUrlScheme(entryUrl) && hostname.endsWith(entryQUrl.host()))) {
|
||||||
entries.append(entry);
|
entries.append(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -387,7 +395,7 @@ QList<Entry*> BrowserService::searchEntries(Database* db, const QString& hostnam
|
|||||||
return entries;
|
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
|
// Get the list of databases to search
|
||||||
QList<Database*> databases;
|
QList<Database*> databases;
|
||||||
@ -414,11 +422,11 @@ QList<Entry*> BrowserService::searchEntries(const QString& text, const StringPai
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Search entries matching the hostname
|
// Search entries matching the hostname
|
||||||
QString hostname = QUrl(text).host();
|
QString hostname = QUrl(url).host();
|
||||||
QList<Entry*> entries;
|
QList<Entry*> entries;
|
||||||
do {
|
do {
|
||||||
for (Database* db : databases) {
|
for (Database* db : databases) {
|
||||||
entries << searchEntries(db, hostname);
|
entries << searchEntries(db, hostname, url);
|
||||||
}
|
}
|
||||||
} while (entries.isEmpty() && removeFirstDomain(hostname));
|
} while (entries.isEmpty() && removeFirstDomain(hostname));
|
||||||
|
|
||||||
|
@ -42,8 +42,8 @@ public:
|
|||||||
Entry* getConfigEntry(bool create = false);
|
Entry* getConfigEntry(bool create = false);
|
||||||
QString getKey(const QString& id);
|
QString getKey(const QString& id);
|
||||||
void addEntry(const QString& id, const QString& login, const QString& password, const QString& url, const QString& submitUrl, const QString& realm);
|
void addEntry(const QString& id, const QString& login, const QString& password, const QString& url, const QString& submitUrl, const QString& realm);
|
||||||
QList<Entry*> searchEntries(Database* db, const QString& hostname);
|
QList<Entry*> searchEntries(Database* db, const QString& hostname, const QString& url);
|
||||||
QList<Entry*> searchEntries(const QString& text, const StringPairList& keyList);
|
QList<Entry*> searchEntries(const QString& url, const StringPairList& keyList);
|
||||||
void removeSharedEncryptionKeys();
|
void removeSharedEncryptionKeys();
|
||||||
void removeStoredPermissions();
|
void removeStoredPermissions();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user