Skip to content
This repository has been archived by the owner on Oct 17, 2020. It is now read-only.

Commit

Permalink
Fixes #567 (Input string was not in a correct format)
Browse files Browse the repository at this point in the history
  • Loading branch information
luckyrat committed Oct 22, 2015
1 parent bdc83c2 commit e33d14b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Firefox addon/KeeFox/modules/kprpcClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function kprpcClient() {
this.requestId = 1;
this.callbacks = {};
this.callbacksData = {};
this.clientVersion = [1,5,3];
this.clientVersion = [1,5,4];
this.authPromptAborted = false;

// We manually create HMACs to protect the integrity of our AES encrypted messages
Expand Down
20 changes: 15 additions & 5 deletions KeePassRPC/KeePassRPCExt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public sealed class KeePassRPCExt : Plugin
//private static LifetimeServices fakeHack = new LifetimeServices();

// version information
public static readonly Version PluginVersion = new Version(1, 5, 3);
public static readonly Version PluginVersion = new Version(1, 5, 4);

private BackgroundWorker _BackgroundWorker; // used to invoke main thread from other threads
private AutoResetEvent _BackgroundWorkerAutoResetEvent;
Expand Down Expand Up @@ -945,8 +945,7 @@ private void OnKPDBOpen(object sender, FileOpenedEventArgs e)
EnsureDBIconIsInKPRPCIconCache();

// If we've not already upgraded the KPRPC data for this database...
if (!e.Database.CustomData.Exists("KeePassRPC.KeeFox.configVersion")
|| int.Parse(e.Database.CustomData.Get("KeePassRPC.KeeFox.configVersion")) < 1)
if (GetConfigVersion(e.Database) < 1)
{
RemoveKeeFoxTutorialDuplicateEntries(e.Database);

Expand Down Expand Up @@ -1025,8 +1024,7 @@ private void OnKPDBOpen(object sender, FileOpenedEventArgs e)
}
}

if (!e.Database.CustomData.Exists("KeePassRPC.KeeFox.configVersion")
|| int.Parse(e.Database.CustomData.Get("KeePassRPC.KeeFox.configVersion")) < 2)
if (GetConfigVersion(e.Database) < 2)
{
// v2 entry config is backwards compatible but we need to upgrade any KeeFox tutorial
// entries. This means each entry's config version will remain at 1 but the overall
Expand All @@ -1042,6 +1040,18 @@ private void OnKPDBOpen(object sender, FileOpenedEventArgs e)
SignalAllManagedRPCClients(KeePassRPC.DataExchangeModel.Signal.DATABASE_OPEN);
}

private int GetConfigVersion(PwDatabase db)
{
if (db.CustomData.Exists("KeePassRPC.KeeFox.configVersion"))
{
int configVersion = 0;
string configVersionString = db.CustomData.Get("KeePassRPC.KeeFox.configVersion");
if (int.TryParse(configVersionString, out configVersion))
return configVersion;
}
return 0;
}

private void RemoveKeeFoxTutorialDuplicateEntries(PwDatabase db)
{
// We know that this upgrade path may contain duplicate KeeFox
Expand Down
2 changes: 1 addition & 1 deletion KeePassRPC/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ You should have received a copy of the GNU General Public License

// Assembly version information
[assembly: AssemblyVersion("2.0.15.*")]
[assembly: AssemblyFileVersion("1.5.3.0")] // also change PluginVersion in KeePassRPCExt.cs!
[assembly: AssemblyFileVersion("1.5.4.0")] // also change PluginVersion in KeePassRPCExt.cs!

0 comments on commit e33d14b

Please sign in to comment.