Fix minor error : crypto_v2_logins_size must be always updated

This commit is contained in:
Grégory Soutadé 2017-07-19 19:15:21 +02:00
parent 7162129220
commit 8469c01b13

View File

@ -20,7 +20,7 @@
var DEBUG = false; var DEBUG = false;
var protocol_version = 4; var protocol_version = 4;
var account_url = null; var account_url = null;
var crypto_v2_logins_size=0; var crypto_v2_logins_size = 0;
SERVER = {OK : 0, FAILED : 1, RESTART_REQUEST : 2}; SERVER = {OK : 0, FAILED : 1, RESTART_REQUEST : 2};
@ -102,9 +102,9 @@ async function ask_server(form, field, logins, domain, wdomain, mkey, submit)
} }
} }
crypto_v2_logins_size = key_index;
if (await getPref("crypto_v1_compatible")) if (await getPref("crypto_v1_compatible"))
{ {
crypto_v2_logins_size = key_index;
for(a=0; a<logins.length; a++, key_index++) for(a=0; a<logins.length; a++, key_index++)
{ {
enc = await generate_request(domain, logins[a], mkey, global_iv, 1); enc = await generate_request(domain, logins[a], mkey, global_iv, 1);
@ -222,7 +222,7 @@ async function ask_server(form, field, logins, domain, wdomain, mkey, submit)
if (ciphered_password != "") if (ciphered_password != "")
{ {
debug("Ciphered password : " + ciphered_password); debug("Ciphered password : " + ciphered_password);
if (matched_key >= crypto_v2_logins_size || server_protocol_version < 4) if (matched_key >= crypto_v2_logins_size)
// Crypto v1 // Crypto v1
{ {
clear_password = await decrypt_ecb(mkey, hex2a(ciphered_password)); clear_password = await decrypt_ecb(mkey, hex2a(ciphered_password));