Do not repeat password question if underlying function returns EINVAL.

This error code means invalid value, no point in repeating the whole sequence.
(If there is a situation that requires repeat, it should not return EINVAL.)
This commit is contained in:
Milan Broz
2017-07-26 10:44:42 +02:00
parent e853aa2e7c
commit 6f2ff93519

View File

@@ -304,7 +304,7 @@ static int tcrypt_load(struct crypt_device *cd, struct crypt_params_tcrypt *para
params->passphrase_size = 0;
}
check_signal(&r);
} while ((r == -EPERM || r == -EINVAL || r == -ERANGE) && (--tries > 0));
} while ((r == -EPERM || r == -ERANGE) && (--tries > 0));
/* Report wrong passphrase if at least one try failed */
if (eperm && r == -EPIPE)
@@ -859,7 +859,7 @@ static int action_open_luks(void)
r = crypt_activate_by_passphrase(cd, activated_name,
opt_key_slot, password, passwordLen, activate_flags);
check_signal(&r);
} while ((r == -EPERM || r == -EINVAL || r == -ERANGE) && (--tries > 0));
} while ((r == -EPERM || r == -ERANGE) && (--tries > 0));
}
out:
crypt_safe_free(key);
@@ -1307,7 +1307,7 @@ static int action_luksResume(void)
r = crypt_resume_by_passphrase(cd, action_argv[0], CRYPT_ANY_SLOT,
password, passwordLen);
check_signal(&r);
} while ((r == -EPERM || r == -EINVAL || r == -ERANGE) && (--tries > 0));
} while ((r == -EPERM || r == -ERANGE) && (--tries > 0));
out:
crypt_safe_free(password);
crypt_free(cd);