Skip to content

Commit

Permalink
Remove duplicate code for matching URLs using old LoginSearchType param
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyrat committed Jun 3, 2020
1 parent 58a71b8 commit 976a0bb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
2 changes: 2 additions & 0 deletions KeePassRPC/DataExchangeModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ public Configuration(string[] MRUList, bool autoCommit)
}
}

// This is no longer used but remains in the DTO spec for backwards compatibility
public enum LoginSearchType { LSTall, LSTnoForms, LSTnoRealms }

public enum FormFieldType { FFTradio, FFTusername, FFTtext, FFTpassword, FFTselect, FFTcheckbox } // ..., HTML 5, etc.
// FFTusername is special type because bultin FF supports with only username and password

Expand Down
18 changes: 1 addition & 17 deletions KeePassRPC/KeePassRPCService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1927,9 +1927,7 @@ public Entry[] FindLogins(string[] unsanitisedURLs, string actionURL,
}
}

// Check for matching URLs for the page containing the form
if (!entryIsAMatch && lst != LoginSearchType.LSTnoForms
&& (string.IsNullOrEmpty(username) || username == entryUserName))
if (!entryIsAMatch && (string.IsNullOrEmpty(username) || username == entryUserName))
{
foreach (string URL in URLs)
{
Expand All @@ -1941,20 +1939,6 @@ public Entry[] FindLogins(string[] unsanitisedURLs, string actionURL,
}
}

// Check for matching URLs for the HTTP Auth containing the form
if (!entryIsAMatch && lst != LoginSearchType.LSTnoRealms
&& (string.IsNullOrEmpty(username) || username == entryUserName))

{
foreach (string URL in URLs)
{
var mam = pwe.GetMatchAccuracyMethod(URLHostnameAndPorts[URL], dbConf);
int accuracy = BestMatchAccuracyForAnyURL(pwe, conf, URL, URLHostnameAndPorts[URL], mam);
if (accuracy > bestMatchAccuracy)
bestMatchAccuracy = accuracy;
}
}

if (bestMatchAccuracy == MatchAccuracy.Best
|| (!requireFullURLMatches && bestMatchAccuracy > MatchAccuracy.None))
entryIsAMatch = true;
Expand Down

0 comments on commit 976a0bb

Please sign in to comment.